Bug 1585582 - Set appcache prefs on before start to prevent races in tests. r=baku
☠☠ backed out by 2afde003f4b1 ☠ ☠
authorJonathan Kingston <jkt@mozilla.com>
Wed, 16 Oct 2019 15:36:52 +0000
changeset 498207 98d7a4f4388f1d42a56baccf9079c83aeafee99f
parent 498206 c13ec2bbc0a77b09e9d2a26870b0f85564d2c6a4
child 498208 7cf32690c0c04f3025ca2fc5cb3caecb5f061bf6
push id36708
push usernbeleuzu@mozilla.com
push dateFri, 18 Oct 2019 21:48:04 +0000
treeherdermozilla-central@27bbc1fba015 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1585582
milestone71.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 1585582 - Set appcache prefs on before start to prevent races in tests. r=baku Differential Revision: https://phabricator.services.mozilla.com/D47977
browser/base/content/test/sanitize/browser.ini
browser/base/content/test/sanitize/browser_sanitizeDialog.js
testing/profiles/web-platform/user.js
toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
toolkit/forgetaboutsite/test/unit/xpcshell.ini
--- a/browser/base/content/test/sanitize/browser.ini
+++ b/browser/base/content/test/sanitize/browser.ini
@@ -6,12 +6,15 @@ support-files=
 
 [browser_purgehistory_clears_sh.js]
 [browser_sanitize-formhistory.js]
 [browser_sanitize-offlineData.js]
 [browser_sanitize-passwordDisabledHosts.js]
 [browser_sanitize-sitepermissions.js]
 [browser_sanitize-timespans.js]
 [browser_sanitizeDialog.js]
+prefs=
+  browser.cache.offline.enable=true
+  browser.cache.offline.storage.enable=true
 [browser_cookiePermission.js]
 [browser_cookiePermission_aboutURL.js]
 [browser_cookiePermission_containers.js]
 [browser_cookiePermission_subDomains.js]
--- a/browser/base/content/test/sanitize/browser_sanitizeDialog.js
+++ b/browser/base/content/test/sanitize/browser_sanitizeDialog.js
@@ -485,18 +485,16 @@ add_task(async function test_form_entrie
     is(exists, false, "form entry " + formEntry + " should no longer exist");
   };
   wh.open();
   await wh.promiseClosed;
 });
 
 // Test for offline cache deletion
 add_task(async function test_offline_cache() {
-  Services.prefs.setBoolPref("browser.cache.offline.enable", true);
-  Services.prefs.setBoolPref("browser.cache.offline.storage.enable", true);
   // Prepare stuff, we will work with www.example.com
   var URL = "http://www.example.com";
   var URI = makeURI(URL);
   var principal = Services.scriptSecurityManager.createContentPrincipal(
     URI,
     {}
   );
 
@@ -565,18 +563,16 @@ add_task(async function test_offline_cac
 
   storage.asyncOpenURI(
     makeURI(URL),
     "",
     Ci.nsICacheStorage.OPEN_TRUNCATE,
     cacheListener
   );
   await wh.promiseClosed;
-  Services.prefs.clearUserPref("browser.cache.offline.enable");
-  Services.prefs.clearUserPref("browser.cache.offline.storage.enable");
 });
 
 // Test for offline apps permission deletion
 add_task(async function test_offline_apps_permissions() {
   // Prepare stuff, we will work with www.example.com
   var URL = "http://www.example.com";
   var URI = makeURI(URL);
   var principal = Services.scriptSecurityManager.createContentPrincipal(
--- a/testing/profiles/web-platform/user.js
+++ b/testing/profiles/web-platform/user.js
@@ -35,8 +35,12 @@ user_pref("browser.safebrowsing.phishing
 // Automatically unload beforeunload alerts
 user_pref("dom.disable_beforeunload", true);
 // Enable implicit keyframes since the common animation interpolation test
 // function assumes this is available.
 user_pref("dom.animations-api.implicit-keyframes.enabled", true);
 // sometime wpt runs test even before the document becomes visible, which would
 // delay video.play() and cause play() running in wrong order.
 user_pref("media.block-autoplay-until-in-foreground", false);
+user_pref("media.block-autoplay-until-in-foreground", false);
+// Enable AppCache globally for now whilst it's being removed in Bug 1584984
+user_pref("browser.cache.offline.storage.enable", true);
+user_pref("browser.cache.offline.enable", true);
--- a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
+++ b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
@@ -401,18 +401,16 @@ async function test_push_cleared() {
   do_get_profile();
   setPrefs();
   const { PushServiceWebSocket } = ChromeUtils.import(
     "resource://gre/modules/PushServiceWebSocket.jsm"
   );
   const { PushService } = serviceExports;
   const userAgentID = "bd744428-f125-436a-b6d0-dd0c9845837f";
   const channelID = "0ef2ad4a-6c49-41ad-af6e-95d2425276bf";
-  Services.prefs.setBoolPref("browser.cache.offline.storage.enable", true);
-  Services.prefs.setBoolPref("browser.cache.offline.enable", true);
 
   let db = PushServiceWebSocket.newPushDB();
 
   try {
     PushService.init({
       serverURI: "wss://push.example.org/",
       db,
       makeWebSocket(uriObj) {
@@ -552,20 +550,28 @@ var tests = [
   test_content_preferences_cleared_with_subdomain,
   test_content_preferences_not_cleared_with_uri_contains_domain,
 
   // Push
   test_push_cleared,
 
   // Storage
   test_storage_cleared,
+];
 
-  // Cache
-  test_cache_cleared,
-];
+// Cache
+//
+// Due to these prefs being static, setting them doesn't make a difference in time for the test
+// As we are removing AppCache in Bug 1584984 this will just be removed soon.
+if (
+  Services.prefs.getBoolPref("browser.cache.offline.enable") &&
+  Services.prefs.getBoolPref("browser.cache.offline.storage.enable")
+) {
+  tests.push(test_cache_cleared);
+}
 
 function run_test() {
   for (let i = 0; i < tests.length; i++) {
     add_task(tests[i]);
   }
 
   run_next_test();
 }
--- a/toolkit/forgetaboutsite/test/unit/xpcshell.ini
+++ b/toolkit/forgetaboutsite/test/unit/xpcshell.ini
@@ -1,8 +1,7 @@
 [DEFAULT]
-prefs = [browser.cache.offline.enable = true, browser.cache.offline.storage.enable=true]
 head = head_forgetaboutsite.js ../../../../dom/push/test/xpcshell/head.js
 skip-if = toolkit == 'android'
 support-files =
   !/dom/push/test/xpcshell/head.js
 
 [test_removeDataFromDomain.js]