Backout 9080f6701733 (bug 852411) for hitting weird xpcshell test harness behavior in multiple local builds
authorGregory Szorc <gps@mozilla.com>
Fri, 14 Jun 2013 14:38:29 -0700
changeset 146632 86155a5809da5b0ed7ce8ee4d8724a6dba7aed5b
parent 146631 cbf52dea3df14b8231c2000c79784a3d12dc6427
child 146633 2b384740198ccbd06d8866278be22e28d00b4126
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs852411
milestone24.0a1
backs out9080f67017333600df504cfb05c8579789c6e347
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backout 9080f6701733 (bug 852411) for hitting weird xpcshell test harness behavior in multiple local builds
browser/base/content/test/browser_datareporting_notification.js
browser/base/content/test/browser_urlbar_search_healthreport.js
browser/components/search/test/browser_healthreport.js
services/common/bagheeraclient.js
services/common/utils.js
services/datareporting/policy.jsm
services/datareporting/tests/xpcshell/test_policy.js
services/datareporting/tests/xpcshell/test_session_recorder.js
services/healthreport/healthreporter.jsm
services/healthreport/modules-testing/utils.jsm
services/healthreport/profile.jsm
services/healthreport/providers.jsm
services/healthreport/tests/xpcshell/test_healthreporter.js
services/healthreport/tests/xpcshell/test_profile.js
services/healthreport/tests/xpcshell/test_provider_sessions.js
services/metrics/dataprovider.jsm
services/metrics/modules-testing/mocks.jsm
services/metrics/providermanager.jsm
services/metrics/storage.jsm
services/metrics/tests/xpcshell/test_metrics_provider_manager.js
services/metrics/tests/xpcshell/test_metrics_storage.js
services/sync/tests/unit/test_bookmark_engine.js
services/sync/tests/unit/test_corrupt_keys.js
--- a/browser/base/content/test/browser_datareporting_notification.js
+++ b/browser/base/content/test/browser_datareporting_notification.js
@@ -18,16 +18,17 @@ function sendNotifyRequest(name) {
 
   let policy = new ns.DataReportingPolicy(policyPrefs, hrPrefs, service);
   policy.firstRunDate = new Date(Date.now() - 24 * 60 * 60 * 1000);
 
   is(policy.notifyState, policy.STATE_NOTIFY_UNNOTIFIED, "Policy is in unnotified state.");
 
   service.healthReporter.onInit().then(function onInit() {
     is(policy.ensureNotifyResponse(new Date()), false, "User has not responded to policy.");
+    is(policy.notifyState, policy.STATE_NOTIFY_WAIT, "Policy is waiting for notification response.");
   });
 
   return policy;
 }
 
 /**
  * Wait for a <notification> to be closed then call the specified callback.
  */
--- a/browser/base/content/test/browser_urlbar_search_healthreport.js
+++ b/browser/base/content/test/browser_urlbar_search_healthreport.js
@@ -40,26 +40,26 @@ function test() {
       }
 
       let tab = gBrowser.addTab();
       gBrowser.selectedTab = tab;
 
       gURLBar.value = "firefox health report";
       gURLBar.handleCommand();
 
-      executeSoon(() => executeSoon(() => {
+      executeSoon(function afterSearch() {
         gBrowser.removeTab(tab);
 
         m.getValues().then(function onData(data) {
           ok(data.days.hasDay(now), "FHR has data for today.");
           let day = data.days.getDay(now);
           ok(day.has(field), "FHR has url bar count for today.");
 
           let newCount = day.get(field);
 
           is(newCount, oldCount + 1, "Exactly one search has been recorded.");
           finish();
         });
-      }));
+      });
     });
   });
 }
 
--- a/browser/components/search/test/browser_healthreport.js
+++ b/browser/components/search/test/browser_healthreport.js
@@ -61,17 +61,17 @@ function test() {
             is(day.get(field), oldCount + 1, "Performing a search increments FHR count by 1.");
 
             let engine = Services.search.getEngineByName("Foo");
             Services.search.removeEngine(engine);
           });
         }
 
         EventUtils.synthesizeKey("VK_RETURN", {});
