Bug 1439380 - Remove uses of Promise.jsm from mobile/android. draft
authorMark Banner <standard8@mozilla.com>
Mon, 19 Feb 2018 15:50:26 +0000
changeset 756985 af74f76bc829910121753dbddbffca64633bec42
parent 756852 ad133cd410a719c0b67e61b8d3b1c77a32fd80a9
push id99624
push userbmo:standard8@mozilla.com
push dateMon, 19 Feb 2018 15:51:00 +0000
bugs1439380
milestone60.0a1
Bug 1439380 - Remove uses of Promise.jsm from mobile/android. MozReview-Commit-ID: KzrWz3K6vva
mobile/android/modules/Accounts.jsm
mobile/android/modules/HomeProvider.jsm
mobile/android/tests/browser/chrome/test_accounts.html
--- a/mobile/android/modules/Accounts.jsm
+++ b/mobile/android/modules/Accounts.jsm
@@ -1,20 +1,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 this.EXPORTED_SYMBOLS = ["Accounts"];
 
-ChromeUtils.import("resource://gre/modules/Deprecated.jsm"); /* global Deprecated */
-ChromeUtils.import("resource://gre/modules/Messaging.jsm"); /* global Messaging */
-ChromeUtils.import("resource://gre/modules/Promise.jsm"); /* global Promise */
-ChromeUtils.import("resource://gre/modules/Services.jsm"); /* global Services */
+ChromeUtils.import("resource://gre/modules/Messaging.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 /**
  * A promise-based API for querying the existence of Sync accounts,
  * and accessing the Sync setup wizard.
  *
  * Usage:
  *
  *   Cu.import("resource://gre/modules/Accounts.jsm");
@@ -37,23 +35,16 @@ var Accounts = Object.freeze({
       kind: kind
     }).then(data => data.exists);
   },
 
   firefoxAccountsExist: function() {
     return this._accountsExist("fxa");
   },
 
-  syncAccountsExist: function() {
-    Deprecated.warning("The legacy Sync account type has been removed from Firefox for Android. " +
-                       "Please use `firefoxAccountsExist` instead.",
-                       "https://developer.mozilla.org/en-US/Add-ons/Firefox_for_Android/API/Accounts.jsm");
-    return Promise.resolve(false);
-  },
-
   anySyncAccountsExist: function() {
     return this._accountsExist("any");
   },
 
   /**
    * Fire-and-forget: open the Firefox accounts activity, which
    * will be the Getting Started screen if FxA isn't yet set up.
    *
--- a/mobile/android/modules/HomeProvider.jsm
+++ b/mobile/android/modules/HomeProvider.jsm
@@ -4,17 +4,16 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 this.EXPORTED_SYMBOLS = [ "HomeProvider" ];
 
 ChromeUtils.import("resource://gre/modules/Messaging.jsm");
 ChromeUtils.import("resource://gre/modules/osfile.jsm");
-ChromeUtils.import("resource://gre/modules/Promise.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/Sqlite.jsm");
 ChromeUtils.import("resource://gre/modules/Task.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 /*
  * SCHEMA_VERSION history:
  *   1: Create HomeProvider (bug 942288)
--- a/mobile/android/tests/browser/chrome/test_accounts.html
+++ b/mobile/android/tests/browser/chrome/test_accounts.html
@@ -11,26 +11,22 @@ Migrated from Robocop: https://bugzilla.
   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SpawnTask.js"></script>
   <link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
   <script type="application/javascript">
 
   ChromeUtils.import("resource://gre/modules/Accounts.jsm");
 
   add_task(function* () {
-    let syncExists = yield Accounts.syncAccountsExist();
-    info("Sync account exists? " + syncExists + "\n");
     let firefoxExists = yield Accounts.firefoxAccountsExist();
     info("Firefox account exists? " + firefoxExists + "\n");
     let anyExists = yield Accounts.anySyncAccountsExist();
     info("Any accounts exist? " + anyExists + "\n");
 
-    // Only one account should exist.
-    ok(!syncExists || !firefoxExists, "at least one account does not exist");
-    is(anyExists, firefoxExists || syncExists, "sync/firefox account existence consistent with any existence");
+    is(anyExists, firefoxExists, "sync/firefox account existence consistent with any existence");
 
     // TODO: How can this be cleaned up?
     // info("Launching setup.\n");
     // Accounts.launchSetup();
   });
 
   </script>
 </head>