Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2023-10-18 11:48:06 +08:00
commit ecd3cd8676
53 changed files with 67 additions and 1452 deletions

View file

@ -40,15 +40,6 @@ static RedirEntry kRedirMap[] = {
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::HIDE_FROM_ABOUTABOUT
},
#ifdef MOZ_SAFE_BROWSING
{
"blocked", "chrome://browser/content/blockedSite.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::URI_CAN_LOAD_IN_CHILD |
nsIAboutModule::ALLOW_SCRIPT |
nsIAboutModule::HIDE_FROM_ABOUTABOUT
},
#endif
{
"certerror", "chrome://browser/content/aboutNetError.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |

View file

@ -86,9 +86,6 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
#endif
{ NS_FEEDSNIFFER_CONTRACTID, &kNS_FEEDSNIFFER_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "basilisk", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
#ifdef MOZ_SAFE_BROWSING
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "blocked", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
#endif
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "certerror", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "tabcrashed", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "feeds", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },

View file

@ -54,37 +54,6 @@
oncommand="gIdentityHandler.toggleSubView('security', this)"/>
</hbox>
<!-- Tracking Protection Section -->
<hbox id="tracking-protection-container"
class="identity-popup-section"
when-connection="not-secure secure secure-ev secure-cert-user-overridden file">
<vbox id="tracking-protection-content" flex="1">
<description class="identity-popup-headline"
crop="end"
value="&trackingProtection.title;" />
<label id="tracking-blocked"
crop="end">&trackingProtection.detectedBlocked3;</label>
<label id="tracking-loaded"
crop="end">&trackingProtection.detectedNotBlocked3;</label>
<label id="tracking-not-detected"
crop="end">&trackingProtection.notDetected3;</label>
<button id="tracking-action-unblock"
label="&trackingProtection.unblock.label;"
accesskey="&trackingProtection.unblock.accesskey;"
oncommand="TrackingProtection.disableForCurrentPage();" />
<button id="tracking-action-unblock-private"
label="&trackingProtection.unblockPrivate.label;"
accesskey="&trackingProtection.unblockPrivate.accesskey;"
oncommand="TrackingProtection.disableForCurrentPage();" />
<button id="tracking-action-block"
label="&trackingProtection.block2.label;"
accesskey="&trackingProtection.block2.accesskey;"
oncommand="TrackingProtection.enableForCurrentPage();" />
</vbox>
</hbox>
<!-- Permissions Section -->
<hbox class="identity-popup-section">
<vbox id="identity-popup-permissions-content" flex="1">

View file

@ -1,209 +0,0 @@
/* 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/. */
Components.utils.import("resource://gre/modules/Services.jsm");
const BASE_LIST_ID = "base";
const CONTENT_LIST_ID = "content";
const TRACK_SUFFIX = "-track-digest256";
const TRACKING_TABLE_PREF = "urlclassifier.trackingTable";
const LISTS_PREF_BRANCH = "browser.safebrowsing.provider.mozilla.lists.";
const UPDATE_TIME_PREF = "browser.safebrowsing.provider.mozilla.nextupdatetime";
var gBlocklistManager = {
_type: "",
_blockLists: [],
_brandShortName : null,
_bundle: null,
_tree: null,
_view: {
_rowCount: 0,
get rowCount() {
return this._rowCount;
},
getCellText: function (row, column) {
if (column.id == "listCol") {
let list = gBlocklistManager._blockLists[row];
let desc = list.description ? list.description : "";
let text = gBlocklistManager._bundle.getFormattedString("mozNameTemplate",
[list.name, desc]);
return text;
}
return "";
},
isSeparator: function(index) { return false; },
isSorted: function() { return false; },
isContainer: function(index) { return false; },
setTree: function(tree) {},
getImageSrc: function(row, column) {},
getProgressMode: function(row, column) {},
getCellValue: function(row, column) {
if (column.id == "selectionCol")
return gBlocklistManager._blockLists[row].selected;
return undefined;
},
cycleHeader: function(column) {},
getRowProperties: function(row) { return ""; },
getColumnProperties: function(column) { return ""; },
getCellProperties: function(row, column) {
if (column.id == "selectionCol") {
return "checkmark";
}
return "";
}
},
onWindowKeyPress: function (event) {
if (event.keyCode == KeyEvent.DOM_VK_ESCAPE) {
window.close();
} else if (event.keyCode == KeyEvent.DOM_VK_RETURN) {
gBlocklistManager.onApplyChanges();
}
},
onLoad: function () {
this._bundle = document.getElementById("bundlePreferences");
let params = window.arguments[0];
this.init(params);
},
init: function (params) {
if (this._type) {
// reusing an open dialog, clear the old observer
this.uninit();
}
this._type = "tracking";
this._brandShortName = params.brandShortName;
let blocklistsText = document.getElementById("blocklistsText");
while (blocklistsText.hasChildNodes()) {
blocklistsText.removeChild(blocklistsText.firstChild);
}
blocklistsText.appendChild(document.createTextNode(params.introText));
document.title = params.windowTitle;
let treecols = document.getElementsByTagName("treecols")[0];
treecols.addEventListener("click", event => {
if (event.target.nodeName != "treecol" || event.button != 0) {
return;
}
});
this._loadBlockLists();
},
uninit: function () {},
onListSelected: function () {
for (let list of this._blockLists) {
list.selected = false;
}
this._blockLists[this._tree.currentIndex].selected = true;
this._updateTree();
},
onApplyChanges: function () {
let activeList = this._getActiveList();
let selected = null;
for (let list of this._blockLists) {
if (list.selected) {
selected = list;
break;
}
}
if (activeList !== selected.id) {
const Cc = Components.classes, Ci = Components.interfaces;
let msg = this._bundle.getFormattedString("blocklistChangeRequiresRestart",
[this._brandShortName]);
let title = this._bundle.getFormattedString("shouldRestartTitle",
[this._brandShortName]);
let shouldProceed = Services.prompt.confirm(window, title, msg);
if (shouldProceed) {
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
.createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(cancelQuit, "quit-application-requested",
"restart");
shouldProceed = !cancelQuit.data;
if (shouldProceed) {
let trackingTable = Services.prefs.getCharPref(TRACKING_TABLE_PREF);
if (selected.id != CONTENT_LIST_ID) {
trackingTable = trackingTable.replace("," + CONTENT_LIST_ID + TRACK_SUFFIX, "");
} else {
trackingTable += "," + CONTENT_LIST_ID + TRACK_SUFFIX;
}
Services.prefs.setCharPref(TRACKING_TABLE_PREF, trackingTable);
Services.prefs.setCharPref(UPDATE_TIME_PREF, 42);
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit |
Ci.nsIAppStartup.eRestart);
}
}
// Don't close the dialog in case we didn't quit.
return;
}
window.close();
},
_loadBlockLists: function () {
this._blockLists = [];
// Load blocklists into a table.
let branch = Services.prefs.getBranch(LISTS_PREF_BRANCH);
let itemArray = branch.getChildList("");
for (let itemName of itemArray) {
try {
this._createOrUpdateBlockList(itemName);
} catch (e) {
// Ignore bogus or missing list name.
continue;
}
}
this._updateTree();
},
_createOrUpdateBlockList: function (itemName) {
let branch = Services.prefs.getBranch(LISTS_PREF_BRANCH);
let key = branch.getCharPref(itemName);
let value = this._bundle.getString(key);
let suffix = itemName.slice(itemName.lastIndexOf("."));
let id = itemName.replace(suffix, "");
let list = this._blockLists.find(el => el.id === id);
if (!list) {
list = { id };
this._blockLists.push(list);
}
list.selected = this._getActiveList() === id;
// Get the property name from the suffix (e.g. ".name" -> "name").
let prop = suffix.slice(1);
list[prop] = value;
return list;
},
_updateTree: function () {
this._tree = document.getElementById("blocklistsTree");
this._view._rowCount = this._blockLists.length;
this._tree.view = this._view;
},
_getActiveList: function () {
let trackingTable = Services.prefs.getCharPref(TRACKING_TABLE_PREF);
return trackingTable.includes(CONTENT_LIST_ID) ? CONTENT_LIST_ID : BASE_LIST_ID;
}
};
function initWithParams(params) {
gBlocklistManager.init(params);
}