-        executeSoon(() => executeSoon(afterSearch));
+        executeSoon(afterSearch);
       });
     });
   }
 
   function observer(subject, topic, data) {
     switch (data) {
       case "engine-added":
         let engine = Services.search.getEngineByName("Foo");
--- a/services/common/bagheeraclient.js
+++ b/services/common/bagheeraclient.js
@@ -17,17 +17,17 @@ this.EXPORTED_SYMBOLS = [
   "BagheeraClient",
   "BagheeraClientRequestResult",
 ];
 
 const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
 #endif
 
-Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://services-common/log4moz.js");
 Cu.import("resource://services-common/rest.js");
 Cu.import("resource://services-common/utils.js");
 
 
 /**
  * Represents the result of a Bagheera request.
--- a/services/common/utils.js
+++ b/services/common/utils.js
@@ -1,17 +1,17 @@
 /* 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/. */
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 this.EXPORTED_SYMBOLS = ["CommonUtils"];
 
-Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/osfile.jsm")
 Cu.import("resource://services-common/log4moz.js");
 
 this.CommonUtils = {
   exceptionStr: function exceptionStr(e) {
     if (!e) {
--- a/services/datareporting/policy.jsm
+++ b/services/datareporting/policy.jsm
@@ -21,17 +21,17 @@ this.EXPORTED_SYMBOLS = [
   "DataSubmissionRequest", // For test use only.
   "DataReportingPolicy",
 ];
 
 const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
 #endif
 
-Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
 Cu.import("resource://services-common/log4moz.js");
 Cu.import("resource://services-common/utils.js");
 
 const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
 
 // Used as a sanity lower bound for dates stored in prefs. This module was
 // implemented in 2012, so any earlier dates indicate an incorrect clock.
 const OLDEST_ALLOWED_YEAR = 2012;
@@ -64,43 +64,42 @@ const OLDEST_ALLOWED_YEAR = 2012;
  * user is away from the device). So, no event signaling implicit acceptance
  * is exposed.
  *
  * Receivers of instances of this type should treat it as a black box with
  * the exception of the on* functions.
  *
  * @param policy
  *        (DataReportingPolicy) The policy instance this request came from.
- * @param deferred
+ * @param promise
  *        (deferred) The promise that will be fulfilled when display occurs.
  */
-function NotifyPolicyRequest(policy, deferred) {
+function NotifyPolicyRequest(policy, promise) {
   this.policy = policy;
-  this.deferred = deferred;
+  this.promise = promise;
 }
 NotifyPolicyRequest.prototype = {
   /**
    * Called when the user is notified of the policy.
    *
    * This starts a countdown timer that will eventually signify implicit
    * acceptance of the data policy.
    */
   onUserNotifyComplete: function onUserNotified() {
-    this.deferred.resolve();
-    return this.deferred.promise;
+    this.promise.resolve();
   },
 
   /**
    * Called when there was an error notifying the user about the policy.
    *
    * @param error
    *        (Error) Explains what went wrong.
    */
   onUserNotifyFailed: function onUserNotifyFailed(error) {
-    this.deferred.reject(error);
+    this.promise.reject(error);
   },
 
   /**
    * Called when the user agreed to the data policy.
    *
    * @param reason
    *        (string) How the user agreed to the policy.
    */
@@ -154,66 +153,62 @@ DataSubmissionRequest.prototype = {
    *
    * In the case of upload, this means there is no data to upload (perhaps
    * it isn't available yet). In case of remote deletion, it means that there
    * is no remote data to delete.
    */
   onNoDataAvailable: function onNoDataAvailable() {
     this.state = this.NO_DATA_AVAILABLE;
     this.promise.resolve(this);
-    return this.promise.promise;
   },
 
   /**
    * Data submission has completed successfully.
    *
    * In case of upload, this means the upload completed successfully. In case
    * of deletion, the data was deleted successfully.
    *
    * @param date
    *        (Date) When data submission occurred.
    */
   onSubmissionSuccess: function onSubmissionSuccess(date) {
     this.state = this.SUBMISSION_SUCCESS;
     this.submissionDate = date;
     this.promise.resolve(this);
-    return this.promise.promise;
   },
 
   /**
    * There was a recoverable failure when submitting data.
    *
    * Perhaps the server was down. Perhaps the network wasn't available. The
    * policy may request submission again after a short delay.
    *
    * @param reason
    *        (string) Why the failure occurred. For logging purposes only.
    */
   onSubmissionFailureSoft: function onSubmissionFailureSoft(reason=null) {
     this.state = this.SUBMISSION_FAILURE_SOFT;
     this.reason = reason;
     this.promise.resolve(this);
-    return this.promise.promise;
   },
 
   /**
    * There was an unrecoverable failure when submitting data.
    *
    * Perhaps the client is misconfigured. Perhaps the server rejected the data.
    * Attempts at performing submission again will yield the same result. So,
    * the policy should not try again (until the next day).
    *
    * @param reason
    *        (string) Why the failure occurred. For logging purposes only.
    */
   onSubmissionFailureHard: function onSubmissionFailureHard(reason=null) {
     this.state = this.SUBMISSION_FAILURE_HARD;
     this.reason = reason;
     this.promise.resolve(this);
-    return this.promise.promise;
   },
 };
 
 Object.freeze(DataSubmissionRequest.prototype);
 
 /**
  * Manages scheduling of Firefox Health Report data submission.
  *
--- a/services/datareporting/tests/xpcshell/test_policy.js
+++ b/services/datareporting/tests/xpcshell/test_policy.js
@@ -133,17 +133,17 @@ add_test(function test_notify_state_pref
 
   policy.dataSubmissionPolicyResponseDate = new Date();
   policy._dataSubmissionPolicyNotifiedDate = null;
   do_check_eq(policy.notifyState, policy.STATE_NOTIFY_COMPLETE);
 
   run_next_test();
 });
 
-add_task(function test_initial_submission_notification() {
+add_test(function test_initial_submission_notification() {
   let [policy, policyPrefs, hrPrefs, listener] = getPolicy("initial_submission_notification");
 
   do_check_eq(listener.notifyUserCount, 0);
 
   // Fresh instances should not do anything initially.
   policy.checkStateAndTrigger();
   do_check_eq(listener.notifyUserCount, 0);
 
@@ -155,116 +155,126 @@ add_task(function test_initial_submissio
   do_check_null(policy._dataSubmissionPolicyNotifiedDate);
   do_check_eq(policy.dataSubmissionPolicyNotifiedDate.getTime(), 0);
 
   // We have crossed the threshold. We should see notification.
   defineNow(policy, new Date(policy.firstRunDate.getTime() +
                              policy.SUBMISSION_NOTIFY_INTERVAL_MSEC));
   policy.checkStateAndTrigger();
   do_check_eq(listener.notifyUserCount, 1);
-  yield listener.lastNotifyRequest.onUserNotifyComplete();
+  listener.lastNotifyRequest.onUserNotifyComplete();
   do_check_true(policy._dataSubmissionPolicyNotifiedDate instanceof Date);
   do_check_true(policy.dataSubmissionPolicyNotifiedDate.getTime() > 0);
   do_check_eq(policy.dataSubmissionPolicyNotifiedDate.getTime(),
               policy._dataSubmissionPolicyNotifiedDate.getTime());
   do_check_eq(policy.notifyState, policy.STATE_NOTIFY_WAIT);
+
+  run_next_test();
 });
 
 add_test(function test_bypass_acceptance() {
   let [policy, policyPrefs, hrPrefs, listener] = getPolicy("bypass_acceptance");
 
   policyPrefs.set("dataSubmissionPolicyBypassAcceptance", true);
   do_check_false(policy.dataSubmissionPolicyAccepted);
   do_check_true(policy.dataSubmissionPolicyBypassAcceptance);
   defineNow(policy, new Date(policy.nextDataSubmissionDate.getTime()));
   policy.checkStateAndTrigger();
   do_check_eq(listener.requestDataUploadCount, 1);
 
   run_next_test();
 });
 
-add_task(function test_notification_implicit_acceptance() {
+add_test(function test_notification_implicit_acceptance() {
   let [policy, policyPrefs, hrPrefs, listener] = getPolicy("notification_implicit_acceptance");
 
   let now = new Date(policy.nextDataSubmissionDate.getTime() -
                      policy.SUBMISSION_NOTIFY_INTERVAL_MSEC + 1);
   defineNow(policy, now);
   policy.checkStateAndTrigger();
   do_check_eq(listener.notifyUserCount, 1);
-  yield listener.lastNotifyRequest.onUserNotifyComplete();
+  listener.lastNotifyRequest.onUserNotifyComplete();
   do_check_eq(policy.dataSubmissionPolicyResponseType, "none-recorded");
 
   do_check_true(5000 < policy.IMPLICIT_ACCEPTANCE_INTERVAL_MSEC);
   defineNow(policy, new Date(now.getTime() + 5000));
   policy.checkStateAndTrigger();
   do_check_eq(listener.notifyUserCount, 1);
   do_check_eq(policy.notifyState, policy.STATE_NOTIFY_WAIT);
   do_check_eq(policy.dataSubmissionPolicyResponseDate.getTime(), 0);
   do_check_eq(policy.dataSubmissionPolicyResponseType, "none-recorded");
 
   defineNow(policy, new Date(now.getTime() + policy.IMPLICIT_ACCEPTANCE_INTERVAL_MSEC + 1));
   policy.checkStateAndTrigger();
   do_check_eq(listener.notifyUserCount, 1);
   do_check_eq(policy.notifyState, policy.STATE_NOTIFY_COMPLETE);
   do_check_eq(policy.dataSubmissionPolicyResponseDate.getTime(), policy.now().getTime());
   do_check_eq(policy.dataSubmissionPolicyResponseType, "accepted-implicit-time-elapsed");
+
+  run_next_test();
 });
 
-add_task(function test_notification_rejected() {
+add_test(function test_notification_rejected() {
   // User notification failed. We should not record it as being presented.
   let [policy, policyPrefs, hrPrefs, listener] = getPolicy("notification_failed");
 
   let now = new Date(policy.nextDataSubmissionDate.getTime() -
                      policy.SUBMISSION_NOTIFY_INTERVAL_MSEC + 1);
   defineNow(policy, now);
   policy.checkStateAndTrigger();
   do_check_eq(listener.notifyUserCount, 1);
-  yield listener.lastNotifyRequest.onUserNotifyFailed(new Error("testing failed."));
+  listener.lastNotifyRequest.onUserNotifyFailed(new Error("testing failed."));
   do_check_null(policy._dataSubmissionPolicyNotifiedDate);
   do_check_eq(policy.dataSubmissionPolicyNotifiedDate.getTime(), 0);
   do_check_eq(policy.notifyState, policy.STATE_NOTIFY_UNNOTIFIED);
+
+  run_next_test();
 });
 
-add_task(function test_notification_accepted() {
+add_test(function test_notification_accepted() {
   let [policy, policyPrefs, hrPrefs, listener] = getPolicy("notification_accepted");
 
   let now = new Date(policy.nextDataSubmissionDate.getTime() -
                      policy.SUBMISSION_NOTIFY_INTERVAL_MSEC + 1);
   defineNow(policy, now);
   policy.checkStateAndTrigger();
-  yield listener.lastNotifyRequest.onUserNotifyComplete();
+  listener.lastNotifyRequest.onUserNotifyComplete();
   do_check_eq(policy.notifyState, policy.STATE_NOTIFY_WAIT);
   do_check_false(policy.dataSubmissionPolicyAccepted);
   listener.lastNotifyRequest.onUserNotifyComplete();
   listener.lastNotifyRequest.onUserAccept("foo-bar");
   do_check_eq(policy.notifyState, policy.STATE_NOTIFY_COMPLETE);
   do_check_eq(policy.dataSubmissionPolicyResponseType, "accepted-foo-bar");
   do_check_true(policy.dataSubmissionPolicyAccepted);
   do_check_eq(policy.dataSubmissionPolicyResponseDate.getTime(), now.getTime());
+
+  run_next_test();
 });
 
-add_task(function test_notification_rejected() {
+add_test(function test_notification_rejected() {
   let [policy, policyPrefs, hrPrefs, listener] = getPolicy("notification_rejected");
 
   let now = new Date(policy.nextDataSubmissionDate.getTime() -
                      policy.SUBMISSION_NOTIFY_INTERVAL_MSEC + 1);
   defineNow(policy, now);
   policy.checkStateAndTrigger();
-  yield listener.lastNotifyRequest.onUserNotifyComplete();
+  listener.lastNotifyRequest.onUserNotifyComplete();
   do_check_eq(policy.notifyState, policy.STATE_NOTIFY_WAIT);
   do_check_false(policy.dataSubmissionPolicyAccepted);
   listener.lastNotifyRequest.onUserReject();
   do_check_eq(policy.notifyState, policy.STATE_NOTIFY_COMPLETE);
   do_check_eq(policy.dataSubmissionPolicyResponseType, "rejected-no-reason");
   do_check_false(policy.dataSubmissionPolicyAccepted);
 
   // No requests for submission should occur if user has rejected.
   defineNow(policy, new Date(policy.nextDataSubmissionDate.getTime() + 10000));
   policy.checkStateAndTrigger();
   do_check_eq(listener.requestDataUploadCount, 0);
+
+  run_next_test();
 });
 
 add_test(function test_submission_kill_switch() {
   let [policy, policyPrefs, hrPrefs, listener] = getPolicy("submission_kill_switch");
 
   policy.firstRunDate = new Date(Date.now() - 3 * 24 * 60 * 60 * 1000);
   policy.nextDataSubmissionDate = new Date(Date.now() - 24 * 60 * 60 * 1000);
   policy.recordUserAcceptance("accept-old-ack");
@@ -316,88 +326,94 @@ add_test(function test_data_submission_n
   // The next trigger should try again.
   defineNow(policy, new Date(now.getTime() + 155 * 60 * 1000));
   policy.checkStateAndTrigger();
   do_check_eq(listener.requestDataUploadCount, 2);
 
   run_next_test();
 });
 
-add_task(function test_data_submission_submit_failure_hard() {
+add_test(function test_data_submission_submit_failure_hard() {
   let [policy, policyPrefs, hrPrefs, listener] = getPolicy("data_submission_submit_failure_hard");
 
   policy.dataSubmissionPolicyResponseDate = new Date(Date.now() - 24 * 60 * 60 * 1000);
   policy.dataSubmissionPolicyAccepted = true;
   let nextDataSubmissionDate = policy.nextDataSubmissionDate;
   let now = new Date(policy.nextDataSubmissionDate.getTime() + 1);
   defineNow(policy, now);
 
   policy.checkStateAndTrigger();
   do_check_eq(listener.requestDataUploadCount, 1);
-  yield listener.lastDataRequest.onSubmissionFailureHard();
+  listener.lastDataRequest.onSubmissionFailureHard();
   do_check_eq(listener.lastDataRequest.state,
               listener.lastDataRequest.SUBMISSION_FAILURE_HARD);
 
   let expected = new Date(now.getTime() + 24 * 60 * 60 * 1000);
   do_check_eq(policy.nextDataSubmissionDate.getTime(), expected.getTime());
 
   defineNow(policy, new Date(now.getTime() + 10));
   policy.checkStateAndTrigger();
   do_check_eq(listener.requestDataUploadCount, 1);
+
+  run_next_test();
 });
 
-add_task(function test_data_submission_submit_try_again() {
+add_test(function test_data_submission_submit_try_again() {
   let [policy, policyPrefs, hrPrefs, listener] = getPolicy("data_submission_failure_soft");
 
   policy.recordUserAcceptance();
   let nextDataSubmissionDate = policy.nextDataSubmissionDate;
   let now = new Date(policy.nextDataSubmissionDate.getTime());
   defineNow(policy, now);
   policy.checkStateAndTrigger();
-  yield listener.lastDataRequest.onSubmissionFailureSoft();
+  listener.lastDataRequest.onSubmissionFailureSoft();
   do_check_eq(policy.nextDataSubmissionDate.getTime(),
               nextDataSubmissionDate.getTime() + 15 * 60 * 1000);
+
+  run_next_test();
 });
 
-add_task(function test_submission_daily_scheduling() {
+add_test(function test_submission_daily_scheduling() {
   let [policy, policyPrefs, hrPrefs, listener] = getPolicy("submission_daily_scheduling");
 
   policy.dataSubmissionPolicyResponseDate = new Date(Date.now() - 24 * 60 * 60 * 1000);
   policy.dataSubmissionPolicyAccepted = true;
   let nextDataSubmissionDate = policy.nextDataSubmissionDate;
 
   // Skip ahead to next submission date. We should get a submission request.
   let now = new Date(policy.nextDataSubmissionDate.getTime());
   defineNow(policy, now);
   policy.checkStateAndTrigger();
   do_check_eq(listener.requestDataUploadCount, 1);
   do_check_eq(policy.lastDataSubmissionRequestedDate.getTime(), now.getTime());
 
   let finishedDate = new Date(now.getTime() + 250);
   defineNow(policy, new Date(finishedDate.getTime() + 50));
-  yield listener.lastDataRequest.onSubmissionSuccess(finishedDate);
+  listener.lastDataRequest.onSubmissionSuccess(finishedDate);
   do_check_eq(policy.lastDataSubmissionSuccessfulDate.getTime(), finishedDate.getTime());
 
   // Next scheduled submission should be exactly 1 day after the reported
   // submission success.
 
   let nextScheduled = new Date(finishedDate.getTime() + 24 * 60 * 60 * 1000);
   do_check_eq(policy.nextDataSubmissionDate.getTime(), nextScheduled.getTime());
 
   // Fast forward some arbitrary time. We shouldn't do any work yet.
   defineNow(policy, new Date(now.getTime() + 40000));
   policy.checkStateAndTrigger();
   do_check_eq(listener.requestDataUploadCount, 1);
 
   defineNow(policy, nextScheduled);
   policy.checkStateAndTrigger();
   do_check_eq(listener.requestDataUploadCount, 2);
-  yield listener.lastDataRequest.onSubmissionSuccess(new Date(nextScheduled.getTime() + 200));
+  listener.lastDataRequest.onSubmissionSuccess(new Date(nextScheduled.getTime() + 200));
   do_check_eq(policy.nextDataSubmissionDate.getTime(),
     new Date(nextScheduled.getTime() + 24 * 60 * 60 * 1000 + 200).getTime());
+
+  run_next_test();
 });
 
 add_test(function test_submission_far_future_scheduling() {
   let [policy, policyPrefs, hrPrefs, listener] = getPolicy("submission_far_future_scheduling");
 
   let now = new Date(Date.now() - 24 * 60 * 60 * 1000);
   defineNow(policy, now);
   policy.recordUserAcceptance();
@@ -414,17 +430,17 @@ add_test(function test_submission_far_fu
   policy.checkStateAndTrigger();
   do_check_eq(listener.requestDataUploadCount, 0);
   do_check_eq(policy.nextDataSubmissionDate.getTime(),
               policy._futureDate(24 * 60 * 60 * 1000).getTime());
 
   run_next_test();
 });
 
-add_task(function test_submission_backoff() {
+add_test(function test_submission_backoff() {
   let [policy, policyPrefs, hrPrefs, listener] = getPolicy("submission_backoff");
 
   do_check_eq(policy.FAILURE_BACKOFF_INTERVALS.length, 2);
 
   policy.dataSubmissionPolicyResponseDate = new Date(Date.now() - 24 * 60 * 60 * 1000);
   policy.dataSubmissionPolicyAccepted = true;
 
   let now = new Date(policy.nextDataSubmissionDate.getTime());
@@ -432,17 +448,17 @@ add_task(function test_submission_backof
   policy.checkStateAndTrigger();
   do_check_eq(listener.requestDataUploadCount, 1);
   do_check_eq(policy.currentDaySubmissionFailureCount, 0);
 
   now = new Date(now.getTime() + 5000);
   defineNow(policy, now);
 
   // On first soft failure we should back off by scheduled interval.
-  yield listener.lastDataRequest.onSubmissionFailureSoft();
+  listener.lastDataRequest.onSubmissionFailureSoft();
   do_check_eq(policy.currentDaySubmissionFailureCount, 1);
   do_check_eq(policy.nextDataSubmissionDate.getTime(),
               new Date(now.getTime() + policy.FAILURE_BACKOFF_INTERVALS[0]).getTime());
   do_check_eq(policy.lastDataSubmissionFailureDate.getTime(), now.getTime());
 
   // Should not request submission until scheduled.
   now = new Date(policy.nextDataSubmissionDate.getTime() - 1);
   defineNow(policy, now);
@@ -454,34 +470,36 @@ add_task(function test_submission_backof
   defineNow(policy, now);
   policy.checkStateAndTrigger();
   do_check_eq(listener.requestDataUploadCount, 2);
 
   now = new Date(now.getTime() + 5000);
   defineNow(policy, now);
 
   // On second failure we should back off by more.
-  yield listener.lastDataRequest.onSubmissionFailureSoft();
+  listener.lastDataRequest.onSubmissionFailureSoft();
   do_check_eq(policy.currentDaySubmissionFailureCount, 2);
   do_check_eq(policy.nextDataSubmissionDate.getTime(),
               new Date(now.getTime() + policy.FAILURE_BACKOFF_INTERVALS[1]).getTime());
 
   now = new Date(policy.nextDataSubmissionDate.getTime());
   defineNow(policy, now);
   policy.checkStateAndTrigger();
   do_check_eq(listener.requestDataUploadCount, 3);
 
   now = new Date(now.getTime() + 5000);
   defineNow(policy, now);
 
   // On 3rd failure we should back off by a whole day.
-  yield listener.lastDataRequest.onSubmissionFailureSoft();
+  listener.lastDataRequest.onSubmissionFailureSoft();
   do_check_eq(policy.currentDaySubmissionFailureCount, 0);
   do_check_eq(policy.nextDataSubmissionDate.getTime(),
               new Date(now.getTime() + 24 * 60 * 60 * 1000).getTime());
+
+  run_next_test();
 });
 
 // Ensure that only one submission request can be active at a time.
 add_test(function test_submission_expiring() {
   let [policy, policyPrefs, hrPrefs, listener] = getPolicy("submission_expiring");
 
   policy.dataSubmissionPolicyResponseDate = new Date(Date.now() - 24 * 60 * 60 * 1000);
   policy.dataSubmissionPolicyAccepted = true;
@@ -498,17 +516,17 @@ add_test(function test_submission_expiri
                              policy.SUBMISSION_REQUEST_EXPIRE_INTERVAL_MSEC));
 
   policy.checkStateAndTrigger();
   do_check_eq(listener.requestDataUploadCount, 2);
 
   run_next_test();
 });
 
-add_task(function test_delete_remote_data() {
+add_test(function test_delete_remote_data() {
   let [policy, policyPrefs, hrPrefs, listener] = getPolicy("delete_remote_data");
 
   do_check_false(policy.pendingDeleteRemoteData);
   let nextSubmissionDate = policy.nextDataSubmissionDate;
 
   let now = new Date();
   defineNow(policy, now);
 
@@ -517,18 +535,20 @@ add_task(function test_delete_remote_dat
   do_check_neq(nextSubmissionDate.getTime(),
                policy.nextDataSubmissionDate.getTime());
   do_check_eq(now.getTime(), policy.nextDataSubmissionDate.getTime());
 
   do_check_eq(listener.requestRemoteDeleteCount, 1);
   do_check_true(listener.lastRemoteDeleteRequest.isDelete);
   defineNow(policy, policy._futureDate(1000));
 
-  yield listener.lastRemoteDeleteRequest.onSubmissionSuccess(policy.now());
+  listener.lastRemoteDeleteRequest.onSubmissionSuccess(policy.now());
   do_check_false(policy.pendingDeleteRemoteData);
+
+  run_next_test();
 });
 
 // Ensure that deletion requests take priority over regular data submission.
 add_test(function test_delete_remote_data_priority() {
   let [policy, policyPrefs, hrPrefs, listener] = getPolicy("delete_remote_data_priority");
 
   let now = new Date();
   defineNow(policy, policy._futureDate(-24 * 60 * 60 * 1000));
@@ -576,17 +596,17 @@ add_test(function test_delete_remote_dat
   policy.checkStateAndTrigger();
   do_check_eq(listener.requestRemoteDeleteCount, 2);
 
   run_next_test();
 });
 
 // If we request delete while an upload is in progress, delete should be
 // scheduled immediately after upload.
-add_task(function test_delete_remote_data_in_progress_upload() {
+add_test(function test_delete_remote_data_in_progress_upload() {
   let [policy, policyPrefs, hrPrefs, listener] = getPolicy("delete_remote_data_in_progress_upload");
 
   let now = new Date();
   defineNow(policy, policy._futureDate(-24 * 60 * 60 * 1000));
   policy.recordUserAcceptance();
   defineNow(policy, policy.nextDataSubmissionDate);
 
   policy.checkStateAndTrigger();
@@ -596,22 +616,24 @@ add_task(function test_delete_remote_dat
   // If we request a delete during a pending request, nothing should be done.
   policy.deleteRemoteData();
   policy.checkStateAndTrigger();
   do_check_eq(listener.requestDataUploadCount, 1);
   do_check_eq(listener.requestRemoteDeleteCount, 0);
 
   // Now wait a little bit and finish the request.
   defineNow(policy, policy._futureDate(10 * 1000));
-  yield listener.lastDataRequest.onSubmissionSuccess(policy._futureDate(1000));
+  listener.lastDataRequest.onSubmissionSuccess(policy._futureDate(1000));
   defineNow(policy, policy._futureDate(5000));
 
   policy.checkStateAndTrigger();
   do_check_eq(listener.requestDataUploadCount, 1);
   do_check_eq(listener.requestRemoteDeleteCount, 1);
+
+  run_next_test();
 });
 
 add_test(function test_polling() {
   let [policy, policyPrefs, hrPrefs, listener] = getPolicy("polling");
   let intended = 500;
   let acceptable = 250;     // Because nsITimer doesn't guarantee times.
 
   // Ensure checkStateAndTrigger is called at a regular interval.
@@ -720,39 +742,41 @@ add_test(function test_polling_implicit_
   });
 
   policy.firstRunDate = new Date(Date.now() - 4 * 24 * 60 * 60 * 1000);
   policy.nextDataSubmissionDate = new Date(Date.now());
   start = Date.now();
   policy.startPolling();
 });
 
-add_task(function test_record_health_report_upload_enabled() {
+add_test(function test_record_health_report_upload_enabled() {
   let [policy, policyPrefs, hrPrefs, listener] = getPolicy("record_health_report_upload_enabled");
 
   // Preconditions.
   do_check_false(policy.pendingDeleteRemoteData);
   do_check_true(policy.healthReportUploadEnabled);
   do_check_eq(listener.requestRemoteDeleteCount, 0);
 
   // User intent to disable should immediately result in a pending
   // delete request.
   policy.recordHealthReportUploadEnabled(false, "testing 1 2 3");
   do_check_false(policy.healthReportUploadEnabled);
   do_check_true(policy.pendingDeleteRemoteData);
   do_check_eq(listener.requestRemoteDeleteCount, 1);
 
   // Fulfilling it should make it go away.
-  yield listener.lastRemoteDeleteRequest.onNoDataAvailable();
+  listener.lastRemoteDeleteRequest.onNoDataAvailable();
   do_check_false(policy.pendingDeleteRemoteData);
 
   // User intent to enable should get us back to default state.
   policy.recordHealthReportUploadEnabled(true, "testing 1 2 3");
   do_check_false(policy.pendingDeleteRemoteData);
   do_check_true(policy.healthReportUploadEnabled);
+
+  run_next_test();
 });
 
 add_test(function test_pref_change_initiates_deletion() {
   let [policy, policyPrefs, hrPrefs, listener] = getPolicy("record_health_report_upload_enabled");
 
   // Preconditions.
   do_check_false(policy.pendingDeleteRemoteData);
   do_check_true(policy.healthReportUploadEnabled);
--- a/services/datareporting/tests/xpcshell/test_session_recorder.js
+++ b/services/datareporting/tests/xpcshell/test_session_recorder.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const {utils: Cu} = Components;
 
-Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
 Cu.import("resource://gre/modules/services/datareporting/sessions.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://services-common/utils.js");
 
 
 function run_test() {
   run_next_test();
 }
--- a/services/healthreport/healthreporter.jsm
+++ b/services/healthreport/healthreporter.jsm
@@ -15,17 +15,17 @@ const MILLISECONDS_PER_DAY = 24 * 60 * 6
 Cu.import("resource://gre/modules/Metrics.jsm");
 Cu.import("resource://services-common/async.js");
 
 Cu.import("resource://services-common/bagheeraclient.js");
 #endif
 
 Cu.import("resource://services-common/log4moz.js");
 Cu.import("resource://services-common/utils.js");
-Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
 Cu.import("resource://gre/modules/osfile.jsm");
 Cu.import("resource://gre/modules/Preferences.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://gre/modules/TelemetryStopwatch.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "UpdateChannel",
--- a/services/healthreport/modules-testing/utils.jsm
+++ b/services/healthreport/modules-testing/utils.jsm
@@ -10,17 +10,17 @@ this.EXPORTED_SYMBOLS = [
   "makeFakeAppDir",
   "createFakeCrash",
   "InspectedHealthReporter",
 ];
 
 
 const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
 
-Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
 Cu.import("resource://gre/modules/FileUtils.jsm");
 Cu.import("resource://gre/modules/osfile.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/services-common/utils.js");
 Cu.import("resource://gre/modules/HealthReport.jsm");
 
 
 let APP_INFO = {
--- a/services/healthreport/profile.jsm
+++ b/services/healthreport/profile.jsm
@@ -17,17 +17,17 @@ const MILLISECONDS_PER_DAY = 24 * 60 * 6
 
 Cu.import("resource://gre/modules/Metrics.jsm");
 
 #endif
 
 const DEFAULT_PROFILE_MEASUREMENT_NAME = "age";
 const REQUIRED_UINT32_TYPE = {type: "TYPE_UINT32"};
 
-Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
 Cu.import("resource://gre/modules/osfile.jsm")
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://services-common/log4moz.js");
 Cu.import("resource://services-common/utils.js");
 
 // Profile creation time access.
 // This is separate from the provider to simplify testing and enable extraction
 // to a shared location in the future.
--- a/services/healthreport/providers.jsm
+++ b/services/healthreport/providers.jsm
@@ -29,17 +29,17 @@ this.EXPORTED_SYMBOLS = [
 ];
 
 const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
 Cu.import("resource://gre/modules/Metrics.jsm");
 
 #endif
 
-Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
 Cu.import("resource://gre/modules/osfile.jsm");
 Cu.import("resource://gre/modules/Preferences.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://services-common/utils.js");
 
 XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
--- a/services/healthreport/tests/xpcshell/test_healthreporter.js
+++ b/services/healthreport/tests/xpcshell/test_healthreporter.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
 Cu.import("resource://services-common/observers.js");
 Cu.import("resource://services-common/utils.js");
-Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
 Cu.import("resource://gre/modules/Metrics.jsm");
 Cu.import("resource://gre/modules/osfile.jsm");
 Cu.import("resource://gre/modules/Preferences.jsm");
 let bsp = Cu.import("resource://gre/modules/services/healthreport/healthreporter.jsm");
 Cu.import("resource://gre/modules/services/healthreport/providers.jsm");
 Cu.import("resource://gre/modules/services/datareporting/policy.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
--- a/services/healthreport/tests/xpcshell/test_profile.js
+++ b/services/healthreport/tests/xpcshell/test_profile.js
@@ -7,17 +7,17 @@ const {utils: Cu} = Components;
 
 const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
 
 // Create profile directory before use.
 // It can be no older than a day ago….
 let profile_creation_lower = Date.now() - MILLISECONDS_PER_DAY;
 do_get_profile();
 
-Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
 Cu.import("resource://gre/modules/Metrics.jsm");
 Cu.import("resource://gre/modules/services/healthreport/profile.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 
 
 function MockProfileMetadataProvider(name="MockProfileMetadataProvider") {
   this.name = name;
   ProfileMetadataProvider.call(this);
--- a/services/healthreport/tests/xpcshell/test_provider_sessions.js
+++ b/services/healthreport/tests/xpcshell/test_provider_sessions.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const {utils: Cu} = Components;
 
 
-Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
 Cu.import("resource://gre/modules/Metrics.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://gre/modules/services-common/utils.js");
 Cu.import("resource://gre/modules/services/datareporting/sessions.jsm");
 Cu.import("resource://gre/modules/services/healthreport/providers.jsm");
 
 
 function run_test() {
--- a/services/metrics/dataprovider.jsm
+++ b/services/metrics/dataprovider.jsm
@@ -12,17 +12,17 @@ this.EXPORTED_SYMBOLS = [
 ];
 
 const {utils: Cu} = Components;
 
 const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
 
 #endif
 
-Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
 Cu.import("resource://gre/modules/Preferences.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://services-common/log4moz.js");
 Cu.import("resource://services-common/utils.js");
 
 
 
 /**
--- a/services/metrics/modules-testing/mocks.jsm
+++ b/services/metrics/modules-testing/mocks.jsm
@@ -10,17 +10,17 @@ this.EXPORTED_SYMBOLS = [
   "DummyConstantProvider",
   "DummyPullOnlyThrowsOnInitProvider",
   "DummyThrowOnInitProvider",
   "DummyThrowOnShutdownProvider",
 ];
 
 const {utils: Cu} = Components;
 
-Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
 Cu.import("resource://gre/modules/Metrics.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 
 this.DummyMeasurement = function DummyMeasurement(name="DummyMeasurement") {
   this.name = name;
 
   Metrics.Measurement.call(this);
 }
--- a/services/metrics/providermanager.jsm
+++ b/services/metrics/providermanager.jsm
@@ -7,17 +7,17 @@
 #ifndef MERGED_COMPARTMENT
 this.EXPORTED_SYMBOLS = ["ProviderManager"];
 
 const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
 Cu.import("resource://gre/modules/services/metrics/dataprovider.jsm");
 #endif
 
-Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://services-common/log4moz.js");
 Cu.import("resource://services-common/utils.js");
 
 
 /**
  * Handles and coordinates the collection of metrics data from providers.
  *
--- a/services/metrics/storage.jsm
+++ b/services/metrics/storage.jsm
@@ -14,17 +14,17 @@ this.EXPORTED_SYMBOLS = [
 ];
 
 const {utils: Cu} = Components;
 
 const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
 
 #endif
 
-Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
 Cu.import("resource://gre/modules/Sqlite.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://services-common/log4moz.js");
 Cu.import("resource://services-common/utils.js");
 
 
 // These do not account for leap seconds. Meh.
 function dateToDays(date) {
--- a/services/metrics/tests/xpcshell/test_metrics_provider_manager.js
+++ b/services/metrics/tests/xpcshell/test_metrics_provider_manager.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
 Cu.import("resource://gre/modules/Metrics.jsm");
 Cu.import("resource://testing-common/services/metrics/mocks.jsm");
 
 const PULL_ONLY_TESTING_CATEGORY = "testing-only-pull-only-providers";
 
 function run_test() {
   let cm = Cc["@mozilla.org/categorymanager;1"]
              .getService(Ci.nsICategoryManager);
--- a/services/metrics/tests/xpcshell/test_metrics_storage.js
+++ b/services/metrics/tests/xpcshell/test_metrics_storage.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const {utils: Cu} = Components;
 
-Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
 Cu.import("resource://gre/modules/Metrics.jsm");
 Cu.import("resource://services-common/utils.js");
 
 
 const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
 
 
 function run_test() {
--- a/services/sync/tests/unit/test_bookmark_engine.js
+++ b/services/sync/tests/unit/test_bookmark_engine.js
@@ -5,17 +5,17 @@ Cu.import("resource://gre/modules/Places
 Cu.import("resource://gre/modules/BookmarkJSONUtils.jsm");
 Cu.import("resource://services-common/async.js");
 Cu.import("resource://services-common/log4moz.js");
 Cu.import("resource://services-sync/engines.js");
 Cu.import("resource://services-sync/engines/bookmarks.js");
 Cu.import("resource://services-sync/service.js");
 Cu.import("resource://services-sync/util.js");
 Cu.import("resource://testing-common/services/sync/utils.js");
-Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
 
 Service.engineManager.register(BookmarksEngine);
 var syncTesting = new SyncTestingInfrastructure();
 
 add_test(function bad_record_allIDs() {
   let syncTesting = new SyncTestingInfrastructure();
 
   _("Ensure that bad Places queries don't cause an error in getAllIDs.");
--- a/services/sync/tests/unit/test_corrupt_keys.js
+++ b/services/sync/tests/unit/test_corrupt_keys.js
@@ -6,17 +6,17 @@ Cu.import("resource://services-sync/cons
 Cu.import("resource://services-sync/engines.js");
 Cu.import("resource://services-sync/engines/tabs.js");
 Cu.import("resource://services-sync/engines/history.js");
 Cu.import("resource://services-sync/record.js");
 Cu.import("resource://services-sync/service.js");
 Cu.import("resource://services-sync/status.js");
 Cu.import("resource://services-sync/util.js");
 Cu.import("resource://testing-common/services/sync/utils.js");
-Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
 
 add_task(function test_locally_changed_keys() {
   let passphrase = "abcdeabcdeabcdeabcdeabcdea";
 
   let hmacErrorCount = 0;
   function counting(f) {
     return function() {
       hmacErrorCount++;