Backed out 2 changesets (bug 1410416) for linting failures in browser/components/preferences/in-content/tests/browser_siteData.js. r=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Thu, 02 Nov 2017 21:30:24 +0100
changeset 443179 6c869780c87ec220a3530de3ae9bb06e340b7151
parent 443178 f532ca793b6071b1ff6b8f47ba8ba150221a3fa7
child 443180 6f7cae36d92d36304c05df539135de6e913ab45c
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1410416
milestone58.0a1
backs outb0d6deea2bca0a798a2966630f7cfc25e494507c
c2d97da8bfedf7396aa3683153164accb580aaf9
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 2 changesets (bug 1410416) for linting failures in browser/components/preferences/in-content/tests/browser_siteData.js. r=backout Backed out changeset b0d6deea2bca (bug 1410416) Backed out changeset c2d97da8bfed (bug 1410416)
browser/components/preferences/SiteDataManager.jsm
browser/components/preferences/in-content/tests/browser.ini
browser/components/preferences/in-content/tests/browser_siteData.js
browser/components/preferences/in-content/tests/browser_siteData3.js
browser/components/preferences/in-content/tests/head.js
browser/components/preferences/in-content/tests/service_worker_test.html
browser/components/preferences/in-content/tests/service_worker_test.js
--- a/browser/components/preferences/SiteDataManager.jsm
+++ b/browser/components/preferences/SiteDataManager.jsm
@@ -1,11 +1,11 @@
 "use strict";
 
-const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
+const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "OfflineAppCacheHelper",
                                   "resource:///modules/offlineAppCache.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "ContextualIdentityService",
                                   "resource://gre/modules/ContextualIdentityService.jsm");