View file

@ -1,56 +0,0 @@
<?xml version="1.0"?>
<!-- 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/. -->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
<!DOCTYPE dialog SYSTEM "chrome://browser/locale/preferences/blocklists.dtd" >
<window id="BlocklistsDialog" class="windowDialog"
windowtype="Browser:Blocklists"
title="&window.title;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
style="width: &window.width;;"
onload="gBlocklistManager.onLoad();"
onunload="gBlocklistManager.uninit();"
persist="screenX screenY width height"
onkeypress="gBlocklistManager.onWindowKeyPress(event);">
<script src="chrome://global/content/treeUtils.js"/>
<script src="chrome://browser/content/preferences/blocklists.js"/>
<stringbundle id="bundlePreferences"
src="chrome://browser/locale/preferences/preferences.properties"/>
<keyset>
<key key="&windowClose.key;" modifiers="accel" oncommand="window.close();"/>
</keyset>
<vbox class="contentPane largeDialogContainer" flex="1">
<description id="blocklistsText" control="url"/>
<separator class="thin"/>
<tree id="blocklistsTree" flex="1" style="height: 18em;"
hidecolumnpicker="true"
onselect="gBlocklistManager.onListSelected();">
<treecols>
<treecol id="selectionCol" label="" flex="1" sortable="false"
type="checkbox"/>
<treecol id="listCol" label="&treehead.list.label;" flex="80"
sortable="false"/>
</treecols>
<treechildren/>
</tree>
</vbox>
<vbox>
<spacer flex="1"/>
<hbox class="actionButtons" align="right" flex="1">
<button oncommand="close();" icon="close"
label="&button.cancel.label;" accesskey="&button.cancel.accesskey;" />
<button id="btnApplyChanges" oncommand="gBlocklistManager.onApplyChanges();" icon="save"
label="&button.ok.label;" accesskey="&button.ok.accesskey;"/>
</hbox>
</vbox>
</window>

