diff --git a/application/basilisk/components/preferences/in-content/advanced.js b/application/basilisk/components/preferences/in-content/advanced.js index 6330d34633..e481042cce 100644 --- a/application/basilisk/components/preferences/in-content/advanced.js +++ b/application/basilisk/components/preferences/in-content/advanced.js @@ -11,6 +11,8 @@ const PREF_UPLOAD_ENABLED = "datareporting.healthreport.uploadEnabled"; var gAdvancedPane = { _inited: false, + _shouldPromptForE10sRestart: true, + _storedE10sEnabled: false, /** * Brings the appropriate tab to the front and initializes various bits of UI. @@ -77,6 +79,10 @@ var gAdvancedPane = { gAdvancedPane.showSecurityDevices); setEventListener("cacheSize", "change", gAdvancedPane.updateCacheSizePref); + setEventListener("e10sEnabled", "command", + gAdvancedPane.updateE10sCheckbox); + + this._storedE10sEnabled = document.getElementById("e10sEnabled").checked; if (AppConstants.MOZ_WIDGET_GTK) { // GTK tabbox' allow the scroll wheel to change the selected tab, @@ -170,6 +176,50 @@ var gAdvancedPane = { return 0; }, + readE10sEnabled: function () + { + let autostart = document.getElementById("browser.tabs.remote.autostart").value; + let trialAutostart = document.getElementById("browser.tabs.remote.autostart.2").value; + return !!(autostart || trialAutostart); + }, + + writeE10sEnabled: function () + { + let enabled = document.getElementById("e10sEnabled").checked; + document.getElementById("browser.tabs.remote.autostart.2").value = enabled; + return enabled; + }, + + updateE10sCheckbox: function () + { + let checkbox = document.getElementById("e10sEnabled"); + let enabled = checkbox.checked; + + if (enabled == this._storedE10sEnabled) { + return; + } + + if (!this._shouldPromptForE10sRestart) { + return; + } + + let buttonIndex = confirmRestartPrompt(enabled, 1, true, false); + if (buttonIndex == CONFIRM_RESTART_PROMPT_RESTART_NOW) { + document.getElementById("browser.tabs.remote.autostart").value = enabled; + document.getElementById("browser.tabs.remote.autostart.2").value = enabled; + let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"] + .getService(Ci.nsIAppStartup); + appStartup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart); + return; + } + + this._shouldPromptForE10sRestart = false; + checkbox.checked = this._storedE10sEnabled; + document.getElementById("browser.tabs.remote.autostart").value = this._storedE10sEnabled; + document.getElementById("browser.tabs.remote.autostart.2").value = this._storedE10sEnabled; + this._shouldPromptForE10sRestart = true; + }, + /** * security.OCSP.enabled is an integer value for legacy reasons. * A value of 1 means OCSP is enabled. Any other value means it is disabled. diff --git a/application/basilisk/components/preferences/in-content/advanced.xul b/application/basilisk/components/preferences/in-content/advanced.xul index 89572111db..5637c619b5 100644 --- a/application/basilisk/components/preferences/in-content/advanced.xul +++ b/application/basilisk/components/preferences/in-content/advanced.xul @@ -46,6 +46,12 @@ + + + diff --git a/application/basilisk/locales/en-US/chrome/browser/preferences/advanced.dtd b/application/basilisk/locales/en-US/chrome/browser/preferences/advanced.dtd index b4986fa371..57723d92b7 100644 --- a/application/basilisk/locales/en-US/chrome/browser/preferences/advanced.dtd +++ b/application/basilisk/locales/en-US/chrome/browser/preferences/advanced.dtd @@ -27,6 +27,8 @@ + +