@@ -44,49 +44,47 @@ this.SiteDataManager = {
   },
 
   _getQuotaUsage() {
     // Clear old data and requests first
     this._sites.clear();
     this._cancelGetQuotaUsage();
     this._getQuotaUsagePromise = new Promise(resolve => {
       let onUsageResult = request => {
-        if (request.resultCode == Cr.NS_OK) {
-          let items = request.result;
-          for (let item of items) {
-            if (!item.persisted && item.usage <= 0) {
-              // An non-persistent-storage site with 0 byte quota usage is redundant for us so skip it.
-              continue;
+        let items = request.result;
+        for (let item of items) {
+          if (!item.persisted && item.usage <= 0) {
+            // An non-persistent-storage site with 0 byte quota usage is redundant for us so skip it.
+            continue;
+          }
+          let principal =
+            Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(item.origin);
+          let uri = principal.URI;
+          if (uri.scheme == "http" || uri.scheme == "https") {
+            let site = this._sites.get(uri.host);
+            if (!site) {
+              site = {
+                persisted: false,
+                quotaUsage: 0,
+                principals: [],
+                appCacheList: [],
+              };
             }
-            let principal =
-              Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(item.origin);
-            let uri = principal.URI;
-            if (uri.scheme == "http" || uri.scheme == "https") {
-              let site = this._sites.get(uri.host);
-              if (!site) {
-                site = {
-                  persisted: false,
-                  quotaUsage: 0,
-                  principals: [],
-                  appCacheList: [],
-                };
-              }
-              // Assume 3 sites:
-              //   - Site A (not persisted): https://www.foo.com
-              //   - Site B (not persisted): https://www.foo.com^userContextId=2
-              //   - Site C (persisted):     https://www.foo.com:1234
-              // Although only C is persisted, grouping by host, as a result,
-              // we still mark as persisted here under this host group.
-              if (item.persisted) {
-                site.persisted = true;
-              }
-              site.principals.push(principal);
-              site.quotaUsage += item.usage;
-              this._sites.set(uri.host, site);
+            // Assume 3 sites:
+            //   - Site A (not persisted): https://www.foo.com
+            //   - Site B (not persisted): https://www.foo.com^userContextId=2
+            //   - Site C (persisted):     https://www.foo.com:1234
+            // Although only C is persisted, grouping by host, as a result,
+            // we still mark as persisted here under this host group.
+            if (item.persisted) {
+              site.persisted = true;
             }
+            site.principals.push(principal);
+            site.quotaUsage += item.usage;
+            this._sites.set(uri.host, site);
           }
         }
         resolve();
       };
       // XXX: The work of integrating localStorage into Quota Manager is in progress.
       //      After the bug 742822 and 1286798 landed, localStorage usage will be included.
       //      So currently only get indexedDB usage.
       this._quotaUsageRequest = this._qms.getUsage(onUsageResult);
@@ -219,96 +217,78 @@ this.SiteDataManager = {
             cookie.host, cookie.name, cookie.path, false, cookie.originAttributes);
         }
       }
 
       Services.obs.notifyObservers(null, "browser:purge-domain-data", principal.URI.host);
     }
   },
 
-  _unregisterServiceWorker(serviceWorker) {
-    return new Promise(resolve => {
-      let unregisterCallback = {
-        unregisterSucceeded: resolve,
-        unregisterFailed: resolve, // We don't care about failures.
-        QueryInterface: XPCOMUtils.generateQI([Ci.nsIServiceWorkerUnregisterCallback])
-      };
-      serviceWorkerManager.propagateUnregister(serviceWorker.principal, unregisterCallback, serviceWorker.scope);
-    });
-  },
-
-  _removeServiceWorkersForSites(sites) {
-    let promises = [];
-    let targetHosts = sites.map(s => s.principals[0].URI.host);
+  _removeServiceWorkers(site) {
     let serviceWorkers = serviceWorkerManager.getAllRegistrations();
     for (let i = 0; i < serviceWorkers.length; i++) {
       let sw = serviceWorkers.queryElementAt(i, Ci.nsIServiceWorkerRegistrationInfo);
-      // Sites are grouped and removed by host so we unregister service workers by the same host as well
-      if (targetHosts.includes(sw.principal.URI.host)) {
-        promises.push(this._unregisterServiceWorker(sw));
+      for (let principal of site.principals) {
+        if (sw.principal.equals(principal)) {
+          serviceWorkerManager.removeAndPropagate(sw.principal.URI.host);
+          break;
+        }
       }
     }
-    return Promise.all(promises);
   },
 
   remove(hosts) {
+    let promises = [];
     let unknownHost = "";
-    let targetSites = [];
     for (let host of hosts) {
       let site = this._sites.get(host);
       if (site) {
         this._removePermission(site);
         this._removeAppCache(site);
         this._removeCookie(site);
-        targetSites.push(site);
+        this._removeServiceWorkers(site);
+        promises.push(this._removeQuotaUsage(site));
       } else {
         unknownHost = host;
         break;
       }
     }
-
-    if (targetSites.length > 0) {
-      this._removeServiceWorkersForSites(targetSites)
-          .then(() => {
-            let promises = targetSites.map(s => this._removeQuotaUsage(s));
-            return Promise.all(promises);
-          })
-          .then(() => this.updateSites());
+    if (promises.length > 0) {
+      Promise.all(promises).then(() => this.updateSites());
     }
     if (unknownHost) {
       throw `SiteDataManager: removing unknown site of ${unknownHost}`;
     }
   },
 
   async removeAll() {
     Services.cache2.clear();
     Services.cookies.removeAll();
     OfflineAppCacheHelper.clear();
 
     // Iterate through the service workers and remove them.
-    let promises = [];
     let serviceWorkers = serviceWorkerManager.getAllRegistrations();
     for (let i = 0; i < serviceWorkers.length; i++) {
       let sw = serviceWorkers.queryElementAt(i, Ci.nsIServiceWorkerRegistrationInfo);
-      promises.push(this._unregisterServiceWorker(sw));
+      let host = sw.principal.URI.host;
+      serviceWorkerManager.removeAndPropagate(host);
     }
-    await Promise.all(promises);
 
     // Refresh sites using quota usage again.
     // This is for the case:
     //   1. User goes to the about:preferences Site Data section.
     //   2. With the about:preferences opened, user visits another website.
     //   3. The website saves to quota usage, like indexedDB.
     //   4. User goes back to the Site Data section and commands to clear all site data.
     // For this case, we should refresh the site list so not to miss the website in the step 3.
     // We don't do "Clear All" on the quota manager like the cookie, appcache, http cache above
     // because that would clear browser data as well too,
     // see https://bugzilla.mozilla.org/show_bug.cgi?id=1312361#c9
     await this._getQuotaUsage();
-    promises = [];
+    let promises = [];
     for (let site of this._sites.values()) {
       this._removePermission(site);
       promises.push(this._removeQuotaUsage(site));
     }
     return Promise.all(promises).then(() => this.updateSites());
   },
 
   isPrivateCookie(cookie) {
--- a/browser/components/preferences/in-content/tests/browser.ini
+++ b/browser/components/preferences/in-content/tests/browser.ini
@@ -1,15 +1,13 @@
 [DEFAULT]
 support-files =
   head.js
   privacypane_tests_perwindow.js
   site_data_test.html
-  service_worker_test.html
-  service_worker_test.js
   addons/set_homepage.xpi
   addons/set_newtab.xpi
   offline/offline.html
   offline/manifest.appcache
 
 [browser_applications_selection.js]
 skip-if = os == 'linux' # bug 1382057
 [browser_advanced_update.js]
--- a/browser/components/preferences/in-content/tests/browser_siteData.js
+++ b/browser/components/preferences/in-content/tests/browser_siteData.js
@@ -10,26 +10,23 @@ Cu.import("resource://gre/modules/XPCOMU
 Services.scriptloader.loadSubScript("resource://testing-common/sinon-2.3.2.js");
 
 const TEST_QUOTA_USAGE_HOST = "example.com";
 const TEST_QUOTA_USAGE_ORIGIN = "https://" + TEST_QUOTA_USAGE_HOST;
 const TEST_QUOTA_USAGE_URL = TEST_QUOTA_USAGE_ORIGIN + "/browser/browser/components/preferences/in-content/tests/site_data_test.html";
 const TEST_OFFLINE_HOST = "example.org";
 const TEST_OFFLINE_ORIGIN = "https://" + TEST_OFFLINE_HOST;
 const TEST_OFFLINE_URL = TEST_OFFLINE_ORIGIN + "/browser/browser/components/preferences/in-content/tests/offline/offline.html";
-const TEST_SERVICE_WORKER_URL = TEST_OFFLINE_ORIGIN + "/browser/browser/components/preferences/in-content/tests/service_worker_test.html";
 const REMOVE_DIALOG_URL = "chrome://browser/content/preferences/siteDataRemoveSelected.xul";
 
 const { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {});
 const { DownloadUtils } = Cu.import("resource://gre/modules/DownloadUtils.jsm", {});
 const { SiteDataManager } = Cu.import("resource:///modules/SiteDataManager.jsm", {});
 const { OfflineAppCacheHelper } = Cu.import("resource:///modules/offlineAppCache.jsm", {});
 
-XPCOMUtils.defineLazyServiceGetter(this, "serviceWorkerManager", "@mozilla.org/serviceworkers/manager;1", "nsIServiceWorkerManager");
-
 const mockOfflineAppCacheHelper = {
   clear: null,
 
   originalClear: null,
 
   register() {
     this.originalClear = OfflineAppCacheHelper.clear;
     this.clear = sinon.spy();
@@ -85,41 +82,16 @@ const cacheUsageGetter = {
 };
 
 function promiseCookiesCleared() {
   return TestUtils.topicObserved("cookie-changed", (subj, data) => {
     return data === "cleared";
   });
 }
 
-function promiseServiceWorkerRegisteredFor(url) {
-  return BrowserTestUtils.waitForCondition(() => {
-    try {
-      let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(url);
-      let sw = serviceWorkerManager.getRegistrationByPrincipal(principal, principal.URI.spec);
-      if (sw) {
-        ok(true, `Found the service worker registered for ${url}`);
-        return true;
-      }
-    } catch (e) {}
-    return false;
-  }, `Should register service worker for ${url}`);
-}
-
-function promiseServiceWorkersCleared() {
-  return BrowserTestUtils.waitForCondition(() => {
-    let serviceWorkers = serviceWorkerManager.getAllRegistrations();
-    if (serviceWorkers.length == 0) {
-      ok(true, "Cleared all service workers");
-      return true;
-    }
-    return false;
-  }, "Should clear all service workers");
-}
-
 registerCleanupFunction(function() {
   delete window.sinon;
   mockOfflineAppCacheHelper.unregister();
 });
 
 // Test listing site using quota usage or site using appcache
 add_task(async function() {
   await SpecialPowers.pushPrefEnv({set: [["browser.storageManager.enabled", true]]});
@@ -273,62 +245,125 @@ add_task(async function() {
   is(cacheUsage, 0, "The cache usage should be removed");
   is(quotaUsage, 0, "The quota usage should be removed");
   is(totalUsage, 0, "The total usage should be removed");
   // Test accepting "Clear All Data" ends
 
   await BrowserTestUtils.removeTab(gBrowser.selectedTab);
 });
 
-// Test clearing service wroker through the "Clear All" button
-add_task(async function() {
-  await SpecialPowers.pushPrefEnv({set: [["browser.storageManager.enabled", true]]});
-  // Register a test service worker
-  await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_SERVICE_WORKER_URL);
-  await waitForEvent(gBrowser.selectedBrowser.contentWindow, "service_worker_test_loaded");
-  await BrowserTestUtils.removeTab(gBrowser.selectedTab);
-  await openPreferencesViaOpenPreferencesAPI("privacy", { leaveOpen: true });
-  // Test the initial states
-  await promiseServiceWorkerRegisteredFor(TEST_SERVICE_WORKER_URL);
-  // Click the "Clear All" button
-  let doc = gBrowser.selectedBrowser.contentDocument;
-  let clearBtn = doc.getElementById("clearSiteDataButton");
-  let acceptPromise = promiseAlertDialogOpen("accept");
-  let updatePromise = promiseSiteDataManagerSitesUpdated();
-  clearBtn.doCommand();
-  await acceptPromise;
-  await updatePromise;
-  await promiseServiceWorkersCleared();
-  await BrowserTestUtils.removeTab(gBrowser.selectedTab);
-});
-
-// Test clearing service wroker through the settings panel
+// Test sorting
 add_task(async function() {
   await SpecialPowers.pushPrefEnv({set: [["browser.storageManager.enabled", true]]});
-  // Register a test service worker
-  await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_SERVICE_WORKER_URL);
-  await waitForEvent(gBrowser.selectedBrowser.contentWindow, "service_worker_test_loaded");
-  await BrowserTestUtils.removeTab(gBrowser.selectedTab);
+  mockSiteDataManager.register(SiteDataManager);
+  mockSiteDataManager.fakeSites = [
+    {
+      usage: 1024,
+      principal: Services.scriptSecurityManager
+                         .createCodebasePrincipalFromOrigin("https://account.xyz.com"),
+      persisted: true
+    },
+    {
+      usage: 1024 * 2,
+      principal: Services.scriptSecurityManager
+                         .createCodebasePrincipalFromOrigin("https://books.foo.com"),
+      persisted: false
+    },
+    {
+      usage: 1024 * 3,
+      principal: Services.scriptSecurityManager
+                         .createCodebasePrincipalFromOrigin("http://cinema.bar.com"),
+      persisted: true
+    },
+  ];
+
+  let updatePromise = promiseSiteDataManagerSitesUpdated();
   await openPreferencesViaOpenPreferencesAPI("privacy", { leaveOpen: true });
-  // Test the initial states
-  await promiseServiceWorkerRegisteredFor(TEST_SERVICE_WORKER_URL);
-  // Open the Site Data Settings panel and remove the site
+  await updatePromise;
   await openSiteDataSettingsDialog();
-  let win = gBrowser.selectedBrowser.contentWindow;
-  let frameDoc = win.gSubDialog._topDialog._frame.contentDocument;
+
+  let dialog = content.gSubDialog._topDialog;
+  let dialogFrame = dialog._frame;
+  let frameDoc = dialogFrame.contentDocument;
+  let hostCol = frameDoc.getElementById("hostCol");
+  let usageCol = frameDoc.getElementById("usageCol");
+  let statusCol = frameDoc.getElementById("statusCol");
   let sitesList = frameDoc.getElementById("sitesList");
-  let site = sitesList.querySelector(`richlistitem[host="${TEST_OFFLINE_HOST}"]`);
-  if (site) {
-    let acceptRemovePromise = promiseAlertDialogOpen("accept");
-    let updatePromise = promiseSiteDataManagerSitesUpdated();
-    let removeBtn = frameDoc.getElementById("removeSelected");
-    let saveBtn = frameDoc.getElementById("save");
-    site.click();
-    removeBtn.doCommand();
-    saveBtn.doCommand();
-    await acceptRemovePromise;
-    await updatePromise;
-  } else {
-    ok(false, `Should have one site of ${TEST_OFFLINE_HOST}`);
+
+  // Test default sorting
+  assertSortByUsage("descending");
+
+  // Test sorting on the usage column
+  usageCol.click();
+  assertSortByUsage("ascending");
+  usageCol.click();
+  assertSortByUsage("descending");
+
+  // Test sorting on the host column
+  hostCol.click();
+  assertSortByHost("ascending");
+  hostCol.click();
+  assertSortByHost("descending");
+
+  // Test sorting on the permission status column
+  statusCol.click();
+  assertSortByStatus("ascending");
+  statusCol.click();
+  assertSortByStatus("descending");
+
+  mockSiteDataManager.unregister();
+  await BrowserTestUtils.removeTab(gBrowser.selectedTab);
+
+  function assertSortByHost(order) {
+    let siteItems = sitesList.getElementsByTagName("richlistitem");
+    for (let i = 0; i < siteItems.length - 1; ++i) {
+      let aHost = siteItems[i].getAttribute("host");
+      let bHost = siteItems[i + 1].getAttribute("host");
+      let result = aHost.localeCompare(bHost);
+      if (order == "ascending") {
+        Assert.lessOrEqual(result, 0, "Should sort sites in the ascending order by host");
+      } else {
+        Assert.greaterOrEqual(result, 0, "Should sort sites in the descending order by host");
+      }
+    }
   }
-  await promiseServiceWorkersCleared();
-  await BrowserTestUtils.removeTab(gBrowser.selectedTab);
+
+  function assertSortByStatus(order) {
+    let siteItems = sitesList.getElementsByTagName("richlistitem");
+    for (let i = 0; i < siteItems.length - 1; ++i) {
+      let aHost = siteItems[i].getAttribute("host");
+      let bHost = siteItems[i + 1].getAttribute("host");
+      let a = findSiteByHost(aHost);
+      let b = findSiteByHost(bHost);
+      let result = 0;
+      if (a.persisted && !b.persisted) {
+        result = 1;
+      } else if (!a.persisted && b.persisted) {
+        result = -1;
+      }
+      if (order == "ascending") {
+        Assert.lessOrEqual(result, 0, "Should sort sites in the ascending order by permission status");
+      } else {
+        Assert.greaterOrEqual(result, 0, "Should sort sites in the descending order by permission status");
+      }
+    }
+  }
+
+  function assertSortByUsage(order) {
+    let siteItems = sitesList.getElementsByTagName("richlistitem");
+    for (let i = 0; i < siteItems.length - 1; ++i) {
+      let aHost = siteItems[i].getAttribute("host");
+      let bHost = siteItems[i + 1].getAttribute("host");
+      let a = findSiteByHost(aHost);
+      let b = findSiteByHost(bHost);
+      let result = a.usage - b.usage;
+      if (order == "ascending") {
+        Assert.lessOrEqual(result, 0, "Should sort sites in the ascending order by usage");
+      } else {
+        Assert.greaterOrEqual(result, 0, "Should sort sites in the descending order by usage");
+      }
+    }
+  }
+
+  function findSiteByHost(host) {
+    return mockSiteDataManager.fakeSites.find(site => site.principal.URI.host == host);
+  }
 });
--- a/browser/components/preferences/in-content/tests/browser_siteData3.js
+++ b/browser/components/preferences/in-content/tests/browser_siteData3.js
@@ -101,126 +101,8 @@ add_task(async function() {
 
   expected = prefStrBundle.getString("persistent");
   let status = siteItems[0].getAttribute("status");
   is(status, expected, "Should mark persisted status across scheme, port and origin attributes");
 
   mockSiteDataManager.unregister();
   await BrowserTestUtils.removeTab(gBrowser.selectedTab);
 });
-
-// Test sorting
-add_task(async function() {
-  await SpecialPowers.pushPrefEnv({set: [["browser.storageManager.enabled", true]]});
-  mockSiteDataManager.register(SiteDataManager);
-  mockSiteDataManager.fakeSites = [
-    {
-      usage: 1024,
-      principal: Services.scriptSecurityManager
-                         .createCodebasePrincipalFromOrigin("https://account.xyz.com"),
-      persisted: true
-    },
-    {
-      usage: 1024 * 2,
-      principal: Services.scriptSecurityManager
-                         .createCodebasePrincipalFromOrigin("https://books.foo.com"),
-      persisted: false
-    },
-    {
-      usage: 1024 * 3,
-      principal: Services.scriptSecurityManager
-                         .createCodebasePrincipalFromOrigin("http://cinema.bar.com"),
-      persisted: true
-    },
-  ];
-
-  let updatePromise = promiseSiteDataManagerSitesUpdated();
-  await openPreferencesViaOpenPreferencesAPI("privacy", { leaveOpen: true });
-  await updatePromise;
-  await openSiteDataSettingsDialog();
-
-  let dialog = content.gSubDialog._topDialog;
-  let dialogFrame = dialog._frame;
-  let frameDoc = dialogFrame.contentDocument;
-  let hostCol = frameDoc.getElementById("hostCol");
-  let usageCol = frameDoc.getElementById("usageCol");
-  let statusCol = frameDoc.getElementById("statusCol");
-  let sitesList = frameDoc.getElementById("sitesList");
-
-  // Test default sorting
-  assertSortByUsage("descending");
-
-  // Test sorting on the usage column
-  usageCol.click();
-  assertSortByUsage("ascending");
-  usageCol.click();
-  assertSortByUsage("descending");
-
-  // Test sorting on the host column
-  hostCol.click();
-  assertSortByHost("ascending");
-  hostCol.click();
-  assertSortByHost("descending");
-
-  // Test sorting on the permission status column
-  statusCol.click();
-  assertSortByStatus("ascending");
-  statusCol.click();
-  assertSortByStatus("descending");
-
-  mockSiteDataManager.unregister();
-  await BrowserTestUtils.removeTab(gBrowser.selectedTab);
-
-  function assertSortByHost(order) {
-    let siteItems = sitesList.getElementsByTagName("richlistitem");
-    for (let i = 0; i < siteItems.length - 1; ++i) {
-      let aHost = siteItems[i].getAttribute("host");
-      let bHost = siteItems[i + 1].getAttribute("host");
-      let result = aHost.localeCompare(bHost);
-      if (order == "ascending") {
-        Assert.lessOrEqual(result, 0, "Should sort sites in the ascending order by host");
-      } else {
-        Assert.greaterOrEqual(result, 0, "Should sort sites in the descending order by host");
-      }
-    }
-  }
-
-  function assertSortByStatus(order) {
-    let siteItems = sitesList.getElementsByTagName("richlistitem");
-    for (let i = 0; i < siteItems.length - 1; ++i) {
-      let aHost = siteItems[i].getAttribute("host");
-      let bHost = siteItems[i + 1].getAttribute("host");
-      let a = findSiteByHost(aHost);
-      let b = findSiteByHost(bHost);
-      let result = 0;
-      if (a.persisted && !b.persisted) {
-        result = 1;
-      } else if (!a.persisted && b.persisted) {
-        result = -1;
-      }
-      if (order == "ascending") {
-        Assert.lessOrEqual(result, 0, "Should sort sites in the ascending order by permission status");
-      } else {
-        Assert.greaterOrEqual(result, 0, "Should sort sites in the descending order by permission status");
-      }
-    }
-  }
-
-  function assertSortByUsage(order) {
-    let siteItems = sitesList.getElementsByTagName("richlistitem");
-    for (let i = 0; i < siteItems.length - 1; ++i) {
-      let aHost = siteItems[i].getAttribute("host");
-      let bHost = siteItems[i + 1].getAttribute("host");
-      let a = findSiteByHost(aHost);
-      let b = findSiteByHost(bHost);
-      let result = a.usage - b.usage;
-      if (order == "ascending") {
-        Assert.lessOrEqual(result, 0, "Should sort sites in the ascending order by usage");
-      } else {
-        Assert.greaterOrEqual(result, 0, "Should sort sites in the descending order by usage");
-      }
-    }
-  }
-
-  function findSiteByHost(host) {
-    return mockSiteDataManager.fakeSites.find(site => site.principal.URI.host == host);
-  }
-});
--- a/browser/components/preferences/in-content/tests/head.js
+++ b/browser/components/preferences/in-content/tests/head.js
@@ -249,17 +249,17 @@ const mockSiteDataManager = {
   _originalRemoveQuotaUsage: null,
 
   getUsage(onUsageResult) {
     let result = this.fakeSites.map(site => ({
       origin: site.principal.origin,
       usage: site.usage,
       persisted: site.persisted
     }));
-    onUsageResult({ result, resultCode: Components.results.NS_OK });
+    onUsageResult({ result });
   },
 
   _removeQuotaUsage(site) {
     var target = site.principals[0].URI.host;
     this.fakeSites = this.fakeSites.filter(fakeSite => {
       return fakeSite.principal.URI.host != target;
     });
   },
deleted file mode 100755
--- a/browser/components/preferences/in-content/tests/service_worker_test.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <meta charset="utf-8">
-    <meta http-equiv="Cache-Control" content="public" />
-    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
-
-    <title>Service Worker Test</title>
-
-  </head>
-
-  <body>
-    <h1>Service Worker Test</h1>
-    <script type="text/javascript">
-      navigator.serviceWorker.register("service_worker_test.js")
-               .then(regis => window.dispatchEvent(new Event("service_worker_test_loaded")));
-    </script>
-  </body>
-</html>
deleted file mode 100644
--- a/browser/components/preferences/in-content/tests/service_worker_test.js
+++ /dev/null
@@ -1,1 +0,0 @@
-// empty worker, always succeed!