Bug 1247201 - yield on tests using removeDataFromDomain,r=mak
authormilindl <i.milind.luthra@gmail.com>
Fri, 17 Mar 2017 14:29:48 +0530
changeset 350041 860cafd805c80326e83af4b1aaa9a3c3681f9b4d
parent 350040 0acbd98f996d1207931648bb7e742a64d19abffd
child 350042 850cf5d6d37dcdb71cc9c22344a6ca33db6a382e
push id31567
push userkwierso@gmail.com
push dateTue, 28 Mar 2017 20:16:07 +0000
treeherdermozilla-central@e23cf1b38ad4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1247201
milestone55.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 1247201 - yield on tests using removeDataFromDomain,r=mak This changeset changes tests using ForgetAboutSite.removeDataFromDomain to yield on it, since now it is a Task MozReview-Commit-ID: 72OEYoO1avd
browser/components/contextualidentity/test/browser/browser_forgetaboutsite.js
browser/components/migration/tests/unit/test_Chrome_cookies.js
browser/components/sessionstore/test/browser_394759_purge.js
browser/components/sessionstore/test/browser_464199.js
dom/indexedDB/test/browser_forgetThisSite.js
toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js
toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
--- a/browser/components/contextualidentity/test/browser/browser_forgetaboutsite.js
+++ b/browser/components/contextualidentity/test/browser/browser_forgetaboutsite.js
@@ -145,17 +145,17 @@ function* test_cookie_cleared() {
     ok(enumerator.hasMoreElements(), "Cookies available");
 
     let foundCookie = enumerator.getNext().QueryInterface(Ci.nsICookie2);
     Assert.equal(foundCookie["name"], COOKIE_NAME, "Check cookie name");
     Assert.equal(foundCookie["value"], USER_CONTEXTS[userContextId], "Check cookie value");
   }
 
   // Forget the site.
-  ForgetAboutSite.removeDataFromDomain(TEST_HOST);
+  yield ForgetAboutSite.removeDataFromDomain(TEST_HOST);
 
   // Check that whether cookies has been cleared or not.
   for (let userContextId of Object.keys(USER_CONTEXTS)) {
     let enumerator = getCookiesForOA(TEST_HOST, userContextId);
     ok(!enumerator.hasMoreElements(), "No Cookie should be here");
   }
 }
 
@@ -180,17 +180,17 @@ function* test_cache_cleared() {
     let mem = getCacheStorage("memory", LoadContextInfo.custom(false, {userContextId}));
     let disk = getCacheStorage("disk", LoadContextInfo.custom(false, {userContextId}));
 
     Assert.ok(mem.exists(createURI("http://" + TEST_HOST + "/"), ""), "The memory cache has been set correctly");
     Assert.ok(disk.exists(createURI("http://" + TEST_HOST + "/"), ""), "The disk cache has been set correctly");
   }
 
   // Forget the site.
-  ForgetAboutSite.removeDataFromDomain(TEST_HOST);
+  yield ForgetAboutSite.removeDataFromDomain(TEST_HOST);
 
   // Check that do caches be removed or not?
   for (let userContextId of Object.keys(USER_CONTEXTS)) {
     let mem = getCacheStorage("memory", LoadContextInfo.custom(false, {userContextId}));
     let disk = getCacheStorage("disk", LoadContextInfo.custom(false, {userContextId}));
 
     Assert.ok(!mem.exists(createURI("http://" + TEST_HOST + "/"), ""), "The memory cache is cleared");
     Assert.ok(!disk.exists(createURI("http://" + TEST_HOST + "/"), ""), "The disk cache is cleared");
@@ -212,17 +212,17 @@ function* test_image_cache_cleared() {
 
   // Check that image cache works with the userContextId.
   is(gHits, expectedHits, "The image should be loaded" + expectedHits + "times.");
 
   // Reset the cache count.
   gHits = 0;
 
   // Forget the site.
-  ForgetAboutSite.removeDataFromDomain("localhost:" + gHttpServer.identity.primaryPort + "/");
+  yield ForgetAboutSite.removeDataFromDomain("localhost:" + gHttpServer.identity.primaryPort + "/");
 
   // Load again.
   for (let userContextId of Object.keys(USER_CONTEXTS)) {
     // Open our tab in the given user context to cache image.
     tabs[userContextId] = yield* openTabInUserContext("http://localhost:" + gHttpServer.identity.primaryPort + "/loadImage.html",
                                                       userContextId);
     yield BrowserTestUtils.removeTab(tabs[userContextId].tab);
   }
@@ -271,17 +271,17 @@ function* test_storage_cleared() {
       });
     });
 
     // Close this tab.
     yield BrowserTestUtils.removeTab(tabInfo.tab);
   }
 
   // Forget the site.
-  ForgetAboutSite.removeDataFromDomain(TEST_HOST);
+  yield ForgetAboutSite.removeDataFromDomain(TEST_HOST);
 
   // Open the tab again without setting the localStorage and check that the
   // local storage has been cleared or not.
   for (let userContextId of Object.keys(USER_CONTEXTS)) {
     // Open our tab in the given user context without setting local storage.
     let tabInfo = yield* openTabInUserContext(TEST_URL + "file_set_storages.html", userContextId);
 
     // Check that do storages be cleared or not.
--- a/browser/components/migration/tests/unit/test_Chrome_cookies.js
+++ b/browser/components/migration/tests/unit/test_Chrome_cookies.js
@@ -40,12 +40,12 @@ add_task(function* () {
   Assert.ok(enumerator.hasMoreElements(), "Cookies available");
   let foundCookie = enumerator.getNext().QueryInterface(Ci.nsICookie2);
 
   for (let prop of Object.keys(COOKIE)) {
     Assert.equal(foundCookie[prop], COOKIE[prop], "Check cookie " + prop);
   }
 
   // Cleanup.
-  ForgetAboutSite.removeDataFromDomain(COOKIE.host);
+  yield ForgetAboutSite.removeDataFromDomain(COOKIE.host);
   Assert.equal(Services.cookies.countCookiesFromHost(COOKIE.host), 0,
                "There are no cookies after cleanup");
 });
--- a/browser/components/sessionstore/test/browser_394759_purge.js
+++ b/browser/components/sessionstore/test/browser_394759_purge.js
@@ -1,26 +1,27 @@
 /* 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/. */
 
 Components.utils.import("resource://gre/modules/ForgetAboutSite.jsm");
 
-function waitForClearHistory(aCallback) {
-  let observer = {
-    observe(aSubject, aTopic, aData) {
-      Services.obs.removeObserver(this, "browser:purge-domain-data");
-      setTimeout(aCallback, 0);
-    }
-  };
-  Services.obs.addObserver(observer, "browser:purge-domain-data", false);
+function promiseClearHistory() {
+  return new Promise(resolve => {
+    let observer = {
+      observe(aSubject, aTopic, aData) {
+        Services.obs.removeObserver(this, "browser:purge-domain-data");
+        resolve();
+      }
+    };
+    Services.obs.addObserver(observer, "browser:purge-domain-data", false);
+  });
 }
 
-function test() {
-  waitForExplicitFinish();
+add_task(function* () {
   // utility functions
   function countClosedTabsByTitle(aClosedTabList, aTitle) {
     return aClosedTabList.filter(aData => aData.title == aTitle).length;
   }
 
   function countOpenTabsByTitle(aOpenTabList, aTitle) {
     return aOpenTabList.filter(aData => aData.entries.some(aEntry => aEntry.title == aTitle)).length;
   }
@@ -87,44 +88,42 @@ function test() {
       }
     ]
   };
 
   // set browser to test state
   ss.setBrowserState(JSON.stringify(testState));
 
   // purge domain & check that we purged correctly for closed windows
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
-  waitForClearHistory(function() {
-    let closedWindowData = JSON.parse(ss.getClosedWindowData());
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield promiseClearHistory();
+  let closedWindowData = JSON.parse(ss.getClosedWindowData());
 
-    // First set of tests for _closedWindows[0] - tests basics
-    let win = closedWindowData[0];
-    is(win.tabs.length, 1, "1 tab was removed");
-    is(countOpenTabsByTitle(win.tabs, FORGET), 0,
-       "The correct tab was removed");
-    is(countOpenTabsByTitle(win.tabs, REMEMBER), 1,
-       "The correct tab was remembered");
-    is(win.selected, 1, "Selected tab has changed");
-    is(win.title, REMEMBER, "The window title was correctly updated");
+  // First set of tests for _closedWindows[0] - tests basics
+  let win = closedWindowData[0];
+  is(win.tabs.length, 1, "1 tab was removed");
+  is(countOpenTabsByTitle(win.tabs, FORGET), 0,
+     "The correct tab was removed");
+  is(countOpenTabsByTitle(win.tabs, REMEMBER), 1,
+     "The correct tab was remembered");
+  is(win.selected, 1, "Selected tab has changed");
+  is(win.title, REMEMBER, "The window title was correctly updated");
 
-    // Test more complicated case
-    win = closedWindowData[1];
-    is(win.tabs.length, 3, "2 tabs were removed");
-    is(countOpenTabsByTitle(win.tabs, FORGET), 0,
-       "The correct tabs were removed");
-    is(countOpenTabsByTitle(win.tabs, REMEMBER), 3,
-       "The correct tabs were remembered");
-    is(win.selected, 3, "Selected tab has changed");
-    is(win.title, REMEMBER, "The window title was correctly updated");
+  // Test more complicated case
+  win = closedWindowData[1];
+  is(win.tabs.length, 3, "2 tabs were removed");
+  is(countOpenTabsByTitle(win.tabs, FORGET), 0,
+     "The correct tabs were removed");
+  is(countOpenTabsByTitle(win.tabs, REMEMBER), 3,
+     "The correct tabs were remembered");
+  is(win.selected, 3, "Selected tab has changed");
+  is(win.title, REMEMBER, "The window title was correctly updated");
 
-    // Tests handling of _closedTabs
-    win = closedWindowData[2];
-    is(countClosedTabsByTitle(win._closedTabs, REMEMBER), 1,
-       "The correct number of tabs were removed, and the correct ones");
-    is(countClosedTabsByTitle(win._closedTabs, FORGET), 0,
-       "All tabs to be forgotten were indeed removed");
+  // Tests handling of _closedTabs
+  win = closedWindowData[2];
+  is(countClosedTabsByTitle(win._closedTabs, REMEMBER), 1,
+     "The correct number of tabs were removed, and the correct ones");
+  is(countClosedTabsByTitle(win._closedTabs, FORGET), 0,
+     "All tabs to be forgotten were indeed removed");
 
-    // restore pre-test state
-    ss.setBrowserState(oldState);
-    finish();
-  });
-}
+  // restore pre-test state
+  ss.setBrowserState(oldState);
+});
--- a/browser/components/sessionstore/test/browser_464199.js
+++ b/browser/components/sessionstore/test/browser_464199.js
@@ -1,29 +1,29 @@
 /* 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/. */
 
 Components.utils.import("resource://gre/modules/ForgetAboutSite.jsm");
 
