Remove the polaris pref and enable the UI to toggle TP in normal mode by default in nightly (bug 1235565). r=paolo

This commit is contained in:
Panos Astithas 2016-01-08 20:09:07 +02:00
Родитель 5a036ab130
Коммит d187081733
7 изменённых файлов: 6 добавлений и 126 удалений

Просмотреть файл

@ -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);

Просмотреть файл

@ -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");

Просмотреть файл

@ -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

Просмотреть файл

@ -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;

Просмотреть файл

@ -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]

Просмотреть файл

@ -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);
});

Просмотреть файл

@ -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}],