From d187081733d6b3a380e61fdbb17c77fb75b542c6 Mon Sep 17 00:00:00 2001 From: Panos Astithas Date: Fri, 8 Jan 2016 20:09:07 +0200 Subject: [PATCH] Remove the polaris pref and enable the UI to toggle TP in normal mode by default in nightly (bug 1235565). r=paolo --- browser/app/profile/firefox.js | 3 +- browser/components/nsBrowserGlue.js | 25 ------ .../components/preferences/in-content/jar.mn | 2 +- .../preferences/in-content/privacy.js | 10 +-- browser/components/test/browser.ini | 2 - .../components/test/browser_polaris_prefs.js | 89 ------------------- .../telemetry/TelemetryEnvironment.jsm | 1 - 7 files changed, 6 insertions(+), 126 deletions(-) delete mode 100644 browser/components/test/browser_polaris_prefs.js diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index d518b8a7f9e4..7d8e680aa11a 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1548,7 +1548,8 @@ pref("experiments.supported", true); pref("media.gmp-provider.enabled", true); #ifdef NIGHTLY_BUILD -pref("browser.polaris.enabled", false); +pref("privacy.trackingprotection.ui.enabled", true); +#else pref("privacy.trackingprotection.ui.enabled", false); #endif pref("privacy.trackingprotection.introCount", 0); diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index f8c580330134..6bc20d05a8cf 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -9,7 +9,6 @@ const Cr = Components.results; const Cu = Components.utils; const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; -const POLARIS_ENABLED = "browser.polaris.enabled"; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); @@ -447,23 +446,6 @@ BrowserGlue.prototype = { hiddenList.join(",")); } break; -#ifdef NIGHTLY_BUILD - case "nsPref:changed": - if (data == POLARIS_ENABLED) { - let enabled = Services.prefs.getBoolPref(POLARIS_ENABLED); - if (enabled) { - Services.prefs.setBoolPref("privacy.donottrackheader.enabled", enabled); - Services.prefs.setBoolPref("privacy.trackingprotection.enabled", enabled); - Services.prefs.setBoolPref("privacy.trackingprotection.ui.enabled", 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"); - } - } - break; -#endif case "flash-plugin-hang": this._handleFlashHang(); break; @@ -634,9 +616,6 @@ BrowserGlue.prototype = { os.removeObserver(this, "keyword-search"); #endif os.removeObserver(this, "browser-search-engine-modified"); -#ifdef NIGHTLY_BUILD - Services.prefs.removeObserver(POLARIS_ENABLED, this); -#endif os.removeObserver(this, "flash-plugin-hang"); os.removeObserver(this, "xpi-signature-changed"); os.removeObserver(this, "autocomplete-did-enter-text"); @@ -821,10 +800,6 @@ BrowserGlue.prototype = { SelfSupportBackend.init(); -#ifdef NIGHTLY_BUILD - Services.prefs.addObserver(POLARIS_ENABLED, this, false); -#endif - #ifndef RELEASE_BUILD let themeName = gBrowserBundle.GetStringFromName("deveditionTheme.name"); let vendorShortName = gBrandBundle.GetStringFromName("vendorShortName"); diff --git a/browser/components/preferences/in-content/jar.mn b/browser/components/preferences/in-content/jar.mn index e3fe56107226..d53c22397790 100644 --- a/browser/components/preferences/in-content/jar.mn +++ b/browser/components/preferences/in-content/jar.mn @@ -8,7 +8,7 @@ browser.jar: content/browser/preferences/in-content/subdialogs.js * content/browser/preferences/in-content/main.js -* content/browser/preferences/in-content/privacy.js + content/browser/preferences/in-content/privacy.js * content/browser/preferences/in-content/advanced.js * content/browser/preferences/in-content/applications.js content/browser/preferences/in-content/content.js diff --git a/browser/components/preferences/in-content/privacy.js b/browser/components/preferences/in-content/privacy.js index 3f5cfeec3d83..2c873c6847d8 100644 --- a/browser/components/preferences/in-content/privacy.js +++ b/browser/components/preferences/in-content/privacy.js @@ -16,7 +16,6 @@ var gPrivacyPane = { */ _shouldPromptForRestart: true, -#ifdef NIGHTLY_BUILD /** * Show the Tracking Protection UI depending on the * privacy.trackingprotection.ui.enabled pref, and linkify its Learn More link @@ -35,7 +34,6 @@ var gPrivacyPane = { document.getElementById("trackingprotectionbox").hidden = false; document.getElementById("trackingprotectionpbmbox").hidden = true; }, -#endif /** * Linkify the Learn More link of the Private Browsing Mode Tracking @@ -83,9 +81,7 @@ var gPrivacyPane = { this.updateHistoryModePane(); this.updatePrivacyMicroControls(); this.initAutoStartPrivateBrowsingReverter(); -#ifdef NIGHTLY_BUILD this._initTrackingProtection(); -#endif this._initTrackingProtectionPBM(); this._initAutocomplete(); @@ -510,7 +506,7 @@ var gPrivacyPane = { acceptThirdPartyLabel.disabled = acceptThirdPartyMenu.disabled = !acceptCookies; keepUntil.disabled = menu.disabled = this._autoStartPrivateBrowsing || !acceptCookies; - + return acceptCookies; }, @@ -529,7 +525,7 @@ var gPrivacyPane = { return accept.checked ? 0 : 2; }, - + /** * Converts between network.cookie.cookieBehavior and the third-party cookie UI */ @@ -550,7 +546,7 @@ var gPrivacyPane = { return undefined; } }, - + writeAcceptThirdPartyCookies: function () { var accept = document.getElementById("acceptThirdPartyMenu").selectedItem; diff --git a/browser/components/test/browser.ini b/browser/components/test/browser.ini index 931772c77750..a6c154438a86 100644 --- a/browser/components/test/browser.ini +++ b/browser/components/test/browser.ini @@ -2,5 +2,3 @@ [browser_bug538331.js] 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] diff --git a/browser/components/test/browser_polaris_prefs.js b/browser/components/test/browser_polaris_prefs.js deleted file mode 100644 index 338aa8be17f2..000000000000 --- a/browser/components/test/browser_polaris_prefs.js +++ /dev/null @@ -1,89 +0,0 @@ -const POLARIS_ENABLED = "browser.polaris.enabled"; -const PREF_DNT = "privacy.donottrackheader.enabled"; -const PREF_TP = "privacy.trackingprotection.enabled"; -const PREF_TPUI = "privacy.trackingprotection.ui.enabled"; - -var prefs = [PREF_DNT, PREF_TP, PREF_TPUI]; - -function spinEventLoop() { - return new Promise((resolve) => executeSoon(resolve)); -}; - -// Spin event loop before checking so that polaris pref observer can set -// dependent prefs. -function* assertPref(pref, enabled) { - yield spinEventLoop(); - let prefEnabled = Services.prefs.getBoolPref(pref); - Assert.equal(prefEnabled, enabled, "Checking state of pref " + pref + "."); -}; - -function* testPrefs(test) { - for (let pref of prefs) { - yield test(pref); - } -} - -function isNightly() { - return Services.appinfo.version.includes("a1"); -} - -add_task(function* test_default_values() { - if (!isNightly()) { - ok(true, "Skipping test, not Nightly") - return; - } - Assert.ok(!Services.prefs.getBoolPref(POLARIS_ENABLED), POLARIS_ENABLED + " is disabled by default."); - Assert.ok(!Services.prefs.getBoolPref(PREF_TPUI), PREF_TPUI + "is disabled by default."); -}); - -add_task(function* test_changing_pref_changes_tracking() { - if (!isNightly()) { - ok(true, "Skipping test, not Nightly") - return; - } - - // Register a cleanup function for all the prefs affected by this entire test file. - registerCleanupFunction(function () { - Services.prefs.clearUserPref(POLARIS_ENABLED); - for (let pref of prefs) { - Services.prefs.clearUserPref(pref); - } - }); - - function* testPref(pref) { - Services.prefs.setBoolPref(POLARIS_ENABLED, true); - yield assertPref(pref, true); - Services.prefs.setBoolPref(POLARIS_ENABLED, false); - // We don't clear the DNT pref if Polaris is disabled. - if (pref != PREF_DNT) { - yield assertPref(pref, false); - } else { - yield assertPref(pref, true); - } - Services.prefs.setBoolPref(POLARIS_ENABLED, true); - yield assertPref(pref, true); - } - yield testPrefs(testPref); -}); - -add_task(function* test_prefs_can_be_changed_individually() { - if (!isNightly()) { - ok(true, "Skipping test, not Nightly") - return; - } - function* testPref(pref) { - Services.prefs.setBoolPref(POLARIS_ENABLED, true); - yield assertPref(pref, true); - Services.prefs.setBoolPref(pref, false); - yield assertPref(pref, false); - yield assertPref(POLARIS_ENABLED, true); - - Services.prefs.setBoolPref(POLARIS_ENABLED, false); - yield assertPref(pref, false); - - Services.prefs.setBoolPref(pref, true); - yield assertPref(pref, true); - yield assertPref(POLARIS_ENABLED, false); - } - yield testPrefs(testPref); -}); diff --git a/toolkit/components/telemetry/TelemetryEnvironment.jsm b/toolkit/components/telemetry/TelemetryEnvironment.jsm index 3fe07598c778..9fde9a95af52 100644 --- a/toolkit/components/telemetry/TelemetryEnvironment.jsm +++ b/toolkit/components/telemetry/TelemetryEnvironment.jsm @@ -108,7 +108,6 @@ const DEFAULT_ENVIRONMENT_PREFS = new Map([ ["browser.newtab.url", {what: RECORD_PREF_STATE}], ["browser.newtabpage.enabled", {what: RECORD_PREF_VALUE}], ["browser.newtabpage.enhanced", {what: RECORD_PREF_VALUE}], - ["browser.polaris.enabled", {what: RECORD_PREF_VALUE}], ["browser.shell.checkDefaultBrowser", {what: RECORD_PREF_VALUE}], ["browser.search.suggest.enabled", {what: RECORD_PREF_VALUE}], ["browser.startup.homepage", {what: RECORD_PREF_STATE}],