Bug 1536158 - Split browser_blockingServiceWorkers.js into two tests so that if we end up disabling part of it, we don't lose all of our test coverage; r=baku
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 19 Mar 2019 06:26:01 +0000
changeset 465115 846a7c768e4727e08b272a9d902acc555f123d51
parent 465114 16570d6848793f44fdccbc1744558cb4f4583990
child 465116 b7e589bb49e3b7719d6ebe1c109cb43d7ad7c48e
push id35732
push useropoprus@mozilla.com
push dateWed, 20 Mar 2019 10:52:37 +0000
treeherdermozilla-central@708979f9c3f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1536158
milestone68.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 1536158 - Split browser_blockingServiceWorkers.js into two tests so that if we end up disabling part of it, we don't lose all of our test coverage; r=baku Differential Revision: https://phabricator.services.mozilla.com/D23891
toolkit/components/antitracking/test/browser/browser.ini
toolkit/components/antitracking/test/browser/browser_blockingServiceWorkers.js
toolkit/components/antitracking/test/browser/browser_blockingServiceWorkersStorageAccessAPI.js
--- a/toolkit/components/antitracking/test/browser/browser.ini
+++ b/toolkit/components/antitracking/test/browser/browser.ini
@@ -37,16 +37,18 @@ skip-if = (os == "win" && os_version == 
 [browser_blockingIndexedDb.js]
 [browser_blockingIndexedDbInWorkers.js]
 [browser_blockingLocalStorage.js]
 skip-if = serviceworker_e10s
 [browser_blockingSessionStorage.js]
 skip-if = serviceworker_e10s
 [browser_blockingServiceWorkers.js]
 skip-if = (os == "win" && os_version == "6.1" && bits == 32 && !debug) # Bug 1491937
+[browser_blockingServiceWorkersStorageAccessAPI.js]
+skip-if = (os == "win" && os_version == "6.1" && bits == 32 && !debug) # Bug 1491937
 [browser_blockingSharedWorkers.js]
 skip-if = (os == "win" && os_version == "6.1" && bits == 32 && !debug) # Bug 1491937
 [browser_blockingMessaging.js]
 [browser_blockingNoOpener.js]
 [browser_doublyNestedTracker.js]
 [browser_existingCookiesForSubresources.js]
 [browser_firstPartyCookieRejectionHonoursAllowList.js]
 [browser_imageCache4.js]
--- a/toolkit/components/antitracking/test/browser/browser_blockingServiceWorkers.js
+++ b/toolkit/components/antitracking/test/browser/browser_blockingServiceWorkers.js
@@ -1,10 +1,8 @@
-requestLongerTimeout(2);
-
 AntiTracking.runTest("ServiceWorkers",
   async _ => {
     await navigator.serviceWorker.register("empty.js").then(
       _ => { ok(false, "ServiceWorker cannot be used!"); },
       _ => { ok(true, "ServiceWorker cannot be used!"); }).
       catch(e => ok(false, "Promise rejected: " + e));
   },
   null,
@@ -12,72 +10,8 @@ AntiTracking.runTest("ServiceWorkers",
     await new Promise(resolve => {
       Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
     });
   },
   [["dom.serviceWorkers.exemptFromPerDomainMax", true],
    ["dom.ipc.processCount", 1],
    ["dom.serviceWorkers.enabled", true],
    ["dom.serviceWorkers.testing.enabled", true]]);
-
-AntiTracking.runTest("ServiceWorkers and Storage Access API",
-  async _ => {
-    /* import-globals-from storageAccessAPIHelpers.js */
-    await noStorageAccessInitially();
-
-    await navigator.serviceWorker.register("empty.js").then(
-      _ => { ok(false, "ServiceWorker cannot be used!"); },
-      _ => { ok(true, "ServiceWorker cannot be used!"); }).
-      catch(e => ok(false, "Promise rejected: " + e));
-
-    /* import-globals-from storageAccessAPIHelpers.js */
-    await callRequestStorageAccess();
-
-    if (SpecialPowers.Services.prefs.getIntPref("network.cookie.cookieBehavior") == SpecialPowers.Ci.nsICookieService.BEHAVIOR_REJECT) {
-      await navigator.serviceWorker.register("empty.js").then(
-        _ => { ok(false, "ServiceWorker cannot be used!"); },
-        _ => { ok(true, "ServiceWorker cannot be used!"); }).
-        catch(e => ok(false, "Promise rejected: " + e));
-    } else {
-      await navigator.serviceWorker.register("empty.js").then(
-        reg => { ok(true, "ServiceWorker can be used!"); return reg; },
-        _ => { ok(false, "ServiceWorker cannot be used! " + _); }).then(
-        reg => reg.unregister(),
-        _ => { ok(false, "unregister failed"); }).
-        catch(e => ok(false, "Promise rejected: " + e));
-    }
-  },
-  async _ => {
-    /* import-globals-from storageAccessAPIHelpers.js */
-    if (allowListed) {
-      await hasStorageAccessInitially();
-    } else {
-      await noStorageAccessInitially();
-    }
-
-    await navigator.serviceWorker.register("empty.js").then(
-      reg => { ok(true, "ServiceWorker can be used!"); return reg; },
-      _ => { ok(false, "ServiceWorker cannot be used!"); }).then(
-      reg => reg.unregister(),
-      _ => { ok(false, "unregister failed"); }).
-      catch(e => ok(false, "Promise rejected: " + e));
-
-    /* import-globals-from storageAccessAPIHelpers.js */
-    await callRequestStorageAccess();
-
-    // For non-tracking windows, calling the API is a no-op
-    await navigator.serviceWorker.register("empty.js").then(
-      reg => { ok(true, "ServiceWorker can be used!"); return reg; },
-      _ => { ok(false, "ServiceWorker cannot be used!"); }).then(
-      reg => reg.unregister(),
-      _ => { ok(false, "unregister failed"); }).
-      catch(e => ok(false, "Promise rejected: " + e));
-  },
-  async _ => {
-    await new Promise(resolve => {
-      Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
-    });
-  },
-  [["dom.serviceWorkers.exemptFromPerDomainMax", true],
-   ["dom.ipc.processCount", 1],
-   ["dom.serviceWorkers.enabled", true],
-   ["dom.serviceWorkers.testing.enabled", true]],
-  false, false);
copy from toolkit/components/antitracking/test/browser/browser_blockingServiceWorkers.js
copy to toolkit/components/antitracking/test/browser/browser_blockingServiceWorkersStorageAccessAPI.js
--- a/toolkit/components/antitracking/test/browser/browser_blockingServiceWorkers.js
+++ b/toolkit/components/antitracking/test/browser/browser_blockingServiceWorkersStorageAccessAPI.js
@@ -1,28 +1,10 @@
 requestLongerTimeout(2);
 
-AntiTracking.runTest("ServiceWorkers",
-  async _ => {
-    await navigator.serviceWorker.register("empty.js").then(
-      _ => { ok(false, "ServiceWorker cannot be used!"); },
-      _ => { ok(true, "ServiceWorker cannot be used!"); }).
-      catch(e => ok(false, "Promise rejected: " + e));
-  },
-  null,
-  async _ => {
-    await new Promise(resolve => {
-      Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
-    });
-  },
-  [["dom.serviceWorkers.exemptFromPerDomainMax", true],
-   ["dom.ipc.processCount", 1],
-   ["dom.serviceWorkers.enabled", true],
-   ["dom.serviceWorkers.testing.enabled", true]]);
-
 AntiTracking.runTest("ServiceWorkers and Storage Access API",
   async _ => {
     /* import-globals-from storageAccessAPIHelpers.js */
     await noStorageAccessInitially();
 
     await navigator.serviceWorker.register("empty.js").then(
       _ => { ok(false, "ServiceWorker cannot be used!"); },
       _ => { ok(true, "ServiceWorker cannot be used!"); }).