Bug 1253598 - Put offline cache feature behind a switchboard flag. r=sebastian
MozReview-Commit-ID: 2g0JKBopIDB
--- 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,