зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1501286 - Part 3: Remove support for tracking protection UI in about:privatebrowsing r=johannh
Depends on D9520 Differential Revision: https://phabricator.services.mozilla.com/D9521 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
eb682c1609
Коммит
df7b68e39e
|
@ -5,40 +5,19 @@
|
|||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
const CB_ENABLED_PREF = "browser.contentblocking.enabled";
|
||||
const CB_UI_ENABLED_PREF = "browser.contentblocking.ui.enabled";
|
||||
const TP_ENABLED_PREF = "privacy.trackingprotection.enabled";
|
||||
const TP_PB_ENABLED_PREF = "privacy.trackingprotection.pbmode.enabled";
|
||||
|
||||
let contentBlockingUIEnabled = false;
|
||||
|
||||
function updateTPInfo() {
|
||||
let tpButton = document.getElementById("tpButton");
|
||||
let tpToggle = document.getElementById("tpToggle");
|
||||
let title = document.getElementById("title");
|
||||
let titleTracking = document.getElementById("titleTracking");
|
||||
let tpSubHeader = document.getElementById("tpSubHeader");
|
||||
|
||||
let tpTitle = document.getElementById("tpTitle");
|
||||
let cbTitle = document.getElementById("cbTitle");
|
||||
let tpDescription = document.getElementById("tpDescription");
|
||||
let cbDescription = document.getElementById("cbDescription");
|
||||
|
||||
tpTitle.toggleAttribute("hidden", contentBlockingUIEnabled);
|
||||
tpDescription.toggleAttribute("hidden", contentBlockingUIEnabled);
|
||||
|
||||
cbTitle.toggleAttribute("hidden", !contentBlockingUIEnabled);
|
||||
cbDescription.toggleAttribute("hidden", !contentBlockingUIEnabled);
|
||||
|
||||
let globalTrackingEnabled = RPMGetBoolPref(TP_ENABLED_PREF);
|
||||
let trackingEnabled = globalTrackingEnabled || RPMGetBoolPref(TP_PB_ENABLED_PREF);
|
||||
|
||||
if (contentBlockingUIEnabled) {
|
||||
let contentBlockingEnabled = RPMGetBoolPref(CB_ENABLED_PREF);
|
||||
trackingEnabled = trackingEnabled && contentBlockingEnabled;
|
||||
} else {
|
||||
title.toggleAttribute("hidden", trackingEnabled);
|
||||
titleTracking.toggleAttribute("hidden", !trackingEnabled);
|
||||
}
|
||||
let contentBlockingEnabled = RPMGetBoolPref(CB_ENABLED_PREF);
|
||||
trackingEnabled = trackingEnabled && contentBlockingEnabled;
|
||||
|
||||
// if tracking protection is enabled globally we don't even give the user
|
||||
// a choice here by hiding the toggle completely.
|
||||
|
@ -58,16 +37,13 @@ document.addEventListener("DOMContentLoaded", function() {
|
|||
return;
|
||||
}
|
||||
|
||||
contentBlockingUIEnabled = RPMGetBoolPref(CB_UI_ENABLED_PREF);
|
||||
|
||||
document.getElementById("startTour").addEventListener("click", function() {
|
||||
RPMSendAsyncMessage("DontShowIntroPanelAgain");
|
||||
});
|
||||
|
||||
let introURL = RPMGetFormatURLPref("privacy.trackingprotection.introURL");
|
||||
// If the CB UI is enabled, tell the tour page to show a different variation
|
||||
// that is updated to reflect the CB control center UI.
|
||||
let variation = "?variation=" + (contentBlockingUIEnabled ? "1" : "0");
|
||||
// Variation 1 is specific to the Content Blocking UI.
|
||||
let variation = "?variation=1";
|
||||
|
||||
document.getElementById("startTour").setAttribute("href", introURL + variation);
|
||||
|
||||
|
@ -80,7 +56,7 @@ document.addEventListener("DOMContentLoaded", function() {
|
|||
});
|
||||
tpToggle.addEventListener("change", async function() {
|
||||
let promises = [];
|
||||
if (tpToggle.checked && contentBlockingUIEnabled) {
|
||||
if (tpToggle.checked) {
|
||||
promises.push(RPMSetBoolPref(CB_ENABLED_PREF, true));
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
<div class="showPrivate container">
|
||||
<h1 class="title">
|
||||
<span id="title">&privateBrowsing.title;</span>
|
||||
<span id="titleTracking" hidden="hidden">&privateBrowsing.title.tracking;</span>
|
||||
</h1>
|
||||
<section class="section-main">
|
||||
<p>&aboutPrivateBrowsing.info.notsaved.before;<strong>&aboutPrivateBrowsing.info.notsaved.emphasize;</strong>&aboutPrivateBrowsing.info.notsaved.after;</p>
|
||||
|
@ -58,14 +57,12 @@
|
|||
</section>
|
||||
|
||||
<h2 id="tpSubHeader" class="about-subheader">
|
||||
<span id="tpTitle">&trackingProtection.title;</span>
|
||||
<span id="cbTitle">&contentBlocking.title;</span>
|
||||
<input id="tpToggle" class="toggle toggle-input" type="checkbox"/>
|
||||
<span id="tpButton" class="toggle-btn"></span>
|
||||
</h2>
|
||||
|
||||
<section class="section-main">
|
||||
<p id="tpDescription">&trackingProtection.description2;</p>
|
||||
<p id="cbDescription">&contentBlocking.description;</p>
|
||||
<p>
|
||||
<a id="startTour" class="button">&trackingProtection.startTour1;</a>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
const TP_PB_ENABLED_PREF = "privacy.trackingprotection.pbmode.enabled";
|
||||
const CB_ENABLED_PREF = "browser.contentblocking.enabled";
|
||||
const CB_UI_ENABLED_PREF = "browser.contentblocking.ui.enabled";
|
||||
|
||||
/**
|
||||
* Opens a new private window and loads "about:privatebrowsing" there.
|
||||
|
@ -54,36 +53,7 @@ add_task(async function test_links() {
|
|||
Services.prefs.setCharPref("app.support.baseURL", "https://example.com/");
|
||||
Services.prefs.setCharPref("privacy.trackingprotection.introURL",
|
||||
"https://example.com/tour");
|
||||
Services.prefs.setBoolPref(CB_UI_ENABLED_PREF, false);
|
||||
registerCleanupFunction(function() {
|
||||
Services.prefs.clearUserPref(CB_UI_ENABLED_PREF);
|
||||
Services.prefs.clearUserPref("privacy.trackingprotection.introURL");
|
||||
Services.prefs.clearUserPref("app.support.baseURL");
|
||||
});
|
||||
|
||||
let { win, tab } = await openAboutPrivateBrowsing();
|
||||
|
||||
await testLinkOpensTab({ win, tab,
|
||||
elementId: "learnMore",
|
||||
expectedUrl: "https://example.com/private-browsing",
|
||||
});
|
||||
|
||||
await testLinkOpensUrl({ win, tab,
|
||||
elementId: "startTour",
|
||||
expectedUrl: "https://example.com/tour?variation=0",
|
||||
});
|
||||
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
});
|
||||
|
||||
add_task(async function test_links_CB() {
|
||||
// Use full version and change the remote URLs to prevent network access.
|
||||
Services.prefs.setCharPref("app.support.baseURL", "https://example.com/");
|
||||
Services.prefs.setCharPref("privacy.trackingprotection.introURL",
|
||||
"https://example.com/tour");
|
||||
Services.prefs.setBoolPref(CB_UI_ENABLED_PREF, true);
|
||||
registerCleanupFunction(function() {
|
||||
Services.prefs.clearUserPref(CB_UI_ENABLED_PREF);
|
||||
Services.prefs.clearUserPref("privacy.trackingprotection.introURL");
|
||||
Services.prefs.clearUserPref("app.support.baseURL");
|
||||
});
|
||||
|
@ -116,46 +86,6 @@ function waitForPrefChanged(pref) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the action to disable and re-enable Tracking Protection in
|
||||
* "about:privatebrowsing".
|
||||
*/
|
||||
add_task(async function test_toggleTrackingProtection() {
|
||||
// Use tour version but disable Tracking Protection.
|
||||
Services.prefs.setBoolPref(TP_PB_ENABLED_PREF, true);
|
||||
// For good measure, check that content blocking being off
|
||||
// has no impact if the contentblocking UI is not shown.
|
||||
Services.prefs.setBoolPref(CB_ENABLED_PREF, false);
|
||||
Services.prefs.setBoolPref(CB_UI_ENABLED_PREF, false);
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
Services.prefs.clearUserPref(TP_PB_ENABLED_PREF);
|
||||
Services.prefs.clearUserPref(CB_ENABLED_PREF);
|
||||
Services.prefs.clearUserPref(CB_UI_ENABLED_PREF);
|
||||
});
|
||||
|
||||
let { win, tab } = await openAboutPrivateBrowsing();
|
||||
|
||||
// Set up the observer for the preference change before triggering the action.
|
||||
let promisePrefChanged = waitForPrefChanged(TP_PB_ENABLED_PREF);
|
||||
await ContentTask.spawn(tab, {}, async function() {
|
||||
is(content.document.getElementById("tpToggle").checked, true, "toggle is active");
|
||||
content.document.getElementById("tpButton").click();
|
||||
});
|
||||
await promisePrefChanged;
|
||||
ok(!Services.prefs.getBoolPref(TP_PB_ENABLED_PREF), "Tracking Protection is disabled.");
|
||||
|
||||
promisePrefChanged = waitForPrefChanged(TP_PB_ENABLED_PREF);
|
||||
await ContentTask.spawn(tab, {}, async function() {
|
||||
is(content.document.getElementById("tpToggle").checked, false, "toggle is not active");
|
||||
content.document.getElementById("tpButton").click();
|
||||
});
|
||||
await promisePrefChanged;
|
||||
ok(Services.prefs.getBoolPref(TP_PB_ENABLED_PREF), "Tracking Protection is enabled.");
|
||||
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
});
|
||||
|
||||
/**
|
||||
* Tests the action to disable and re-enable Tracking Protection in
|
||||
* "about:privatebrowsing" when content blocking is disabled.
|
||||
|
@ -163,12 +93,10 @@ add_task(async function test_toggleTrackingProtection() {
|
|||
add_task(async function test_toggleTrackingProtectionContentBlocking() {
|
||||
Services.prefs.setBoolPref(TP_PB_ENABLED_PREF, true);
|
||||
Services.prefs.setBoolPref(CB_ENABLED_PREF, false);
|
||||
Services.prefs.setBoolPref(CB_UI_ENABLED_PREF, true);
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
Services.prefs.clearUserPref(TP_PB_ENABLED_PREF);
|
||||
Services.prefs.clearUserPref(CB_ENABLED_PREF);
|
||||
Services.prefs.clearUserPref(CB_UI_ENABLED_PREF);
|
||||
});
|
||||
|
||||
let { win, tab } = await openAboutPrivateBrowsing();
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
<!ENTITY privatebrowsingpage.openPrivateWindow.accesskey "P">
|
||||
|
||||
<!ENTITY privateBrowsing.title "Private Browsing">
|
||||
<!ENTITY privateBrowsing.title.tracking "Private Browsing with Tracking Protection">
|
||||
<!ENTITY aboutPrivateBrowsing.info.notsaved.before "When you browse in a Private Window, Firefox ">
|
||||
<!ENTITY aboutPrivateBrowsing.info.notsaved.emphasize "does not save">
|
||||
<!ENTITY aboutPrivateBrowsing.info.notsaved.after ":">
|
||||
|
@ -28,8 +27,6 @@
|
|||
<!ENTITY aboutPrivateBrowsing.learnMore3.title "Private Browsing">
|
||||
<!ENTITY aboutPrivateBrowsing.learnMore3.after ".">
|
||||
|
||||
<!ENTITY trackingProtection.title "Tracking Protection">
|
||||
<!ENTITY trackingProtection.description2 "Some websites use trackers that can monitor your activity across the Internet. With Tracking Protection Firefox will block many trackers that can collect information about your browsing behavior.">
|
||||
<!ENTITY trackingProtection.startTour1 "See how it works">
|
||||
|
||||
<!ENTITY contentBlocking.title "Content Blocking">
|
||||
|
|
|
@ -86,8 +86,7 @@ p {
|
|||
font-size: .9em;
|
||||
}
|
||||
|
||||
#cbTitle,
|
||||
#tpTitle {
|
||||
#cbTitle {
|
||||
margin-inline-end: 12px;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ let RPMAccessManager = {
|
|||
// ["browser.contentblocking.enabled",
|
||||
// "privacy.trackingprotection.pbmode.enabled"],
|
||||
"getBoolPref": ["browser.contentblocking.enabled",
|
||||
"browser.contentblocking.ui.enabled",
|
||||
"privacy.trackingprotection.enabled",
|
||||
"privacy.trackingprotection.pbmode.enabled"],
|
||||
"getFormatURLPref": ["privacy.trackingprotection.introURL",
|
||||
|
|
Загрузка…
Ссылка в новой задаче