bug 1228792 - use function* for generators r=mossop
authorRobert Helmer <rhelmer@mozilla.com>
Wed, 02 Dec 2015 18:42:50 -0800
changeset 309654 5ada25e1f3196f90feb0a930f6c3ef40cb7c141d
parent 309653 9abfe93bfd41bb77d7435e1495c24dbc7ed47771
child 309655 e5c4090f0c4d16a2ffe76f842baa50130bde0e87
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop
bugs1228792
milestone45.0a1
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
bug 1228792 - use function* for generators r=mossop
toolkit/mozapps/extensions/internal/XPIProvider.jsm
toolkit/mozapps/extensions/internal/XPIProviderUtils.js
toolkit/mozapps/extensions/test/browser/browser_bug580298.js
toolkit/mozapps/extensions/test/browser/browser_bug596336.js
toolkit/mozapps/extensions/test/browser/browser_cancelCompatCheck.js
toolkit/mozapps/extensions/test/browser/browser_experiments.js
toolkit/mozapps/extensions/test/xpcshell/test_DeferredSave.js
toolkit/mozapps/extensions/test/xpcshell/test_asyncBlocklistLoad.js
toolkit/mozapps/extensions/test/xpcshell/test_experiment.js
toolkit/mozapps/extensions/test/xpcshell/test_locked2.js
toolkit/mozapps/extensions/test/xpcshell/test_no_addons.js
toolkit/mozapps/extensions/test/xpcshell/test_updateCancel.js
toolkit/mozapps/extensions/test/xpcshell/test_update_strictcompat.js
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -1792,17 +1792,17 @@ function escapeAddonURI(aAddon, aUri, aU
   else if (AddonManager.strictCompatibility)
     compatMode = "strict";
   uri = uri.replace(/%COMPATIBILITY_MODE%/g, compatMode);
 
   return uri;
 }
 
 function removeAsync(aFile) {
-  return Task.spawn(function() {
+  return Task.spawn(function*() {
     let info = null;
     try {
       info = yield OS.File.stat(aFile.path);
       if (info.isDir)
         yield OS.File.removeDir(aFile.path);
       else
         yield OS.File.remove(aFile.path);
     }
@@ -5836,17 +5836,17 @@ AddonInstall.prototype = {
     logger.debug("Starting install of " + this.addon.id + " from " + this.sourceURI.spec);
     AddonManagerPrivate.callAddonListeners("onInstalling",
                                            this.addon.wrapper,
                                            requiresRestart);
 
     let stagingDir = this.installLocation.getStagingDir();
     let stagedAddon = stagingDir.clone();
 
-    Task.spawn((function() {
+    Task.spawn((function*() {
       let installedUnpacked = 0;
       yield this.installLocation.requestStagingDir();
 
       // First stage the file regardless of whether restarting is necessary
       if (this.addon.unpack || Preferences.get(PREF_XPI_UNPACK, false)) {
         logger.debug("Addon " + this.addon.id + " will be installed as " +
             "an unpacked directory");
         stagedAddon.append(this.addon.id);
@@ -7910,17 +7910,17 @@ Object.assign(SystemAddonInstallLocation
       iterator.close();
     }
   }),
 
   /**
    * Installs a new set of system add-ons into the location and updates the
    * add-on set in prefs. We wait to switch state until a restart.
    */
-  installAddonSet: Task.async(function(aAddons) {
+  installAddonSet: Task.async(function*(aAddons) {
     // Make sure the base dir exists
     yield OS.File.makeDir(this._baseDir.path, { ignoreExisting: true });
 
     let newDir = this._baseDir.clone();
 
     let uuidGen = Cc["@mozilla.org/uuid-generator;1"].
                   getService(Ci.nsIUUIDGenerator);
     newDir.append("blank");
--- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
+++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
@@ -209,17 +209,17 @@ function asyncMap(aObjects, aMethod, aCa
 }
 
 /**
  * A generator to synchronously return result rows from an mozIStorageStatement.
  *
  * @param  aStatement
  *         The statement to execute
  */
-function resultRows(aStatement) {
+function* resultRows(aStatement) {
   try {
     while (stepStatement(aStatement))
       yield aStatement.row;
   }
   finally {
     aStatement.reset();
   }
 }
@@ -942,17 +942,17 @@ this.XPIDatabase = {
     try {
       var stmt = aConnection.createStatement("PRAGMA table_info(addon)");
 
       const REQUIRED = ["internal_id", "id", "location", "userDisabled",
                         "installDate", "version"];
 
       let reqCount = 0;
       let props = [];
-      for (let row in resultRows(stmt)) {
+      for (let row of resultRows(stmt)) {
         if (REQUIRED.indexOf(row.name) != -1) {
           reqCount++;
           props.push(row.name);
         }
         else if (DB_METADATA.indexOf(row.name) != -1) {
           props.push(row.name);
         }
         else if (DB_BOOL_METADATA.indexOf(row.name) != -1) {
@@ -962,17 +962,17 @@ this.XPIDatabase = {
 
       if (reqCount < REQUIRED.length) {
         logger.error("Unable to read anything useful from the database");
         return null;
       }
       stmt.finalize();
 
       stmt = aConnection.createStatement("SELECT " + props.join(",") + " FROM addon");
-      for (let row in resultRows(stmt)) {
+      for (let row of resultRows(stmt)) {
         if (!(row.location in migrateData))
           migrateData[row.location] = {};
         let addonData = {
           targetApplications: []
         }
         migrateData[row.location][row.id] = addonData;
 
         props.forEach(function(aProp) {
@@ -989,17 +989,17 @@ this.XPIDatabase = {
                                                    "maxVersion FROM " +
                                                    "targetApplication WHERE " +
                                                    "addon_internal_id=:internal_id");
 
       for (let location in migrateData) {
         for (let id in migrateData[location]) {
           taStmt.params.internal_id = migrateData[location][id].internal_id;
           delete migrateData[location][id].internal_id;
-          for (let row in resultRows(taStmt)) {
+          for (let row of resultRows(taStmt)) {
             migrateData[location][id].targetApplications.push({
               id: row.id,
               minVersion: row.minVersion,
               maxVersion: row.maxVersion
             });
           }
         }
       }
--- a/toolkit/mozapps/extensions/test/browser/browser_bug580298.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug580298.js
@@ -4,17 +4,17 @@
 
 // Tests that certain types of addons do not have their version number
 // displayed. This currently only includes lightweight themes.
 
 var gManagerWindow;
 var gCategoryUtilities;
 var gProvider;
 
-add_task(function test() {
+add_task(function* test() {
   gProvider = new MockProvider();
 
   gProvider.createAddons([{
     id: "extension@tests.mozilla.org",
     name: "Extension 1",
     type: "extension",
     version: "123"
   }, {
--- a/toolkit/mozapps/extensions/test/browser/browser_bug596336.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug596336.js
@@ -56,17 +56,17 @@ var check_addon = Task.async(function*(a
 
   if (aAddon.userDisabled)
     is_element_visible(get_class_node(item, "disabled-postfix"), "Disabled postfix should be hidden");
   else
     is_element_hidden(get_class_node(item, "disabled-postfix"), "Disabled postfix should be hidden");
 });
 
 // Install version 1 then upgrade to version 2 with the manager open
-add_task(function() {
+add_task(function*() {
   yield install_addon("browser_bug596336_1");
   let [aAddon] = yield promiseAddonsByIDs(["addon1@tests.mozilla.org"]);
   yield check_addon(aAddon, "1.0");
   ok(!aAddon.userDisabled, "Add-on should not be disabled");
 
   yield install_addon("browser_bug596336_2");
   [aAddon] = yield promiseAddonsByIDs(["addon1@tests.mozilla.org"]);
   yield check_addon(aAddon, "2.0");
@@ -74,17 +74,17 @@ add_task(function() {
 
   aAddon.uninstall();
 
   is(get_list_item_count(), 0, "Should be no items in the list");
 });
 
 // Install version 1 mark it as disabled then upgrade to version 2 with the
 // manager open
-add_task(function() {
+add_task(function*() {
   yield install_addon("browser_bug596336_1");
   let [aAddon] = yield promiseAddonsByIDs(["addon1@tests.mozilla.org"]);
   aAddon.userDisabled = true;
   yield check_addon(aAddon, "1.0");
   ok(aAddon.userDisabled, "Add-on should be disabled");
 
   yield install_addon("browser_bug596336_2");
   [aAddon] = yield promiseAddonsByIDs(["addon1@tests.mozilla.org"]);
@@ -93,17 +93,17 @@ add_task(function() {
 
   aAddon.uninstall();
 
   is(get_list_item_count(), 0, "Should be no items in the list");
 });
 
 // Install version 1 click the remove button and then upgrade to version 2 with
 // the manager open
-add_task(function() {
+add_task(function*() {
   yield install_addon("browser_bug596336_1");
   let [aAddon] = yield promiseAddonsByIDs(["addon1@tests.mozilla.org"]);
   yield check_addon(aAddon, "1.0");
   ok(!aAddon.userDisabled, "Add-on should not be disabled");
 
   let item = get_addon_element(gManagerWindow, "addon1@tests.mozilla.org");
   EventUtils.synthesizeMouseAtCenter(get_node(item, "remove-btn"), { }, gManagerWindow);
 
@@ -121,17 +121,17 @@ add_task(function() {
 
   aAddon.uninstall();
 
   is(get_list_item_count(), 0, "Should be no items in the list");
 });
 
 // Install version 1, disable it, click the remove button and then upgrade to
 // version 2 with the manager open
-add_task(function() {
+add_task(function*() {
   yield install_addon("browser_bug596336_1");
   let [aAddon] = yield promiseAddonsByIDs(["addon1@tests.mozilla.org"]);
   aAddon.userDisabled = true;
   yield check_addon(aAddon, "1.0");
   ok(aAddon.userDisabled, "Add-on should be disabled");
 
   let item = get_addon_element(gManagerWindow, "addon1@tests.mozilla.org");
   EventUtils.synthesizeMouseAtCenter(get_node(item, "remove-btn"), { }, gManagerWindow);
--- a/toolkit/mozapps/extensions/test/browser/browser_cancelCompatCheck.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_cancelCompatCheck.js
@@ -227,17 +227,17 @@ function* check_addons_uninstalled(aAddo
   info("Add-on uninstall check complete");
   yield true;
 }
 
 // Test what happens when the user cancels during AddonRepository.repopulateCache()
 // Add-ons that have updates available should not update if they were disabled before
 // For this test, addon8 became disabled during update and addon9 was previously disabled,
 // so addon8 should update and addon9 should not
-add_task(function cancel_during_repopulate() {
+add_task(function* cancel_during_repopulate() {
   let a5, a8, a9, a10;
 
   Services.prefs.setBoolPref(PREF_STRICT_COMPAT, true);
   Services.prefs.setCharPref(PREF_MIN_PLATFORM_COMPAT, "0");
   Services.prefs.setCharPref(PREF_UPDATEURL, TESTROOT + "missing.rdf");
 
   let installsDone = promise_observer("TEST:all-updates-done");
 
@@ -292,17 +292,17 @@ add_task(function cancel_during_repopula
   yield promise_uninstall_test_addons();
   info("done uninstalling add-ons");
 });
 
 // User cancels after repopulateCache, while we're waiting for the addon.findUpdates()
 // calls in gVersionInfoPage_onPageShow() to complete
 // For this test, both addon8 and addon9 were disabled by this update, but addon8
 // is set to not auto-update, so only addon9 should update in the background
-add_task(function cancel_during_findUpdates() {
+add_task(function* cancel_during_findUpdates() {
   let a5, a8, a9;
 
   Services.prefs.setBoolPref(PREF_STRICT_COMPAT, true);
   Services.prefs.setCharPref(PREF_MIN_PLATFORM_COMPAT, "0");
 
   // Clear the AddonRepository-last-updated preference to ensure that it reloads
   Services.prefs.clearUserPref(PREF_METADATA_LASTUPDATE);
   let observeUpdateDone = promise_observer("TEST:addon-repository-data-updated");
@@ -352,17 +352,17 @@ add_task(function cancel_during_findUpda
   info("findUpdates done");
   yield promise_uninstall_test_addons();
 });
 
 // Cancelling during the 'mismatch' screen allows add-ons that can auto-update
 // to continue updating in the background and cancels any other updates
 // Same conditions as the previous test - addon8 and addon9 have updates available,
 // addon8 is set to not auto-update so only addon9 should become compatible
-add_task(function cancel_mismatch() {
+add_task(function* cancel_mismatch() {
   let a3, a5, a7, a8, a9;
 
   Services.prefs.setBoolPref(PREF_STRICT_COMPAT, true);
   Services.prefs.setCharPref(PREF_MIN_PLATFORM_COMPAT, "0");
 
   // Clear the AddonRepository-last-updated preference to ensure that it reloads
   Services.prefs.clearUserPref(PREF_METADATA_LASTUPDATE);
   let installsDone = promise_observer("TEST:all-updates-done");
@@ -411,17 +411,17 @@ add_task(function cancel_mismatch() {
   ok(installs.length == 0, "No remaining add-on installs (" + installs.toSource() + ")");
 
   yield promise_uninstall_test_addons();
   yield check_addons_uninstalled(addonList);
 });
 
 // Cancelling during the 'mismatch' screen with only add-ons that have
 // no updates available
-add_task(function cancel_mismatch_no_updates() {
+add_task(function* cancel_mismatch_no_updates() {
   let a3, a5, a6
 
   Services.prefs.setBoolPref(PREF_STRICT_COMPAT, true);
   Services.prefs.setCharPref(PREF_MIN_PLATFORM_COMPAT, "0");
 
   // Don't pull compatibility data during add-on install
   Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, false);
   // No delay on the .sjs this time because we want the cache to repopulate
--- a/toolkit/mozapps/extensions/test/browser/browser_experiments.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_experiments.js
@@ -326,17 +326,17 @@ add_task(function* testActivateExperimen
   yield deferred.promise;
 
   Assert.ok(gCategoryUtilities.isTypeVisible, "experiment", "Experiment tab visible.");
   yield gCategoryUtilities.openType("experiment");
   let el = gManagerWindow.document.getElementsByClassName("experiment-info-container")[0];
   is_element_visible(el, "Experiment info is visible on experiment tab.");
 });
 
-add_task(function testDeactivateExperiment() {
+add_task(function* testDeactivateExperiment() {
   if (!gExperiments) {
     return;
   }
 
   // Fake an empty manifest to purge data from previous manifest.
   yield gExperiments._updateExperiments({
     "version": 1,
     "experiments": [],
@@ -374,17 +374,17 @@ add_task(function testDeactivateExperime
   el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "disable-btn");
   is_element_hidden(el, "Disable button is not visible.");
   el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "enable-btn");
   is_element_hidden(el, "Enable button is not visible.");
   el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "preferences-btn");
   is_element_hidden(el, "Preferences button is not visible.");
 });
 
-add_task(function testActivateRealExperiments() {
+add_task(function* testActivateRealExperiments() {
   if (!gExperiments) {
     info("Skipping experiments test because that feature isn't available.");
     return;
   }
 
   yield gExperiments._updateExperiments({
     "version": 1,
     "experiments": [
@@ -527,17 +527,17 @@ add_task(function testActivateRealExperi
 
   el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
   is_element_visible(el, "Experiment time label should be visible.");
   if (gIsEnUsLocale) {
     Assert.equal(el.value, "5 days ago");
   }
 });
 
-add_task(function testDetailView() {
+add_task(function* testDetailView() {
   if (!gExperiments) {
     info("Skipping experiments test because that feature isn't available.");
     return;
   }
 
   defineNow(gExperiments._policy, Date.now());
   yield gExperiments._updateExperiments({
     "version": 1,
--- a/toolkit/mozapps/extensions/test/xpcshell/test_DeferredSave.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_DeferredSave.js
@@ -142,29 +142,29 @@ function delay(aDelayMS) {
   return deferred.promise;
 }
 
 function run_test() {
   run_next_test();
 }
 
 // Modify set data once, ask for save, make sure it saves cleanly
-add_task(function test_basic_save_succeeds() {
+add_task(function* test_basic_save_succeeds() {
   setQuickMockTimer();
   let tester = DeferredSaveTester();
   let data = "Test 1 Data";
 
   yield tester.save(data);
   do_check_eq(tester.writtenData, data);
   do_check_eq(1, tester.saver.totalSaves);
 });
 
 // Two saves called during the same event loop, both with callbacks
 // Make sure we save only the second version of the data
-add_task(function test_two_saves() {
+add_task(function* test_two_saves() {
   setQuickMockTimer();
   let tester = DeferredSaveTester();
   let firstCallback_happened = false;
   let firstData = "Test first save";
   let secondData = "Test second save";
 
   // first save should not resolve until after the second one is called,
   // so we can't just yield this promise
@@ -177,17 +177,17 @@ add_task(function test_two_saves() {
   yield tester.save(secondData);
   do_check_true(firstCallback_happened);
   do_check_eq(secondData, tester.writtenData);
   do_check_eq(1, tester.saver.totalSaves);
 });
 
 // Two saves called with a delay in between, both with callbacks
 // Make sure we save the second version of the data
-add_task(function test_two_saves_delay() {
+add_task(function* test_two_saves_delay() {
   let timerPromise = setPromiseMockTimer();
   let tester = DeferredSaveTester();
   let firstCallback_happened = false;
   let delayDone = false;
 
   let firstData = "First data to save with delay";
   let secondData = "Modified data to save with delay";
 
@@ -214,17 +214,17 @@ add_task(function test_two_saves_delay()
   do_check_eq(secondData, tester.writtenData);
   do_check_eq(1, tester.saver.totalSaves);
   do_check_eq(0, tester.saver.overlappedSaves);
 });
 
 // Test case where OS.File immediately reports an error when the write begins
 // Also check that the "error" getter correctly returns the error
 // Then do a write that succeeds, and make sure the error is cleared
-add_task(function test_error_immediate() {
+add_task(function* test_error_immediate() {
   let tester = DeferredSaveTester();
   let testError = new Error("Forced failure");
   function writeFail(aTester) {
     aTester.waDeferred.reject(testError);
   }
 
   setQuickMockTimer();
   yield tester.save("test_error_immediate", writeFail).then(
@@ -238,17 +238,17 @@ add_task(function test_error_immediate()
   do_check_eq(null, tester.lastError);
   // The failed save attempt counts in our total
   do_check_eq(2, tester.saver.totalSaves);
 });
 
 // Save one set of changes, then while the write is in progress, modify the
 // data two more times. Test that we re-write the dirty data exactly once
 // after the first write succeeds
-add_task(function dirty_while_writing() {
+add_task(function* dirty_while_writing() {
   let tester = DeferredSaveTester();
   let firstData = "First data";
   let secondData = "Second data";
   let thirdData = "Third data";
   let firstCallback_happened = false;
   let secondCallback_happened = false;
   let writeStarted = Promise.defer();
 
@@ -312,28 +312,28 @@ function write_then_disable(aTester) {
   do_print("write_then_disable");
   let length = aTester.writtenData.length;
   aTester.writeHandler = disabled_write_callback;
   do_execute_soon(() => aTester.waDeferred.resolve(length));
 }
 
 // Flush tests. First, do an ordinary clean save and then call flush;
 // there should not be another save
-add_task(function flush_after_save() {
+add_task(function* flush_after_save() {
   setQuickMockTimer();
   let tester = DeferredSaveTester();
   let dataToSave = "Flush after save";
 
   yield tester.save(dataToSave);
   yield tester.flush(disabled_write_callback);
   do_check_eq(1, tester.saver.totalSaves);
 });
 
 // Flush while a write is in progress, but the in-memory data is clean
-add_task(function flush_during_write() {
+add_task(function* flush_during_write() {
   let tester = DeferredSaveTester();
   let dataToSave = "Flush during write";
   let firstCallback_happened = false;
   let writeStarted = Promise.defer();
 
   function writeCallback(aTester) {
     writeStarted.resolve(aTester.waDeferred);
   }
@@ -356,17 +356,17 @@ add_task(function flush_during_write() {
   yield flushing;
   do_check_true(firstCallback_happened);
   do_check_eq(1, tester.saver.totalSaves);
 });
 
 // Flush while dirty but write not in progress
 // The data written should be the value at the time
 // flush() is called, even if it is changed later
-add_task(function flush_while_dirty() {
+add_task(function* flush_while_dirty() {
   let timerPromise = setPromiseMockTimer();
   let tester = DeferredSaveTester();
   let firstData = "Flush while dirty, valid data";
   let firstCallback_happened = false;
 
   tester.save(firstData, write_then_disable).then(
     count => {
       do_check_false(firstCallback_happened);
@@ -392,17 +392,17 @@ add_task(function flush_while_dirty() {
   do_check_eq(1, tester.saver.totalSaves);
 });
 
 // And the grand finale - modify the data, start writing,
 // modify the data again so we're in progress and dirty,
 // then flush, then modify the data again
 // Data for the second write should be taken at the time
 // flush() is called, even if it is modified later
-add_task(function flush_writing_dirty() {
+add_task(function* flush_writing_dirty() {
   let timerPromise = setPromiseMockTimer();
   let tester = DeferredSaveTester();
   let firstData = "Flush first pass data";
   let secondData = "Flush second pass data";
   let firstCallback_happened = false;
   let secondCallback_happened = false;
   let writeStarted = Promise.defer();
 
@@ -458,27 +458,27 @@ var badDataError = null;
 function badDataProvider() {
   let err = new Error(badDataError);
   badDataError = "badDataProvider called twice";
   throw err;
 }
 
 // Handle cases where data provider throws
 // First, throws during a normal save
-add_task(function data_throw() {
+add_task(function* data_throw() {
   setQuickMockTimer();
   badDataError = expectedDataError;
   let tester = DeferredSaveTester(badDataProvider);
   yield tester.save("data_throw").then(
     count => do_throw("Expected serialization failure"),
     error => do_check_eq(error.message, expectedDataError));
 });
 
 // Now, throws during flush
-add_task(function data_throw_during_flush() {
+add_task(function* data_throw_during_flush() {
   badDataError = expectedDataError;
   let tester = DeferredSaveTester(badDataProvider);
   let firstCallback_happened = false;
 
   setPromiseMockTimer();
   // Write callback should never be called
   tester.save("data_throw_during_flush", disabled_write_callback).then(
     count => do_throw("Expected serialization failure"),
@@ -503,17 +503,17 @@ add_task(function data_throw_during_flus
 // saveChanges
 // finish writing (need to restart delayed timer)
 // saveChanges
 // flush
 // write starts
 // actually restart timer for delayed write
 // write completes
 // delayed timer goes off, throws error because DeferredSave has been torn down
-add_task(function delay_flush_race() {
+add_task(function* delay_flush_race() {
   let timerPromise = setPromiseMockTimer();
   let tester = DeferredSaveTester();
   let firstData = "First save";
   let secondData = "Second save";
   let thirdData = "Third save";
   let writeStarted = Promise.defer();
 
   function writeCallback(aTester) {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_asyncBlocklistLoad.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_asyncBlocklistLoad.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 function run_test() {
   run_next_test();
 }
 
-add_task(function () {
+add_task(function* () {
   let blocklist = AM_Cc["@mozilla.org/extensions/blocklist;1"].
                   getService().wrappedJSObject;
   let scope = Components.utils.import("resource://gre/modules/osfile.jsm");
 
   // sync -> async
   blocklist._loadBlocklist();
   do_check_true(blocklist._isBlocklistLoaded());
   yield blocklist._preloadBlocklist();
--- a/toolkit/mozapps/extensions/test/xpcshell/test_experiment.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_experiment.js
@@ -106,17 +106,17 @@ add_task(function* test_userDisabledNotP
   Assert.ok(addon.userDisabled, "Add-on is disabled after restart.");
   Assert.equal(addon.isActive, false, "Add-on is not active after restart.");
   addon.uninstall();
 
   BootstrapMonitor.checkAddonNotInstalled(ID);
   BootstrapMonitor.checkAddonNotStarted(ID);
 });
 
-add_task(function test_checkCompatibility() {
+add_task(function* test_checkCompatibility() {
   if (gIsNightly)
     Services.prefs.setBoolPref("extensions.checkCompatibility.nightly", false);
   else
     Services.prefs.setBoolPref("extensions.checkCompatibility.1", false);
 
   yield promiseRestartManager();
 
   yield promiseInstallAllFiles([do_get_addon("test_experiment1")]);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_locked2.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_locked2.js
@@ -66,17 +66,17 @@ var addon5 = {
     minVersion: "2",
     maxVersion: "2"
   }]
 };
 
 const profileDir = gProfD.clone();
 profileDir.append("extensions");
 
-add_task(function() {
+add_task(function*() {
 
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2");
 
   writeInstallRDFForExtension(addon1, profileDir);
   writeInstallRDFForExtension(addon2, profileDir);
   writeInstallRDFForExtension(addon3, profileDir);
   writeInstallRDFForExtension(addon4, profileDir);
   writeInstallRDFForExtension(addon5, profileDir);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_no_addons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_no_addons.js
@@ -51,37 +51,37 @@ function check_empty_state() {
 
 // After first run with no add-ons, we expect:
 // no extensions.json is created
 // no extensions.ini
 // database schema version preference is set
 // bootstrap add-ons preference is not found
 // add-on directory state preference is an empty array
 // no pending operations
-add_task(function first_run() {
+add_task(function* first_run() {
   startupManager();
   check_empty_state();
   yield true;
 });
 
 // Now do something that causes a DB load, and re-check
-function trigger_db_load() {
+function* trigger_db_load() {
   let addonDefer = Promise.defer();
   AddonManager.getAddonsByTypes(['extension'], addonDefer.resolve);
   let addonList = yield addonDefer.promise;
 
   do_check_eq(addonList.length, 0);
   check_empty_state();
 
   yield true;
 };
 add_task(trigger_db_load);
 
 // Now restart the manager and check again
-add_task(function restart_and_recheck() {
+add_task(function* restart_and_recheck() {
   restartManager();
   check_empty_state();
   yield true;
 });
 
 // and reload the DB again
 add_task(trigger_db_load);
 
--- a/toolkit/mozapps/extensions/test/xpcshell/test_updateCancel.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_updateCancel.js
@@ -70,17 +70,17 @@ writeInstallRDFForExtension({
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "1"
   }],
   name: "Test Addon 1",
 }, profileDir);
 
-add_task(function cancel_during_check() {
+add_task(function* cancel_during_check() {
   startupManager();
 
   let a1 = yield promiseAddonByID("addon1@tests.mozilla.org");
   do_check_neq(a1, null);
 
   let listener = makeCancelListener();
   a1.findUpdates(listener, AddonManager.UPDATE_WHEN_USER_REQUESTED);
 
@@ -104,17 +104,17 @@ add_task(function cancel_during_check() 
   // trying to cancel again should return false, i.e. nothing to cancel
   do_check_false(a1.cancelUpdate());
 
   yield true;
 });
 
 // Test that update check is cancelled if the XPI provider shuts down while
 // the update check is in progress
-add_task(function shutdown_during_check() {
+add_task(function* shutdown_during_check() {
   // Reset our HTTP listener
   httpReceived = Promise.defer();
 
   let a1 = yield promiseAddonByID("addon1@tests.mozilla.org");
   do_check_neq(a1, null);
 
   let listener = makeCancelListener();
   a1.findUpdates(listener, AddonManager.UPDATE_WHEN_USER_REQUESTED);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_update_strictcompat.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_update_strictcompat.js
@@ -1017,17 +1017,17 @@ for (let test of testParams) {
 
         onUpdateFinished: function() {
           run_next_test();
         }
       }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
     });
   });
 
-  add_task(function cleanup() {
+  add_task(function* cleanup() {
     let addons = yield new Promise(resolve => {
       AddonManager.getAddonsByTypes(["extension"], resolve);
     });
 
     for (let addon of addons)
       addon.uninstall();
 
     yield promiseRestartManager();