View file

@ -1,43 +0,0 @@
<?xml version="1.0"?>
<!-- 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/. -->
<?xml-stylesheet href="chrome://global/skin/"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
<!DOCTYPE prefwindow [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % doNotTrackDTD SYSTEM "chrome://browser/locale/preferences/donottrack.dtd">
%brandDTD;
%doNotTrackDTD;
]>
<prefwindow id="DoNotTrackDialog" type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
title="&window.title;"
style="width: &window.width;; height: &window.height;;"
dlgbuttons="accept,cancel">
<prefpane>
<preferences>
<preference id="privacy.donottrackheader.enabled"
name="privacy.donottrackheader.enabled"
type="bool"/>
</preferences>
<hbox align="center" pack="start">
<!-- Work around focus ring not showing properly. -->
<spacer style="width: 1em;"/>
<checkbox label="&doNotTrackCheckbox2.label;"
accesskey="&doNotTrackCheckbox2.accesskey;"
preference="privacy.donottrackheader.enabled"/>
</hbox>
<description flex="1" class="doNotTrackLearnMore">
&doNotTrackTPInfo.description;
<label class="text-link"
value="&doNotTrackLearnMore.label;"
href="https://www.mozilla.org/dnt"/>
</description>
</prefpane>
</prefwindow>

View file

