mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-30 02:57:29 +09:00
[BASILISK] Remove tracking protection controls from aboutPrivateBrowsing if safebrowsing isn't built
This commit is contained in:
parent
771cee197c
commit
1652fce000
3 changed files with 14 additions and 2 deletions
|
|
@ -14,6 +14,7 @@ const FAVICON_PRIVACY = "chrome://browser/skin/privatebrowsing/favicon.svg";
|
||||||
var stringBundle = Services.strings.createBundle(
|
var stringBundle = Services.strings.createBundle(
|
||||||
"chrome://browser/locale/aboutPrivateBrowsing.properties");
|
"chrome://browser/locale/aboutPrivateBrowsing.properties");
|
||||||
|
|
||||||
|
#ifdef MOZ_SAFE_BROWSING
|
||||||
var prefBranch = Services.prefs.getBranch("privacy.trackingprotection.");
|
var prefBranch = Services.prefs.getBranch("privacy.trackingprotection.");
|
||||||
var prefObserver = {
|
var prefObserver = {
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
|
||||||
|
|
@ -37,6 +38,7 @@ var prefObserver = {
|
||||||
};
|
};
|
||||||
prefBranch.addObserver("pbmode.enabled", prefObserver, true);
|
prefBranch.addObserver("pbmode.enabled", prefObserver, true);
|
||||||
prefBranch.addObserver("enabled", prefObserver, true);
|
prefBranch.addObserver("enabled", prefObserver, true);
|
||||||
|
#endif
|
||||||
|
|
||||||
function setFavIcon(url) {
|
function setFavIcon(url) {
|
||||||
document.getElementById("favicon").setAttribute("href", url);
|
document.getElementById("favicon").setAttribute("href", url);
|
||||||
|
|
@ -54,23 +56,29 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MOZ_SAFE_BROWSING
|
||||||
let tpToggle = document.getElementById("tpToggle");
|
let tpToggle = document.getElementById("tpToggle");
|
||||||
document.getElementById("tpButton").addEventListener('click', () => {
|
document.getElementById("tpButton").addEventListener('click', () => {
|
||||||
tpToggle.click();
|
tpToggle.click();
|
||||||
});
|
});
|
||||||
|
#endif
|
||||||
|
|
||||||
document.title = stringBundle.GetStringFromName("title.head");
|
document.title = stringBundle.GetStringFromName("title.head");
|
||||||
document.getElementById("favicon")
|
document.getElementById("favicon")
|
||||||
.setAttribute("href", FAVICON_PRIVACY);
|
.setAttribute("href", FAVICON_PRIVACY);
|
||||||
|
#ifdef MOZ_SAFE_BROWSING
|
||||||
tpToggle.addEventListener("change", toggleTrackingProtection);
|
tpToggle.addEventListener("change", toggleTrackingProtection);
|
||||||
|
#endif
|
||||||
|
|
||||||
let formatURLPref = Cc["@mozilla.org/toolkit/URLFormatterService;1"]
|
let formatURLPref = Cc["@mozilla.org/toolkit/URLFormatterService;1"]
|
||||||
.getService(Ci.nsIURLFormatter).formatURLPref;
|
.getService(Ci.nsIURLFormatter).formatURLPref;
|
||||||
document.getElementById("learnMore").setAttribute("href",
|
document.getElementById("learnMore").setAttribute("href",
|
||||||
formatURLPref("app.support.baseURL") + "private-browsing");
|
formatURLPref("app.support.baseURL") + "private-browsing");
|
||||||
|
|
||||||
|
#ifdef MOZ_SAFE_BROWSING
|
||||||
// Update state that depends on preferences.
|
// Update state that depends on preferences.
|
||||||
prefObserver.observe();
|
prefObserver.observe();
|
||||||
|
#endif
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
function openPrivateWindow() {
|
function openPrivateWindow() {
|
||||||
|
|
@ -79,9 +87,11 @@ function openPrivateWindow() {
|
||||||
new CustomEvent("AboutPrivateBrowsingOpenWindow", {bubbles:true}));
|
new CustomEvent("AboutPrivateBrowsingOpenWindow", {bubbles:true}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MOZ_SAFE_BROWSING
|
||||||
function toggleTrackingProtection() {
|
function toggleTrackingProtection() {
|
||||||
// Ask chrome to enable tracking protection
|
// Ask chrome to enable tracking protection
|
||||||
document.dispatchEvent(
|
document.dispatchEvent(
|
||||||
new CustomEvent("AboutPrivateBrowsingToggleTrackingProtection",
|
new CustomEvent("AboutPrivateBrowsingToggleTrackingProtection",
|
||||||
{bubbles: true}));
|
{bubbles: true}));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -61,11 +61,13 @@
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
#ifdef MOZ_SAFE_BROWSING
|
||||||
<h2 id="tpSubHeader" class="about-subheader">
|
<h2 id="tpSubHeader" class="about-subheader">
|
||||||
<span class="tpTitle">&trackingProtection.title;</span>
|
<span class="tpTitle">&trackingProtection.title;</span>
|
||||||
<input id="tpToggle" class="toggle toggle-input" type="checkbox"/>
|
<input id="tpToggle" class="toggle toggle-input" type="checkbox"/>
|
||||||
<span id="tpButton" class="toggle-btn"></span>
|
<span id="tpButton" class="toggle-btn"></span>
|
||||||
</h2>
|
</h2>
|
||||||
|
#endif
|
||||||
|
|
||||||
<section class="section-main">
|
<section class="section-main">
|
||||||
<p>&trackingProtection.description2;</p>
|
<p>&trackingProtection.description2;</p>
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,5 @@
|
||||||
|
|
||||||
browser.jar:
|
browser.jar:
|
||||||
content/browser/aboutPrivateBrowsing.css (content/aboutPrivateBrowsing.css)
|
content/browser/aboutPrivateBrowsing.css (content/aboutPrivateBrowsing.css)
|
||||||
content/browser/aboutPrivateBrowsing.xhtml (content/aboutPrivateBrowsing.xhtml)
|
* content/browser/aboutPrivateBrowsing.xhtml (content/aboutPrivateBrowsing.xhtml)
|
||||||
content/browser/aboutPrivateBrowsing.js (content/aboutPrivateBrowsing.js)
|
* content/browser/aboutPrivateBrowsing.js (content/aboutPrivateBrowsing.js)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue