Backed out changeset dd551956b332 (bug 1546296) for bc failures at browser_serviceworkers.js. CLOSED TREE
authorBrindusan Cristian <cbrindusan@mozilla.com>
Fri, 10 May 2019 00:38:56 +0300
changeset 532125 f06c7f8ed1f1ccdb87f35fd24e6bb53df5165c6e
parent 532124 e4eab914f8217b7eb04a311ad6f33bd4c7aca2ab
child 532126 b35cf8000e7a708377696f3859ae6bfa0fa8f554
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1546296
milestone68.0a1
backs outdd551956b3329ccf67cd8d6f279b93f04f79eeab
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
Backed out changeset dd551956b332 (bug 1546296) for bc failures at browser_serviceworkers.js. CLOSED TREE
toolkit/components/cleardata/ClearDataService.jsm
toolkit/components/cleardata/SiteDataTestUtils.jsm
toolkit/components/cleardata/moz.build
toolkit/components/cleardata/tests/browser/browser.ini
toolkit/components/cleardata/tests/browser/browser_serviceworkers.js
toolkit/components/cleardata/tests/browser/worker.js
--- a/toolkit/components/cleardata/ClearDataService.jsm
+++ b/toolkit/components/cleardata/ClearDataService.jsm
@@ -357,20 +357,23 @@ const QuotaCleaner = {
     // localStorage: The legacy LocalStorage implementation that will
     // eventually be removed depends on this observer notification to clear by
     // host.  Some other subsystems like Reporting headers depend on this too.
     Services.obs.notifyObservers(null, "extension:purge-localStorage", aHost);
 
     // Clear sessionStorage
     Services.obs.notifyObservers(null, "browser:purge-sessionStorage", aHost);
 
+    let exceptionThrown = false;
+
     // ServiceWorkers: they must be removed before cleaning QuotaManager.
-    return ServiceWorkerCleanUp.removeFromHost(aHost)
-      .then(_ => /* exceptionThrown = */ false, _ => /* exceptionThrown = */ true)
-      .then(exceptionThrown => {
+    return Promise.all([
+      ServiceWorkerCleanUp.removeFromHost("http://" + aHost).catch(_ => { exceptionThrown = true; }),
+      ServiceWorkerCleanUp.removeFromHost("https://" + aHost).catch(_ => { exceptionThrown = true; }),
+    ]).then(() => {
         // QuotaManager: In the event of a failure, we call reject to propagate
         // the error upwards.
 
         // delete data from both HTTP and HTTPS sites
         let httpURI = Services.io.newURI("http://" + aHost);
         let httpsURI = Services.io.newURI("https://" + aHost);
         let httpPrincipal = Services.scriptSecurityManager
                                      .createCodebasePrincipal(httpURI, aOriginAttributes);
--- a/toolkit/components/cleardata/SiteDataTestUtils.jsm
+++ b/toolkit/components/cleardata/SiteDataTestUtils.jsm
@@ -97,17 +97,17 @@ var SiteDataTestUtils = {
   addServiceWorker(path) {
     let uri = Services.io.newURI(path);
     // Register a dummy ServiceWorker.
     return BrowserTestUtils.withNewTab(uri.prePath, async function(browser) {
       return ContentTask.spawn(browser, {path}, async ({path: p}) => {
         // eslint-disable-next-line no-undef
         let r = await content.navigator.serviceWorker.register(p);
         return new Promise(resolve => {
-          let worker = r.installing || r.waiting || r.active;
+          let worker = r.installing;
           worker.addEventListener("statechange", () => {
             if (worker.state === "installed") {
               resolve();
             }
           });
         });
       });
     });
--- a/toolkit/components/cleardata/moz.build
+++ b/toolkit/components/cleardata/moz.build
@@ -20,16 +20,14 @@ EXTRA_JS_MODULES += [
 ]
 
 XPCOM_MANIFESTS += [
     'components.conf',
 ]
 
 XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
 
-BROWSER_CHROME_MANIFESTS += ['tests/browser/browser.ini']
-
 include('/ipc/chromium/chromium-config.mozbuild')
 
 with Files('**'):
     BUG_COMPONENT = ('Toolkit', 'Data Sanitization')
 
 FINAL_LIBRARY = 'xul'
deleted file mode 100644
--- a/toolkit/components/cleardata/tests/browser/browser.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[browser_serviceworkers.js]
-support-files = worker.js
deleted file mode 100644
--- a/toolkit/components/cleardata/tests/browser/browser_serviceworkers.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-const {SiteDataTestUtils} = ChromeUtils.import("resource://testing-common/SiteDataTestUtils.jsm");
-
-function addServiceWorker(origin) {
-  let swURL = getRootDirectory(gTestPath).replace("chrome://mochitests/content", origin) + "worker.js";
-  return SiteDataTestUtils.addServiceWorker(swURL);
-}
-
-add_task(async function test_deleteFromHost() {
-  await addServiceWorker("https://example.com");
-  await addServiceWorker("https://example.org");
-
-  await TestUtils.waitForCondition(() => SiteDataTestUtils.hasServiceWorkers("https://example.com"), "example.com has a service worker");
-  ok(true, "example.com has a service worker");
-
-  await TestUtils.waitForCondition(() => SiteDataTestUtils.hasServiceWorkers("https://example.org"), "example.org has a service worker");
-  ok(true, "example.org has a service worker");
-
-  await new Promise(aResolve => {
-    Services.clearData.deleteDataFromHost("example.com", true, Ci.nsIClearDataService.CLEAR_DOM_QUOTA, value => {
-      Assert.equal(value, 0);
-      aResolve();
-    });
-  });
-
-  ok(!SiteDataTestUtils.hasServiceWorkers("https://example.com"), "example.com has no service worker");
-  ok(SiteDataTestUtils.hasServiceWorkers("https://example.org"), "example.org has a service worker");
-
-  await new Promise(aResolve => {
-    Services.clearData.deleteDataFromHost("example.org", true, Ci.nsIClearDataService.CLEAR_DOM_QUOTA, value => {
-      Assert.equal(value, 0);
-      aResolve();
-    });
-  });
-
-  ok(!SiteDataTestUtils.hasServiceWorkers("https://example.org"), "example.org has no service worker");
-});
-
-add_task(async function test_deleteFromPrincipal() {
-  await addServiceWorker("https://example.com");
-  await addServiceWorker("https://example.org");
-
-  await TestUtils.waitForCondition(() => SiteDataTestUtils.hasServiceWorkers("https://example.com"), "example.com has a service worker");
-  ok(true, "example.com has a service worker");
-
-  await TestUtils.waitForCondition(() => SiteDataTestUtils.hasServiceWorkers("https://example.org"), "example.org has a service worker");
-  ok(true, "example.org has a service worker");
-
-  let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin("https://example.com/");
-  await new Promise(aResolve => {
-    Services.clearData.deleteDataFromPrincipal(principal, true, Ci.nsIClearDataService.CLEAR_DOM_QUOTA, value => {
-      Assert.equal(value, 0);
-      aResolve();
-    });
-  });
-
-  ok(!SiteDataTestUtils.hasServiceWorkers("https://example.com"), "example.com has no service worker");
-  ok(SiteDataTestUtils.hasServiceWorkers("https://example.org"), "example.org has a service worker");
-
-  principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin("https://example.org/");
-  await new Promise(aResolve => {
-    Services.clearData.deleteDataFromPrincipal(principal, true, Ci.nsIClearDataService.CLEAR_DOM_QUOTA, value => {
-      Assert.equal(value, 0);
-      aResolve();
-    });
-  });
-
-  ok(!SiteDataTestUtils.hasServiceWorkers("https://example.org"), "example.org has no service worker");
-});
-
-add_task(async function test_deleteAll() {
-  await addServiceWorker("https://example.com");
-  await addServiceWorker("https://example.org");
-
-  await TestUtils.waitForCondition(() => SiteDataTestUtils.hasServiceWorkers("https://example.com"), "example.com has a service worker");
-  ok(true, "example.com has a service worker");
-
-  await TestUtils.waitForCondition(() => SiteDataTestUtils.hasServiceWorkers("https://example.org"), "example.org has a service worker");
-  ok(true, "example.org has a service worker");
-
-  await new Promise(aResolve => {
-    Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_DOM_QUOTA, value => {
-      Assert.equal(value, 0);
-      aResolve();
-    });
-  });
-
-  ok(!SiteDataTestUtils.hasServiceWorkers("https://example.com"), "example.com has no service worker");
-  ok(!SiteDataTestUtils.hasServiceWorkers("https://example.org"), "example.org has no service worker");
-
-  await SiteDataTestUtils.clear();
-});
deleted file mode 100644
--- a/toolkit/components/cleardata/tests/browser/worker.js
+++ /dev/null
@@ -1,1 +0,0 @@
-console.log("hello");