fune/browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
Johann Hofmann ac88585965 Bug 1502361 - Remove Content Blocking toggle from about:privatebrowsing. r=Ehsan
This simply removes the content blocking section when TP is not enabled to avoid overpromising.
We may update this UI to alert the user that TP is off after the UX team comes back with a new design.

Differential Revision: https://phabricator.services.mozilla.com/D10071

--HG--
extra : rebase_source : 6cf70948a142309edf06da3a53874bde2d7372e5
2018-10-29 17:10:24 +01:00

37 lines
1.4 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env mozilla/frame-script */
const TP_PB_ENABLED_PREF = "privacy.trackingprotection.pbmode.enabled";
document.addEventListener("DOMContentLoaded", function() {
if (!RPMIsWindowPrivate()) {
document.documentElement.classList.remove("private");
document.documentElement.classList.add("normal");
document.getElementById("startPrivateBrowsing").addEventListener("click", function() {
RPMSendAsyncMessage("OpenPrivateWindow");
});
return;
}
document.getElementById("startTour").addEventListener("click", function() {
RPMSendAsyncMessage("DontShowIntroPanelAgain");
});
let introURL = RPMGetFormatURLPref("privacy.trackingprotection.introURL");
// Variation 1 is specific to the Content Blocking UI.
let variation = "?variation=1";
document.getElementById("startTour").setAttribute("href", introURL + variation);
document.getElementById("learnMore").setAttribute("href",
RPMGetFormatURLPref("app.support.baseURL") + "private-browsing");
let tpEnabled = RPMGetBoolPref(TP_PB_ENABLED_PREF);
if (!tpEnabled) {
document.getElementById("tpSubHeader").remove();
document.getElementById("tpSection").remove();
}
});