Bug 1253598 - Put offline cache feature behind a switchboard flag. r=sebastian, a=lizzard
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Thu, 10 Mar 2016 15:31:30 -0500
changeset 323499 854a8a7e9606c5e5dc0eaa6a67cd52b19d58f51f
parent 323498 025c8013b0623b9d176372cf2e90e1f3a8288cdd
child 323500 590a4e9f938a9656ac23d05fa7cdcea3083f7345
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian, lizzard
bugs1253598
milestone47.0a2
Bug 1253598 - Put offline cache feature behind a switchboard flag. r=sebastian, a=lizzard MozReview-Commit-ID: 2g0JKBopIDB
mobile/android/app/mobile.js
mobile/android/chrome/content/browser.js
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -28,17 +28,18 @@ pref("browser.chromeURL", "chrome://brow
 
 // If a tab has not been active for this long (seconds), then it may be
 // turned into a zombie tab to preemptively free up memory. -1 disables time-based
 // expiration (but low-memory conditions may still require the tab to be zombified).
 pref("browser.tabs.expireTime", 900);
 
 // Control whether tab content should try to load from disk cache when network
 // is offline.
-pref("browser.tabs.useCache", true);
+// Controlled by Switchboard experiment "offline-cache".
+pref("browser.tabs.useCache", false);
 
 // From libpref/src/init/all.js, extended to allow a slightly wider zoom range.
 pref("zoom.minPercent", 20);
 pref("zoom.maxPercent", 400);
 pref("toolkit.zoomManager.zoomValues", ".2,.3,.5,.67,.8,.9,1,1.1,1.2,1.33,1.5,1.7,2,2.4,3,4");
 
 // Mobile will use faster, less durable mode.
 pref("toolkit.storage.synchronous", 0);
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -6796,32 +6796,41 @@ var Telemetry = {
     histogram.add(aValue);
   },
 };
 
 var Experiments = {
   // Enable malware download protection (bug 936041)
   MALWARE_DOWNLOAD_PROTECTION: "malware-download-protection",
 
+  // Try to load pages from disk cache when network is offline (bug 935190)
+  OFFLINE_CACHE: "offline-cache",
+
   init() {
     Messaging.sendRequestForResult({
       type: "Experiments:GetActive"
     }).then(experiments => {
       let names = JSON.parse(experiments);
       for (let name of names) {
         switch (name) {
           case this.MALWARE_DOWNLOAD_PROTECTION: {
             // Apply experiment preferences on the default branch. This allows
             // us to avoid migrating user prefs when experiments are enabled/disabled,
             // and it also allows users to override these prefs in about:config.
             let defaults = Services.prefs.getDefaultBranch(null);
             defaults.setBoolPref("browser.safebrowsing.downloads.enabled", true);
             defaults.setBoolPref("browser.safebrowsing.downloads.remote.enabled", true);
             continue;
           }
+
+          case this.OFFLINE_CACHE: {
+            let defaults = Services.prefs.getDefaultBranch(null);
+            defaults.setBoolPref("browser.tabs.useCache", true);
+            continue;
+          }
         }
       }
     });
   }
 };
 
 var ExternalApps = {
   _contextMenuId: null,