Bug 1089774: Restart when an e10s user enables tracking protection (r=gavin)

This commit is contained in:
Monica Chew 2014-11-03 15:21:47 -08:00
parent f57df069d5
commit 798166f1ff
2 changed files with 42 additions and 3 deletions

View File

@ -413,14 +413,52 @@ BrowserGlue.prototype = {
case "nsPref:changed":
if (data == POLARIS_ENABLED) {
let enabled = Services.prefs.getBoolPref(POLARIS_ENABLED);
Services.prefs.setBoolPref("privacy.donottrackheader.enabled", enabled);
Services.prefs.setBoolPref("privacy.trackingprotection.enabled", enabled);
Services.prefs.setBoolPref("privacy.trackingprotection.ui.enabled", enabled);
if (enabled) {
let e10sEnabled = Services.appinfo.browserTabsRemoteAutostart;
let shouldRestart = e10sEnabled && this._promptForE10sRestart();
// Only set the related prefs if e10s is not enabled or the user
// saw a notification that e10s would be disabled on restart.
if (!e10sEnabled || shouldRestart) {
Services.prefs.setBoolPref("privacy.donottrackheader.enabled", enabled);
Services.prefs.setBoolPref("privacy.trackingprotection.enabled", enabled);
Services.prefs.setBoolPref("privacy.trackingprotection.ui.enabled", enabled);
if (shouldRestart) {
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit |
Ci.nsIAppStartup.eRestart);
}
} else {
// The user chose not to disable E10s which is temporarily
// incompatible with Polaris.
Services.prefs.clearUserPref(POLARIS_ENABLED);
}
} else {
// Don't reset DNT because its visible pref is independent of
// Polaris and may have been previously set.
Services.prefs.clearUserPref("privacy.trackingprotection.enabled");
Services.prefs.clearUserPref("privacy.trackingprotection.ui.enabled");
}
}
#endif
}
},
_promptForE10sRestart: function () {
let win = this.getMostRecentBrowserWindow();
let brandBundle = win.document.getElementById("bundle_brand");
let brandName = brandBundle.getString("brandShortName");
let prefBundle = win.document.getElementById("bundle_preferences");
let msg = "Multiprocess Nightly (e10s) does not yet support tracking protection. Multiprocessing will be disabled if you restart Firefox. Would you like to continue?";
let title = prefBundle.getFormattedString("shouldRestartTitle", [brandName]);
let shouldRestart = Services.prompt.confirm(win, title, msg);
if (shouldRestart) {
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
.createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(cancelQuit, "quit-application-requested", "restart");
shouldRestart = !cancelQuit.data;
}
return shouldRestart;
},
_syncSearchEngines: function () {
// Only do this if the search service is already initialized. This function
// gets called in finalUIStartup and from a browser-search-service observer,

View File

@ -4,3 +4,4 @@
skip-if = e10s # Bug ?????? - child process crash, but only when run as part of the suite (ie, probably not actually this tests fault!?)
[browser_polaris_prefs.js]
skip-if = e10s # Bug 1089774 - Tracking protection and e10s are incompatible.