Bug 1253598 - Put offline cache feature behind a switchboard flag. r=sebastian draft
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Thu, 10 Mar 2016 15:31:30 -0500
changeset 339228 bf311ab30bbbf01db012188618fb5d9644974502
parent 339220 b6e38de09b1a8f6e5a04c899006943c810761354
child 515940 e42c9c886ed09722e1b7482e22e45598187cb8df
push id12673
push usermleibovic@mozilla.com
push dateThu, 10 Mar 2016 20:46:13 +0000
reviewerssebastian
bugs1253598
milestone48.0a1
Bug 1253598 - Put offline cache feature behind a switchboard flag. r=sebastian 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
@@ -6749,32 +6749,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,