-function waitForClearHistory(aCallback) {
-  let observer = {
-    observe(aSubject, aTopic, aData) {
-      Services.obs.removeObserver(this, "browser:purge-domain-data");
-      setTimeout(aCallback, 0);
-    }
-  };
-  Services.obs.addObserver(observer, "browser:purge-domain-data", false);
+function promiseClearHistory() {
+  return new Promise(resolve => {
+    let observer = {
+      observe(aSubject, aTopic, aData) {
+        Services.obs.removeObserver(this, "browser:purge-domain-data");
+        resolve();
+      }
+    };
+    Services.obs.addObserver(observer, "browser:purge-domain-data", false);
+  });
 }
 
-function test() {
+add_task(function* () {
   /** Test for Bug 464199 **/
 
-  waitForExplicitFinish();
-
   const REMEMBER = Date.now(), FORGET = Math.random();
   let test_state = { windows: [{ "tabs": [{ "entries": [] }], _closedTabs: [
     { state: { entries: [{ url: "http://www.example.net/" }] }, title: FORGET },
     { state: { entries: [{ url: "http://www.example.org/" }] }, title: REMEMBER },
     { state: { entries: [{ url: "http://www.example.net/" },
                          { url: "http://www.example.org/" }] }, title: FORGET },
     { state: { entries: [{ url: "http://example.net/" }] }, title: FORGET },
     { state: { entries: [{ url: "http://sub.example.net/" }] }, title: FORGET },
@@ -48,38 +48,35 @@ function test() {
   let remember_count = 5;
 
   function countByTitle(aClosedTabList, aTitle) {
     return aClosedTabList.filter(aData => aData.title == aTitle).length;
   }
 
   // open a window and add the above closed tab list
   let newWin = openDialog(location, "", "chrome,all,dialog=no");
-  promiseWindowLoaded(newWin).then(() => {
-    gPrefService.setIntPref("browser.sessionstore.max_tabs_undo",
-                            test_state.windows[0]._closedTabs.length);
-    ss.setWindowState(newWin, JSON.stringify(test_state), true);
+  yield promiseWindowLoaded(newWin);
+  gPrefService.setIntPref("browser.sessionstore.max_tabs_undo",
+                          test_state.windows[0]._closedTabs.length);
+  ss.setWindowState(newWin, JSON.stringify(test_state), true);
 
-    let closedTabs = JSON.parse(ss.getClosedTabData(newWin));
-    is(closedTabs.length, test_state.windows[0]._closedTabs.length,
-       "Closed tab list has the expected length");
-    is(countByTitle(closedTabs, FORGET),
-       test_state.windows[0]._closedTabs.length - remember_count,
-       "The correct amout of tabs are to be forgotten");
-    is(countByTitle(closedTabs, REMEMBER), remember_count,
-       "Everything is set up.");
+  let closedTabs = JSON.parse(ss.getClosedTabData(newWin));
+  is(closedTabs.length, test_state.windows[0]._closedTabs.length,
+     "Closed tab list has the expected length");
+  is(countByTitle(closedTabs, FORGET),
+     test_state.windows[0]._closedTabs.length - remember_count,
+     "The correct amout of tabs are to be forgotten");
+  is(countByTitle(closedTabs, REMEMBER), remember_count,
+     "Everything is set up.");
 
-    ForgetAboutSite.removeDataFromDomain("example.net");
-    waitForClearHistory(function() {
-        closedTabs = JSON.parse(ss.getClosedTabData(newWin));
-        is(closedTabs.length, remember_count,
-           "The correct amout of tabs was removed");
-        is(countByTitle(closedTabs, FORGET), 0,
-           "All tabs to be forgotten were indeed removed");
-        is(countByTitle(closedTabs, REMEMBER), remember_count,
-           "... and tabs to be remembered weren't.");
-
-        // clean up
-        gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
-        BrowserTestUtils.closeWindow(newWin).then(finish);
-    });
-  });
-}
+  yield ForgetAboutSite.removeDataFromDomain("example.net");
+  yield promiseClearHistory();
+  closedTabs = JSON.parse(ss.getClosedTabData(newWin));
+  is(closedTabs.length, remember_count,
+     "The correct amout of tabs was removed");
+  is(countByTitle(closedTabs, FORGET), 0,
+     "All tabs to be forgotten were indeed removed");
+  is(countByTitle(closedTabs, REMEMBER), remember_count,
+     "... and tabs to be remembered weren't.");
+  // clean up
+  gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
+  yield BrowserTestUtils.closeWindow(newWin);
+});
--- a/dom/indexedDB/test/browser_forgetThisSite.js
+++ b/dom/indexedDB/test/browser_forgetThisSite.js
@@ -58,19 +58,20 @@ function test2()
     });
   }, {capture: true, once: true});
   content.location = testPageURL2;
 }
 
 function test3()
 {
   // Remove database from domain 2
-  ForgetAboutSite.removeDataFromDomain(domains[1]);
-  setPermission(testPageURL4, "indexedDB");
-  executeSoon(test4);
+  ForgetAboutSite.removeDataFromDomain(domains[1]).then(() => {
+    setPermission(testPageURL4, "indexedDB");
+    executeSoon(test4);
+  });
 }
 
 function test4()
 {
   // Get database version for domain 1
   gBrowser.selectedTab = gBrowser.addTab();
   gBrowser.selectedBrowser.addEventListener("load", function () {
     setFinishedCallback(function(result, exception) {
--- a/toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js
+++ b/toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js
@@ -32,33 +32,30 @@ function stored(needles) {
 function setTestPluginEnabledState(newEnabledState, plugin) {
   var oldEnabledState = plugin.enabledState;
   plugin.enabledState = newEnabledState;
   SimpleTest.registerCleanupFunction(function() {
     plugin.enabledState = oldEnabledState;
   });
 }
 
-add_task(function* setup() {
+add_task(function* () {
   var tags = pluginHost.getPluginTags();
 
   // Find the test plugin
   for (var i = 0; i < tags.length; i++) {
     if (tags[i].name == "Test Plug-in") {
       pluginTag = tags[i];
     }
   }
   if (!pluginTag) {
     ok(false, "Test Plug-in not available, can't run test");
-    finish();
+    return;
   }
   setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, pluginTag);
-});
-
-add_task(function* () {
   yield BrowserTestUtils.openNewForegroundTab(gBrowser, testURL);
 
   // Set data for the plugin after the page load.
   yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
     content.wrappedJSObject.testSteps();
   });
 
   ok(stored(["192.168.1.1", "foo.com", "nonexistent.foo.com", "bar.com", "localhost"]),
@@ -80,10 +77,8 @@ add_task(function* () {
   ok(!stored(["192.168.1.1"]), "Data cleared for 192.168.1.1");
 
   // Clear data for "localhost".
   yield ForgetAboutSite.removeDataFromDomain("localhost");
   ok(!stored(null), "All data cleared");
 
   gBrowser.removeCurrentTab();
 });
-
-
--- a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
+++ b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
@@ -239,136 +239,136 @@ function preference_exists(aURI) {
 // Test Functions
 
 // History
 function* test_history_cleared_with_direct_match() {
   const TEST_URI = uri("http://mozilla.org/foo");
   do_check_false(yield promiseIsURIVisited(TEST_URI));
   yield PlacesTestUtils.addVisits(TEST_URI);
   do_check_true(yield promiseIsURIVisited(TEST_URI));
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
   do_check_false(yield promiseIsURIVisited(TEST_URI));
 }
 
 function* test_history_cleared_with_subdomain() {
   const TEST_URI = uri("http://www.mozilla.org/foo");
   do_check_false(yield promiseIsURIVisited(TEST_URI));
   yield PlacesTestUtils.addVisits(TEST_URI);
   do_check_true(yield promiseIsURIVisited(TEST_URI));
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
   do_check_false(yield promiseIsURIVisited(TEST_URI));
 }
 
 function* test_history_not_cleared_with_uri_contains_domain() {
   const TEST_URI = uri("http://ilovemozilla.org/foo");
   do_check_false(yield promiseIsURIVisited(TEST_URI));
   yield PlacesTestUtils.addVisits(TEST_URI);
   do_check_true(yield promiseIsURIVisited(TEST_URI));
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
   do_check_true(yield promiseIsURIVisited(TEST_URI));
 
   // Clear history since we left something there from this test.
   yield PlacesTestUtils.clearHistory();
 }
 
 // Cookie Service
-function test_cookie_cleared_with_direct_match() {
+function* test_cookie_cleared_with_direct_match() {
   const TEST_DOMAIN = "mozilla.org";
   add_cookie(TEST_DOMAIN);
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
   check_cookie_exists(TEST_DOMAIN, false);
 }
 
-function test_cookie_cleared_with_subdomain() {
+function* test_cookie_cleared_with_subdomain() {
   const TEST_DOMAIN = "www.mozilla.org";
   add_cookie(TEST_DOMAIN);
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
   check_cookie_exists(TEST_DOMAIN, false);
 }
 
-function test_cookie_not_cleared_with_uri_contains_domain() {
+function* test_cookie_not_cleared_with_uri_contains_domain() {
   const TEST_DOMAIN = "ilovemozilla.org";
   add_cookie(TEST_DOMAIN);
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
   check_cookie_exists(TEST_DOMAIN, true);
 }
 
 // Login Manager
-function test_login_manager_disabled_hosts_cleared_with_direct_match() {
+function* test_login_manager_disabled_hosts_cleared_with_direct_match() {
   const TEST_HOST = "http://mozilla.org";
   add_disabled_host(TEST_HOST);
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
   check_disabled_host(TEST_HOST, false);
 }
 
-function test_login_manager_disabled_hosts_cleared_with_subdomain() {
+function* test_login_manager_disabled_hosts_cleared_with_subdomain() {
   const TEST_HOST = "http://www.mozilla.org";
   add_disabled_host(TEST_HOST);
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
   check_disabled_host(TEST_HOST, false);
 }
 
-function test_login_manager_disabled_hosts_not_cleared_with_uri_contains_domain() {
+function* test_login_manager_disabled_hosts_not_cleared_with_uri_contains_domain() {
   const TEST_HOST = "http://ilovemozilla.org";
   add_disabled_host(TEST_HOST);
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
   check_disabled_host(TEST_HOST, true);
 
   // Reset state
   let lm = Cc["@mozilla.org/login-manager;1"].
            getService(Ci.nsILoginManager);
   lm.setLoginSavingEnabled(TEST_HOST, true);
   check_disabled_host(TEST_HOST, false);
 }
 
-function test_login_manager_logins_cleared_with_direct_match() {
+function* test_login_manager_logins_cleared_with_direct_match() {
   const TEST_HOST = "http://mozilla.org";
   add_login(TEST_HOST);
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
   check_login_exists(TEST_HOST, false);
 }
 
-function test_login_manager_logins_cleared_with_subdomain() {
+function* test_login_manager_logins_cleared_with_subdomain() {
   const TEST_HOST = "http://www.mozilla.org";
   add_login(TEST_HOST);
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
   check_login_exists(TEST_HOST, false);
 }
 
-function test_login_manager_logins_not_cleared_with_uri_contains_domain() {
+function* test_login_manager_logins_not_cleared_with_uri_contains_domain() {
   const TEST_HOST = "http://ilovemozilla.org";
   add_login(TEST_HOST);
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
   check_login_exists(TEST_HOST, true);
 
   let lm = Cc["@mozilla.org/login-manager;1"].
            getService(Ci.nsILoginManager);
   lm.removeAllLogins();
   check_login_exists(TEST_HOST, false);
 }
 
 // Permission Manager
-function test_permission_manager_cleared_with_direct_match() {
+function* test_permission_manager_cleared_with_direct_match() {
   const TEST_URI = uri("http://mozilla.org");
   add_permission(TEST_URI);
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
   check_permission_exists(TEST_URI, false);
 }
 
-function test_permission_manager_cleared_with_subdomain() {
+function* test_permission_manager_cleared_with_subdomain() {
   const TEST_URI = uri("http://www.mozilla.org");
   add_permission(TEST_URI);
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
   check_permission_exists(TEST_URI, false);
 }
 
-function test_permission_manager_not_cleared_with_uri_contains_domain() {
+function* test_permission_manager_not_cleared_with_uri_contains_domain() {
   const TEST_URI = uri("http://ilovemozilla.org");
   add_permission(TEST_URI);
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
   check_permission_exists(TEST_URI, true);
 
   // Reset state
   let pm = Cc["@mozilla.org/permissionmanager;1"].
            getService(Ci.nsIPermissionManager);
   pm.removeAll();
   check_permission_exists(TEST_URI, false);
 }
@@ -393,42 +393,42 @@ function waitForPurgeNotification() {
 }
 
 // Content Preferences
 function* test_content_preferences_cleared_with_direct_match() {
   const TEST_URI = uri("http://mozilla.org");
   do_check_false(yield preference_exists(TEST_URI));
   yield add_preference(TEST_URI);
   do_check_true(yield preference_exists(TEST_URI));
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
   yield waitForPurgeNotification();
   do_check_false(yield preference_exists(TEST_URI));
 }
 
 function* test_content_preferences_cleared_with_subdomain() {
   const TEST_URI = uri("http://www.mozilla.org");
   do_check_false(yield preference_exists(TEST_URI));
   yield add_preference(TEST_URI);
   do_check_true(yield preference_exists(TEST_URI));
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
   yield waitForPurgeNotification();
   do_check_false(yield preference_exists(TEST_URI));
 }
 
 function* test_content_preferences_not_cleared_with_uri_contains_domain() {
   const TEST_URI = uri("http://ilovemozilla.org");
   do_check_false(yield preference_exists(TEST_URI));
   yield add_preference(TEST_URI);
   do_check_true(yield preference_exists(TEST_URI));
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
   yield waitForPurgeNotification();
   do_check_true(yield preference_exists(TEST_URI));
 
   // Reset state
-  ForgetAboutSite.removeDataFromDomain("ilovemozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("ilovemozilla.org");
   yield waitForPurgeNotification();
   do_check_false(yield preference_exists(TEST_URI));
 }
 
 function push_registration_exists(aURL, ps) {
   return new Promise(resolve => {
     let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"]
                 .getService(Ci.nsIScriptSecurityManager);
@@ -497,17 +497,17 @@ function* test_push_cleared() {
 
     do_check_false(yield push_registration_exists(TEST_URL, ps));
   } finally {
     yield PushService._shutdownService();
   }
 }
 
 // Cache
-function test_cache_cleared() {
+function* test_cache_cleared() {
   // Because this test is asynchronous, it should be the last test
   do_check_true(tests[tests.length - 1] == arguments.callee);
 
   // NOTE: We could be more extensive with this test and actually add an entry
   //       to the cache, and then make sure it is gone.  However, we trust that
   //       the API is well tested, and that when we get the observer
   //       notification, we have actually cleared the cache.
   // This seems to happen asynchronously...
@@ -517,17 +517,17 @@ function test_cache_cleared() {
     observe(aSubject, aTopic, aData) {
       os.removeObserver(observer, "cacheservice:empty-cache");
       // Shutdown the download manager.
       Services.obs.notifyObservers(null, "quit-application", null);
       do_test_finished();
     }
   };
   os.addObserver(observer, "cacheservice:empty-cache", false);
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
   do_test_pending();
 }
 
 function* test_storage_cleared() {
   function getStorageForURI(aURI) {
     let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"]
               .getService(Ci.nsIScriptSecurityManager);
     let principal = ssm.createCodebasePrincipal(aURI, {});
@@ -546,17 +546,17 @@ function* test_storage_cleared() {
   for (let i = 0; i < s.length; ++i) {
     let storage = s[i];
     storage.setItem("test", "value" + i);
     do_check_eq(storage.length, 1);
     do_check_eq(storage.key(0), "test");
     do_check_eq(storage.getItem("test"), "value" + i);
   }
 
-  ForgetAboutSite.removeDataFromDomain("mozilla.org");
+  yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
   yield waitForPurgeNotification();
 
   do_check_eq(s[0].getItem("test"), null);
   do_check_eq(s[0].length, 0);
   do_check_eq(s[1].getItem("test"), null);
   do_check_eq(s[1].length, 0);
   do_check_eq(s[2].getItem("test"), "value2");
   do_check_eq(s[2].length, 1);