@ -22,37 +22,6 @@ var gPrivacyPane = {
*/
_shouldPromptForRestart: true,
#ifdef MOZ_SAFE_BROWSING
/**
* Show the Tracking Protection UI depending on the
* privacy.trackingprotection.ui.enabled pref, and linkify its Learn More link
*/
_initTrackingProtection: function () {
if (!Services.prefs.getBoolPref("privacy.trackingprotection.ui.enabled")) {
return;
}
let link = document.getElementById("trackingProtectionLearnMore");
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "tracking-protection";
link.setAttribute("href", url);
this.trackingProtectionReadPrefs();
document.getElementById("trackingprotectionbox").hidden = false;
document.getElementById("trackingprotectionpbmbox").hidden = true;
},
/**
* Linkify the Learn More link of the Private Browsing Mode Tracking
* Protection UI.
*/
_initTrackingProtectionPBM: function () {
let link = document.getElementById("trackingProtectionPBMLearnMore");
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "tracking-protection-pbm";
link.setAttribute("href", url);
},
#endif
/**
* Initialize autocomplete to ensure prefs are in sync.
*/
@ -131,10 +100,6 @@ var gPrivacyPane = {
this.updateHistoryModePane();
this.updatePrivacyMicroControls();
this.initAutoStartPrivateBrowsingReverter();
#ifdef MOZ_SAFE_BROWSING
this._initTrackingProtection();
this._initTrackingProtectionPBM();
#endif
this._initAutocomplete();
this._initBrowserContainers();
@ -160,12 +125,6 @@ var gPrivacyPane = {
gPrivacyPane.clearPrivateDataNow(true);
return false;
});
#ifdef MOZ_SAFE_BROWSING
setEventListener("doNotTrackSettings", "click", function () {
gPrivacyPane.showDoNotTrackSettings();
return false;
});
#endif
setEventListener("privateBrowsingAutoStart", "command",
gPrivacyPane.updateAutostart);
setEventListener("cookieExceptions", "command",
@ -174,68 +133,12 @@ var gPrivacyPane = {
gPrivacyPane.showCookies);
setEventListener("clearDataSettings", "command",
gPrivacyPane.showClearPrivateDataSettings);
#ifdef MOZ_SAFE_BROWSING
setEventListener("trackingProtectionRadioGroup", "command",
gPrivacyPane.trackingProtectionWritePrefs);
setEventListener("trackingProtectionExceptions", "command",
gPrivacyPane.showTrackingProtectionExceptions);
setEventListener("changeBlockList", "command",
gPrivacyPane.showBlockLists);
setEventListener("changeBlockListPBM", "command",
gPrivacyPane.showBlockLists);
#endif
setEventListener("browserContainersCheckbox", "command",
gPrivacyPane._checkBrowserContainers);
setEventListener("browserContainersSettings", "command",
gPrivacyPane.showContainerSettings);
},
#ifdef MOZ_SAFE_BROWSING
// TRACKING PROTECTION MODE
/**
* Selects the right item of the Tracking Protection radiogroup.
*/
trackingProtectionReadPrefs() {
let enabledPref = document.getElementById("privacy.trackingprotection.enabled");
let pbmPref = document.getElementById("privacy.trackingprotection.pbmode.enabled");
let radiogroup = document.getElementById("trackingProtectionRadioGroup");
// Global enable takes precedence over enabled in Private Browsing.
if (enabledPref.value) {
radiogroup.value = "always";
} else if (pbmPref.value) {
radiogroup.value = "private";
} else {
radiogroup.value = "never";
}
},
/**
* Sets the pref values based on the selected item of the radiogroup.
*/
trackingProtectionWritePrefs() {
let enabledPref = document.getElementById("privacy.trackingprotection.enabled");
let pbmPref = document.getElementById("privacy.trackingprotection.pbmode.enabled");
let radiogroup = document.getElementById("trackingProtectionRadioGroup");
switch (radiogroup.value) {
case "always":
enabledPref.value = true;
pbmPref.value = true;
break;
case "private":
enabledPref.value = false;
pbmPref.value = true;
break;
case "never":
enabledPref.value = false;
pbmPref.value = false;
break;
}
},
#endif
// HISTORY MODE
/**
@ -472,23 +375,6 @@ var gPrivacyPane = {
this._shouldPromptForRestart = true;
},
#ifdef MOZ_SAFE_BROWSING
/**
* Displays fine-grained, per-site preferences for tracking protection.
*/
showTrackingProtectionExceptions() {
let bundlePreferences = document.getElementById("bundlePreferences");
let params = {
permissionType: "trackingprotection",
hideStatusColumn: true,
windowTitle: bundlePreferences.getString("trackingprotectionpermissionstitle"),
introText: bundlePreferences.getString("trackingprotectionpermissionstext"),
};
gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
null, params);
},
#endif
/**
* Displays container panel for customising and adding containers.
*/
@ -496,31 +382,6 @@ var gPrivacyPane = {
gotoPref("containers");
},
#ifdef MOZ_SAFE_BROWSING
/**
* Displays the available block lists for tracking protection.
*/
showBlockLists: function ()
{
var bundlePreferences = document.getElementById("bundlePreferences");
let brandName = document.getElementById("bundleBrand")
.getString("brandShortName");
var params = { brandShortName: brandName,
windowTitle: bundlePreferences.getString("blockliststitle"),
introText: bundlePreferences.getString("blockliststext") };
gSubDialog.open("chrome://browser/content/preferences/blocklists.xul",
null, params);
},
/**
* Displays the Do Not Track settings dialog.
*/
showDoNotTrackSettings() {
gSubDialog.open("chrome://browser/content/preferences/donottrack.xul",
"resizable=no");
},
#endif
// HISTORY
/*

View file

@ -10,18 +10,9 @@
<preferences id="privacyPreferences" hidden="true" data-category="panePrivacy">
<!-- Tracking -->
#ifdef MOZ_SAFE_BROWSING
<preference id="privacy.trackingprotection.enabled"
name="privacy.trackingprotection.enabled"
type="bool"/>
<preference id="privacy.trackingprotection.pbmode.enabled"
name="privacy.trackingprotection.pbmode.enabled"
type="bool"/>
#else
<preference id="privacy.donottrackheader.enabled"
name="privacy.donottrackheader.enabled"
type="bool"/>
#endif
<!-- XXX button prefs -->
<preference id="pref.privacy.disable_button.cookie_exceptions"
@ -91,61 +82,6 @@
<!-- Tracking -->
<groupbox id="trackingGroup" data-category="panePrivacy" hidden="true">
#ifdef MOZ_SAFE_BROWSING
<vbox id="trackingprotectionbox" hidden="true">
<hbox align="start">
<vbox>
<caption><label>&trackingProtectionHeader.label;
<label id="trackingProtectionLearnMore" class="text-link"
value="&trackingProtectionLearnMore.label;"/>
</label></caption>
<radiogroup id="trackingProtectionRadioGroup">
<radio value="always"
label="&trackingProtectionAlways.label;"
accesskey="&trackingProtectionAlways.accesskey;"/>
<radio value="private"
label="&trackingProtectionPrivate.label;"
accesskey="&trackingProtectionPrivate.accesskey;"/>
<radio value="never"
label="&trackingProtectionNever.label;"
accesskey="&trackingProtectionNever.accesskey;"/>
</radiogroup>
</vbox>
<spacer flex="1" />
<vbox>
<button id="trackingProtectionExceptions"
label="&trackingProtectionExceptions.label;"
accesskey="&trackingProtectionExceptions.accesskey;"
preference="pref.privacy.disable_button.tracking_protection_exceptions"/>
<button id="changeBlockList"
label="&changeBlockList.label;"
accesskey="&changeBlockList.accesskey;"
preference="pref.privacy.disable_button.change_blocklist"/>
</vbox>
</hbox>
</vbox>
<vbox id="trackingprotectionpbmbox">
<caption><label>&tracking.label;</label></caption>
<hbox align="center">
<checkbox id="trackingProtectionPBM"
preference="privacy.trackingprotection.pbmode.enabled"
accesskey="&trackingProtectionPBM5.accesskey;"
label="&trackingProtectionPBM5.label;" />
<label id="trackingProtectionPBMLearnMore"
class="text-link"
value="&trackingProtectionPBMLearnMore.label;"/>
<spacer flex="1" />
<button id="changeBlockListPBM"
label="&changeBlockList.label;" accesskey="&changeBlockList.accesskey;"
preference="pref.privacy.disable_button.change_blocklist"/>
</hbox>
</vbox>
<vbox>
<description>&doNotTrack.pre.label;<label
class="text-link" id="doNotTrackSettings"
>&doNotTrack.settings.label;</label>&doNotTrack.post.label;</description>
</vbox>
#else
<vbox id="donottrackbox">
<caption><label>&tracking.label;</label></caption>
<hbox align="center">
@ -158,7 +94,6 @@
href="https://www.mozilla.org/dnt"/>
</hbox>
</vbox>
#endif
</groupbox>
<!-- History -->

View file

@ -23,9 +23,6 @@ var gSecurityPane = {
this._pane = document.getElementById("paneSecurity");
this._initMasterPasswordUI();
#ifdef MOZ_SAFE_BROWSING
this._initSafeBrowsing();
#endif
setEventListener("addonExceptions", "command",
gSecurityPane.showAddonExceptions);
@ -162,81 +159,6 @@ var gSecurityPane = {
checkbox.checked = !noMP;
},
#ifdef MOZ_SAFE_BROWSING
_initSafeBrowsing() {
let enableSafeBrowsing = document.getElementById("enableSafeBrowsing");
let blockDownloads = document.getElementById("blockDownloads");
let blockUncommonUnwanted = document.getElementById("blockUncommonUnwanted");
let safeBrowsingPhishingPref = document.getElementById("browser.safebrowsing.phishing.enabled");
let safeBrowsingMalwarePref = document.getElementById("browser.safebrowsing.malware.enabled");
let blockDownloadsPref = document.getElementById("browser.safebrowsing.downloads.enabled");
let malwareTable = document.getElementById("urlclassifier.malwareTable");
let blockUnwantedPref = document.getElementById("browser.safebrowsing.downloads.remote.block_potentially_unwanted");
let blockUncommonPref = document.getElementById("browser.safebrowsing.downloads.remote.block_uncommon");
enableSafeBrowsing.addEventListener("command", function() {
safeBrowsingPhishingPref.value = enableSafeBrowsing.checked;
safeBrowsingMalwarePref.value = enableSafeBrowsing.checked;
if (enableSafeBrowsing.checked) {
blockDownloads.removeAttribute("disabled");
if (blockDownloads.checked) {
blockUncommonUnwanted.removeAttribute("disabled");
}
} else {
blockDownloads.setAttribute("disabled", "true");
blockUncommonUnwanted.setAttribute("disabled", "true");
}
});
blockDownloads.addEventListener("command", function() {
blockDownloadsPref.value = blockDownloads.checked;
if (blockDownloads.checked) {
blockUncommonUnwanted.removeAttribute("disabled");
} else {
blockUncommonUnwanted.setAttribute("disabled", "true");
}
});
blockUncommonUnwanted.addEventListener("command", function() {
blockUnwantedPref.value = blockUncommonUnwanted.checked;
blockUncommonPref.value = blockUncommonUnwanted.checked;
let malware = malwareTable.value
.split(",")
.filter(x => x !== "goog-unwanted-shavar" && x !== "test-unwanted-simple");
if (blockUncommonUnwanted.checked) {
malware.push("goog-unwanted-shavar");
malware.push("test-unwanted-simple");
}
// sort alphabetically to keep the pref consistent
malware.sort();
malwareTable.value = malware.join(",");
});
// set initial values
enableSafeBrowsing.checked = safeBrowsingPhishingPref.value && safeBrowsingMalwarePref.value;
if (!enableSafeBrowsing.checked) {
blockDownloads.setAttribute("disabled", "true");
blockUncommonUnwanted.setAttribute("disabled", "true");
}
blockDownloads.checked = blockDownloadsPref.value;
if (!blockDownloadsPref.value) {
blockUncommonUnwanted.setAttribute("disabled", "true");
}
blockUncommonUnwanted.checked = blockUnwantedPref.value && blockUncommonPref.value;
},
#endif
/**
* Enables/disables the master password button depending on the state of the
* "use master password" checkbox, and prompts for master password removal if

View file

@ -21,31 +21,6 @@
name="xpinstall.whitelist.required"
type="bool"/>
#ifdef MOZ_SAFE_BROWSING
<!-- Malware, phishing -->
<preference id="browser.safebrowsing.malware.enabled"
name="browser.safebrowsing.malware.enabled"
type="bool"/>
<preference id="browser.safebrowsing.phishing.enabled"
name="browser.safebrowsing.phishing.enabled"
type="bool"/>
<preference id="browser.safebrowsing.downloads.enabled"
name="browser.safebrowsing.downloads.enabled"
type="bool"/>
<preference id="urlclassifier.malwareTable"
name="urlclassifier.malwareTable"
type="string"/>
<preference id="browser.safebrowsing.downloads.remote.block_potentially_unwanted"
name="browser.safebrowsing.downloads.remote.block_potentially_unwanted"
type="bool"/>
<preference id="browser.safebrowsing.downloads.remote.block_uncommon"
name="browser.safebrowsing.downloads.remote.block_uncommon"
type="bool"/>
#endif
<!-- Passwords -->
<preference id="signon.rememberSignons" name="signon.rememberSignons" type="bool"/>
<preference id="signon.autofillForms" name="signon.autofillForms" type="bool"/>
@ -76,23 +51,6 @@
accesskey="&addonExceptions.accesskey;"/>
</hbox>
#ifdef MOZ_SAFE_BROWSING
<!-- Safebrowsing (phishing) UI -->
<separator class="thin"/>
<vbox align="start">
<checkbox id="enableSafeBrowsing"
label="&enableSafeBrowsing.label;"
accesskey="&enableSafeBrowsing.accesskey;" />
<vbox class="indent">
<checkbox id="blockDownloads"
label="&blockDownloads.label;"
accesskey="&blockDownloads.accesskey;" />
<checkbox id="blockUncommonUnwanted"
label="&blockUncommonUnwanted.label;"
accesskey="&blockUncommonUnwanted.accesskey;" />
</vbox>
</vbox>
#endif
</groupbox>
<!-- Passwords -->

View file

@ -5,18 +5,11 @@
browser.jar:
content/browser/preferences/applicationManager.xul
content/browser/preferences/applicationManager.js
#ifdef MOZ_SAFE_BROWSING
content/browser/preferences/blocklists.xul
content/browser/preferences/blocklists.js
#endif
* content/browser/preferences/colors.xul
* content/browser/preferences/cookies.xul
content/browser/preferences/cookies.js
* content/browser/preferences/connection.xul
content/browser/preferences/connection.js
#ifdef MOZ_SAFE_BROWSING
content/browser/preferences/donottrack.xul
#endif
* content/browser/preferences/fonts.xul
content/browser/preferences/fonts.js
content/browser/preferences/handlers.xml

View file

@ -14,32 +14,6 @@ const FAVICON_PRIVACY = "chrome://browser/skin/privatebrowsing/favicon.svg";
var stringBundle = Services.strings.createBundle(
"chrome://browser/locale/aboutPrivateBrowsing.properties");
#ifdef MOZ_SAFE_BROWSING
var prefBranch = Services.prefs.getBranch("privacy.trackingprotection.");
var prefObserver = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
Ci.nsISupportsWeakReference]),
observe: function () {
let tpSubHeader = document.getElementById("tpSubHeader");
let tpToggle = document.getElementById("tpToggle");
let tpButton = document.getElementById("tpButton");
let title = document.getElementById("title");
let titleTracking = document.getElementById("titleTracking");
let globalTrackingEnabled = prefBranch.getBoolPref("enabled");
let trackingEnabled = globalTrackingEnabled ||
prefBranch.getBoolPref("pbmode.enabled");
tpButton.classList.toggle("hide", globalTrackingEnabled);
tpToggle.checked = trackingEnabled;
title.classList.toggle("hide", trackingEnabled);
titleTracking.classList.toggle("hide", !trackingEnabled);
tpSubHeader.classList.toggle("tp-off", !trackingEnabled);
}
};
prefBranch.addObserver("pbmode.enabled", prefObserver, true);
prefBranch.addObserver("enabled", prefObserver, true);
#endif
function setFavIcon(url) {
document.getElementById("favicon").setAttribute("href", url);
}
@ -56,29 +30,15 @@ document.addEventListener("DOMContentLoaded", function () {
return;
}
#ifdef MOZ_SAFE_BROWSING
let tpToggle = document.getElementById("tpToggle");
document.getElementById("tpButton").addEventListener('click', () => {
tpToggle.click();
});
#endif
document.title = stringBundle.GetStringFromName("title.head");
document.getElementById("favicon")
.setAttribute("href", FAVICON_PRIVACY);
#ifdef MOZ_SAFE_BROWSING
tpToggle.addEventListener("change", toggleTrackingProtection);
#endif
let formatURLPref = Cc["@mozilla.org/toolkit/URLFormatterService;1"]
.getService(Ci.nsIURLFormatter).formatURLPref;
document.getElementById("learnMore").setAttribute("href",
formatURLPref("app.support.baseURL") + "private-browsing");
#ifdef MOZ_SAFE_BROWSING
// Update state that depends on preferences.
prefObserver.observe();
#endif
}, false);
function openPrivateWindow() {
@ -87,11 +47,3 @@ function openPrivateWindow() {
new CustomEvent("AboutPrivateBrowsingOpenWindow", {bubbles:true}));
}
#ifdef MOZ_SAFE_BROWSING
function toggleTrackingProtection() {
// Ask chrome to enable tracking protection
document.dispatchEvent(
new CustomEvent("AboutPrivateBrowsingToggleTrackingProtection",
{bubbles: true}));
}
#endif

View file

@ -35,9 +35,6 @@
<div class="showPrivate about-content-container">
<h1 class="title">
<span id="title">&privateBrowsing.title;</span>
#ifdef MOZ_SAFE_BROWSING
<span id="titleTracking">&privateBrowsing.title.tracking;</span>
#endif
</h1>
<section class="section-main">
<p>&aboutPrivateBrowsing.info.notsaved.before;<strong>&aboutPrivateBrowsing.info.notsaved.emphasize;</strong>&aboutPrivateBrowsing.info.notsaved.after;</p>
@ -63,18 +60,6 @@
</p>
</section>
#ifdef MOZ_SAFE_BROWSING
<h2 id="tpSubHeader" class="about-subheader">
<span class="tpTitle">&trackingProtection.title;</span>
<input id="tpToggle" class="toggle toggle-input" type="checkbox"/>
<span id="tpButton" class="toggle-btn"></span>
</h2>
<section class="section-main">
<p>&trackingProtection.description2;</p>
</section>
#endif
<section class="section-main">
<p class="about-info">&aboutPrivateBrowsing.learnMore2;
<a id="learnMore" target="_blank">&aboutPrivateBrowsing.learnMore2.title;</a>.