Browse Source
rev fd0439a5...(this-commit) are based on basilisk-2021.11.13-source.tar.xz, and basilisk-2021.11.14-source.tar.xz reverted most of changes.basilisk-20211113
36 changed files with 0 additions and 1394 deletions
@ -1,196 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
||||
<!DOCTYPE html [ |
||||
<!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> |
||||
%htmlDTD; |
||||
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd"> |
||||
%globalDTD; |
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" > |
||||
%brandDTD; |
||||
<!ENTITY % blockedSiteDTD SYSTEM "chrome://browser/locale/safebrowsing/phishing-afterload-warning-message.dtd"> |
||||
%blockedSiteDTD; |
||||
]> |
||||
|
||||
<!-- 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/. --> |
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" class="blacklist"> |
||||
<head> |
||||
<link rel="stylesheet" href="chrome://browser/skin/blockedSite.css" type="text/css" media="all" /> |
||||
<link rel="icon" type="image/png" id="favicon" href="chrome://global/skin/icons/blacklist_favicon.png"/> |
||||
|
||||
<script type="application/javascript"><![CDATA[ |
||||
// Error url MUST be formatted like this: |
||||
// about:blocked?e=error_code&u=url(&o=1)? |
||||
// (o=1 when user overrides are allowed) |
||||
|
||||
// Note that this file uses document.documentURI to get |
||||
// the URL (with the format from above). This is because |
||||
// document.location.href gets the current URI off the docshell, |
||||
// which is the URL displayed in the location bar, i.e. |
||||
// the URI that the user attempted to load. |
||||
|
||||
function getErrorCode() |
||||
{ |
||||
var url = document.documentURI; |
||||
var error = url.search(/e\=/); |
||||
var duffUrl = url.search(/\&u\=/); |
||||
return decodeURIComponent(url.slice(error + 2, duffUrl)); |
||||
} |
||||
|
||||
function getURL() |
||||
{ |
||||
var url = document.documentURI; |
||||
var match = url.match(/&u=([^&]+)&/); |
||||
|
||||
// match == null if not found; if so, return an empty string |
||||
// instead of what would turn out to be portions of the URI |
||||
if (!match) |
||||
return ""; |
||||
|
||||
url = decodeURIComponent(match[1]); |
||||
|
||||
// If this is a view-source page, then get then real URI of the page |
||||
if (url.startsWith("view-source:")) |
||||
url = url.slice(12); |
||||
return url; |
||||
} |
||||
|
||||
/** |
||||
* Check whether this warning page should be overridable or whether |
||||
* the "ignore warning" button should be hidden. |
||||
*/ |
||||
function getOverride() |
||||
{ |
||||
var url = document.documentURI; |
||||
var match = url.match(/&o=1&/); |
||||
return !!match; |
||||
} |
||||
|
||||
/** |
||||
* Attempt to get the hostname via document.location. Fail back |
||||
* to getURL so that we always return something meaningful. |
||||
*/ |
||||
function getHostString() |
||||
{ |
||||
try { |
||||
return document.location.hostname; |
||||
} catch (e) { |
||||
return getURL(); |
||||
} |
||||
} |
||||
|
||||
function initPage() |
||||
{ |
||||
var error = ""; |
||||
switch (getErrorCode()) { |
||||
case "malwareBlocked" : |
||||
error = "malware"; |
||||
break; |
||||
case "deceptiveBlocked" : |
||||
error = "phishing"; |
||||
break; |
||||
case "unwantedBlocked" : |
||||
error = "unwanted"; |
||||
break; |
||||
default: |
||||
return; |
||||
} |
||||
|
||||
var el; |
||||
|
||||
if (error !== "malware") { |
||||
el = document.getElementById("errorTitleText_malware"); |
||||
el.parentNode.removeChild(el); |
||||
el = document.getElementById("errorShortDescText_malware"); |
||||
el.parentNode.removeChild(el); |
||||
el = document.getElementById("errorLongDescText_malware"); |
||||
el.parentNode.removeChild(el); |
||||
} |
||||
|
||||
if (error !== "phishing") { |
||||
el = document.getElementById("errorTitleText_phishing"); |
||||
el.parentNode.removeChild(el); |
||||
el = document.getElementById("errorShortDescText_phishing"); |
||||
el.parentNode.removeChild(el); |
||||
el = document.getElementById("errorLongDescText_phishing"); |
||||
el.parentNode.removeChild(el); |
||||
} |
||||
|
||||
if (error !== "unwanted") { |
||||
el = document.getElementById("errorTitleText_unwanted"); |
||||
el.parentNode.removeChild(el); |
||||
el = document.getElementById("errorShortDescText_unwanted"); |
||||
el.parentNode.removeChild(el); |
||||
el = document.getElementById("errorLongDescText_unwanted"); |
||||
el.parentNode.removeChild(el); |
||||
} |
||||
|
||||
// Set sitename |
||||
document.getElementById(error + "_sitename").textContent = getHostString(); |
||||
document.title = document.getElementById("errorTitleText_" + error) |
||||
.innerHTML; |
||||
|
||||
if (!getOverride()) { |
||||
var btn = document.getElementById("ignoreWarningButton"); |
||||
if (btn) { |
||||
btn.parentNode.removeChild(btn); |
||||
} |
||||
} |
||||
|
||||
// Inform the test harness that we're done loading the page |
||||
var event = new CustomEvent("AboutBlockedLoaded"); |
||||
document.dispatchEvent(event); |
||||
} |
||||
]]></script> |
||||
</head> |
||||
|
||||
<body dir="&locale.dir;"> |
||||
<div id="errorPageContainer" class="container"> |
||||
|
||||
<!-- Error Title --> |
||||
<div id="errorTitle" class="title"> |
||||
<h1 class="title-text" id="errorTitleText_phishing">&safeb.blocked.phishingPage.title2;</h1> |
||||
<h1 class="title-text" id="errorTitleText_malware">&safeb.blocked.malwarePage.title;</h1> |
||||
<h1 class="title-text" id="errorTitleText_unwanted">&safeb.blocked.unwantedPage.title;</h1> |
||||
</div> |
||||
|
||||
<div id="errorLongContent"> |
||||
|
||||
<!-- Short Description --> |
||||
<div id="errorShortDesc"> |
||||
<p id="errorShortDescText_phishing">&safeb.blocked.phishingPage.shortDesc2;</p> |
||||
<p id="errorShortDescText_malware">&safeb.blocked.malwarePage.shortDesc;</p> |
||||
<p id="errorShortDescText_unwanted">&safeb.blocked.unwantedPage.shortDesc;</p> |
||||
</div> |
||||
|
||||
<!-- Long Description --> |
||||
<div id="errorLongDesc"> |
||||
<p id="errorLongDescText_phishing">&safeb.blocked.phishingPage.longDesc2;</p> |
||||
<p id="errorLongDescText_malware">&safeb.blocked.malwarePage.longDesc;</p> |
||||
<p id="errorLongDescText_unwanted">&safeb.blocked.unwantedPage.longDesc;</p> |
||||
</div> |
||||
|
||||
<!-- Action buttons --> |
||||
<div id="buttons" class="button-container"> |
||||
<!-- Commands handled in browser.js --> |
||||
<button id="getMeOutButton" class="primary">&safeb.palm.accept.label;</button> |
||||
<div class="button-spacer"></div> |
||||
<button id="reportButton">&safeb.palm.reportPage.label;</button> |
||||
</div> |
||||
</div> |
||||
<div id="ignoreWarning"> |
||||
<button id="ignoreWarningButton">&safeb.palm.decline.label;</button> |
||||
</div> |
||||
</div> |
||||
<!-- |
||||
- Note: It is important to run the script this way, instead of using |
||||
- an onload handler. This is because error pages are loaded as |
||||
- LOAD_BACKGROUND, which means that onload handlers will not be executed. |
||||
--> |
||||
<script type="application/javascript"> |
||||
initPage(); |
||||
</script> |
||||
</body> |
||||
</html> |
@ -1,48 +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/. */
|
||||
|
||||
var gSafeBrowsing = { |
||||
|
||||
setReportPhishingMenu: function() { |
||||
// In order to detect whether or not we're at the phishing warning
|
||||
// page, we have to check the documentURI instead of the currentURI.
|
||||
// This is because when the DocShell loads an error page, the
|
||||
// currentURI stays at the original target, while the documentURI
|
||||
// will point to the internal error page we loaded instead.
|
||||
var docURI = gBrowser.selectedBrowser.documentURI; |
||||
var isPhishingPage = |
||||
docURI && docURI.spec.startsWith("about:blocked?e=deceptiveBlocked"); |
||||
|
||||
// Show/hide the appropriate menu item.
|
||||
document.getElementById("menu_HelpPopup_reportPhishingtoolmenu") |
||||
.hidden = isPhishingPage; |
||||
document.getElementById("menu_HelpPopup_reportPhishingErrortoolmenu") |
||||
.hidden = !isPhishingPage; |
||||
|
||||
var broadcasterId = isPhishingPage |
||||
? "reportPhishingErrorBroadcaster" |
||||
: "reportPhishingBroadcaster"; |
||||
|
||||
var broadcaster = document.getElementById(broadcasterId); |
||||
if (!broadcaster) |
||||
return; |
||||
|
||||
// Now look at the currentURI to learn which page we were trying
|
||||
// to browse to.
|
||||
let uri = gBrowser.currentURI; |
||||
if (uri && (uri.schemeIs("http") || uri.schemeIs("https"))) |
||||
broadcaster.removeAttribute("disabled"); |
||||
else |
||||
broadcaster.setAttribute("disabled", true); |
||||
}, |
||||
|
||||
/** |
||||
* Used to report a phishing page or a false positive |
||||
* @param name String One of "Phish", "Error", "Malware" or "MalwareError" |
||||
* @return String the report phishing URL. |
||||
*/ |
||||
getReportURL: function(name) { |
||||
return SafeBrowsing.getReportURL(name, gBrowser.currentURI); |
||||
} |
||||
} |
@ -1,130 +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/. */
|
||||
|
||||
var TrackingProtection = { |
||||
// If the user ignores the doorhanger, we stop showing it after some time.
|
||||
PREF_ENABLED_GLOBALLY: "privacy.trackingprotection.enabled", |
||||
PREF_ENABLED_IN_PRIVATE_WINDOWS: "privacy.trackingprotection.pbmode.enabled", |
||||
enabledGlobally: false, |
||||
enabledInPrivateWindows: false, |
||||
container: null, |
||||
content: null, |
||||
icon: null, |
||||
activeTooltipText: null, |
||||
disabledTooltipText: null, |
||||
|
||||
init() { |
||||
let $ = selector => document.querySelector(selector); |
||||
this.container = $("#tracking-protection-container"); |
||||
this.content = $("#tracking-protection-content"); |
||||
this.icon = $("#tracking-protection-icon"); |
||||
|
||||
this.updateEnabled(); |
||||
Services.prefs.addObserver(this.PREF_ENABLED_GLOBALLY, this, false); |
||||
Services.prefs.addObserver(this.PREF_ENABLED_IN_PRIVATE_WINDOWS, this, false); |
||||
|
||||
this.activeTooltipText = |
||||
gNavigatorBundle.getString("trackingProtection.icon.activeTooltip"); |
||||
this.disabledTooltipText = |
||||
gNavigatorBundle.getString("trackingProtection.icon.disabledTooltip"); |
||||
}, |
||||
|
||||
uninit() { |
||||
Services.prefs.removeObserver(this.PREF_ENABLED_GLOBALLY, this); |
||||
Services.prefs.removeObserver(this.PREF_ENABLED_IN_PRIVATE_WINDOWS, this); |
||||
}, |
||||
|
||||
observe() { |
||||
this.updateEnabled(); |
||||
}, |
||||
|
||||
get enabled() { |
||||
return this.enabledGlobally || |
||||
(this.enabledInPrivateWindows && |
||||
PrivateBrowsingUtils.isWindowPrivate(window)); |
||||
}, |
||||
|
||||
updateEnabled() { |
||||
this.enabledGlobally = |
||||
Services.prefs.getBoolPref(this.PREF_ENABLED_GLOBALLY); |
||||
this.enabledInPrivateWindows = |
||||
Services.prefs.getBoolPref(this.PREF_ENABLED_IN_PRIVATE_WINDOWS); |
||||
this.container.hidden = !this.enabled; |
||||
}, |
||||
|
||||
onSecurityChange(state, isSimulated) { |
||||
if (!this.enabled) { |
||||
return; |
||||
} |
||||
|
||||
// Only animate the shield if the event was not fired directly from
|
||||
// the tabbrowser (due to a browser change).
|
||||
if (isSimulated) { |
||||
this.icon.removeAttribute("animate"); |
||||
} else { |
||||
this.icon.setAttribute("animate", "true"); |
||||
} |
||||
|
||||
let isBlocking = state & Ci.nsIWebProgressListener.STATE_BLOCKED_TRACKING_CONTENT; |
||||
let isAllowing = state & Ci.nsIWebProgressListener.STATE_LOADED_TRACKING_CONTENT; |
||||
|
||||
if (isBlocking) { |
||||
this.icon.setAttribute("tooltiptext", this.activeTooltipText); |
||||
this.icon.setAttribute("state", "blocked-tracking-content"); |
||||
this.content.setAttribute("state", "blocked-tracking-content"); |
||||
} else if (isAllowing) { |
||||
this.icon.setAttribute("tooltiptext", this.disabledTooltipText); |
||||
this.icon.setAttribute("state", "loaded-tracking-content"); |
||||
this.content.setAttribute("state", "loaded-tracking-content"); |
||||
} else { |
||||
this.icon.removeAttribute("tooltiptext"); |
||||
this.icon.removeAttribute("state"); |
||||
this.content.removeAttribute("state"); |
||||
} |
||||
}, |
||||
|
||||
disableForCurrentPage() { |
||||
// Convert document URI into the format used by
|
||||
// nsChannelClassifier::ShouldEnableTrackingProtection.
|
||||
// Any scheme turned into https is correct.
|
||||
let normalizedUrl = Services.io.newURI( |
||||
"https://" + gBrowser.selectedBrowser.currentURI.hostPort, |
||||
null, null); |
||||
|
||||
// Add the current host in the 'trackingprotection' consumer of
|
||||
// the permission manager using a normalized URI. This effectively
|
||||
// places this host on the tracking protection allowlist.
|
||||
if (PrivateBrowsingUtils.isBrowserPrivate(gBrowser.selectedBrowser)) { |
||||
PrivateBrowsingUtils.addToTrackingAllowlist(normalizedUrl); |
||||
} else { |
||||
Services.perms.add(normalizedUrl, |
||||
"trackingprotection", Services.perms.ALLOW_ACTION); |
||||
} |
||||
|
||||
// Hide the control center.
|
||||
document.getElementById("identity-popup").hidePopup(); |
||||
|
||||
BrowserReload(); |
||||
}, |
||||
|
||||
enableForCurrentPage() { |
||||
// Remove the current host from the 'trackingprotection' consumer
|
||||
// of the permission manager. This effectively removes this host
|
||||
// from the tracking protection allowlist.
|
||||
let normalizedUrl = Services.io.newURI( |
||||
"https://" + gBrowser.selectedBrowser.currentURI.hostPort, |
||||
null, null); |
||||
|
||||
if (PrivateBrowsingUtils.isBrowserPrivate(gBrowser.selectedBrowser)) { |
||||
PrivateBrowsingUtils.removeFromTrackingAllowlist(normalizedUrl); |
||||
} else { |
||||
Services.perms.remove(normalizedUrl, "trackingprotection"); |
||||
} |
||||
|
||||
// Hide the control center.
|
||||
document.getElementById("identity-popup").hidePopup(); |
||||
|
||||
BrowserReload(); |
||||
}, |
||||
}; |
@ -1,35 +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/. --> |
||||
|
||||
<!DOCTYPE overlay [ |
||||
<!ENTITY % reportphishDTD SYSTEM "chrome://browser/locale/safebrowsing/report-phishing.dtd"> |
||||
%reportphishDTD; |
||||
<!ENTITY % safebrowsingDTD SYSTEM "chrome://browser/locale/safebrowsing/phishing-afterload-warning-message.dtd"> |
||||
%safebrowsingDTD; |
||||
]> |
||||
|
||||
<overlay id="reportPhishingMenuOverlay" |
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
||||
<broadcasterset id="mainBroadcasterSet"> |
||||
<broadcaster id="reportPhishingBroadcaster" disabled="true"/> |
||||
<broadcaster id="reportPhishingErrorBroadcaster" disabled="true"/> |
||||
</broadcasterset> |
||||
<menupopup id="menu_HelpPopup"> |
||||
<menuitem id="menu_HelpPopup_reportPhishingtoolmenu" |
||||
label="&reportDeceptiveSiteMenu.title;" |
||||
accesskey="&reportDeceptiveSiteMenu.accesskey;" |
||||
insertbefore="aboutSeparator" |
||||
observes="reportPhishingBroadcaster" |
||||
oncommand="openUILink(gSafeBrowsing.getReportURL('Phish'), event);" |
||||
onclick="checkForMiddleClick(this, event);"/> |
||||
<menuitem id="menu_HelpPopup_reportPhishingErrortoolmenu" |
||||
label="&safeb.palm.notdeceptive.label;" |
||||
accesskey="&safeb.palm.notdeceptive.accesskey;" |
||||
insertbefore="aboutSeparator" |
||||
observes="reportPhishingErrorBroadcaster" |
||||
oncommand="openUILinkIn(gSafeBrowsing.getReportURL('PhishMistake'), 'tab');" |
||||
onclick="checkForMiddleClick(this, event);"/> |
||||
</menupopup> |
||||
</overlay> |
@ -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); |
||||
} |
@ -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> |
@ -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> |