Browse Source

[Basilisk] remove safe browsing, tracking protection, do not track

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.
roytam1 2 months ago
parent
commit
1ea1399284
  1. 12
      basilisk/app/profile/basilisk.js
  2. 196
      basilisk/base/content/blockedSite.xhtml
  3. 4
      basilisk/base/content/browser-doctype.inc
  4. 48
      basilisk/base/content/browser-safebrowsing.js
  5. 130
      basilisk/base/content/browser-trackingprotection.js
  6. 20
      basilisk/base/content/browser.js
  7. 4
      basilisk/base/content/global-scripts.inc
  8. 35
      basilisk/base/content/report-phishing-overlay.xul
  9. 5
      basilisk/base/content/tab-content.js
  10. 9
      basilisk/base/jar.mn
  11. 9
      basilisk/components/about/AboutRedirector.cpp
  12. 3
      basilisk/components/build/nsModule.cpp
  13. 31
      basilisk/components/controlcenter/content/panel.inc.xul
  14. 209
      basilisk/components/preferences/blocklists.js
  15. 56
      basilisk/components/preferences/blocklists.xul
  16. 43
      basilisk/components/preferences/donottrack.xul
  17. 139
      basilisk/components/preferences/in-content/privacy.js
  18. 65
      basilisk/components/preferences/in-content/privacy.xul
  19. 78
      basilisk/components/preferences/in-content/security.js
  20. 42
      basilisk/components/preferences/in-content/security.xul
  21. 7
      basilisk/components/preferences/jar.mn
  22. 48
      basilisk/components/privatebrowsing/content/aboutPrivateBrowsing.js
  23. 15
      basilisk/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml
  24. 1
      basilisk/confvars.sh
  25. 10
      basilisk/installer/package-manifest.in
  26. 4
      basilisk/locales/en-US/chrome/browser/aboutPrivateBrowsing.dtd
  27. 27
      basilisk/locales/en-US/chrome/browser/browser.dtd
  28. 3
      basilisk/locales/en-US/chrome/browser/browser.properties
  29. 13
      basilisk/locales/en-US/chrome/browser/preferences/donottrack.dtd
  30. 2
      basilisk/locales/en-US/chrome/browser/preferences/preferences.properties
  31. 25
      basilisk/locales/en-US/chrome/browser/preferences/privacy.dtd
  32. 32
      basilisk/locales/en-US/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd
  33. 13
      basilisk/locales/en-US/chrome/browser/safebrowsing/report-phishing.dtd
  34. 15
      basilisk/locales/jar.mn
  35. 7
      basilisk/themes/shared/incontentprefs/preferences.inc.css
  36. 34
      basilisk/tools/mozscreenshots/mozscreenshots/extension/configurations/ControlCenter.jsm

12
basilisk/app/profile/basilisk.js

@ -943,10 +943,6 @@ pref("services.sync.prefs.sync.browser.link.open_newwindow", true);
pref("services.sync.prefs.sync.browser.newtabpage.enabled", true);
pref("services.sync.prefs.sync.browser.newtabpage.pinned", true);
pref("services.sync.prefs.sync.browser.offline-apps.notify", true);
#ifdef MOZ_SAFE_BROWSING
pref("services.sync.prefs.sync.browser.safebrowsing.phishing.enabled", true);
pref("services.sync.prefs.sync.browser.safebrowsing.malware.enabled", true);
#endif
pref("services.sync.prefs.sync.browser.search.update", true);
pref("services.sync.prefs.sync.browser.sessionstore.restore_on_demand", true);
pref("services.sync.prefs.sync.browser.startup.homepage", true);
@ -991,8 +987,6 @@ pref("services.sync.prefs.sync.privacy.clearOnShutdown.sessions", true);
pref("services.sync.prefs.sync.privacy.clearOnShutdown.siteSettings", true);
pref("services.sync.prefs.sync.privacy.donottrackheader.enabled", true);
pref("services.sync.prefs.sync.privacy.sanitize.sanitizeOnShutdown", true);
pref("services.sync.prefs.sync.privacy.trackingprotection.enabled", true);
pref("services.sync.prefs.sync.privacy.trackingprotection.pbmode.enabled", true);
pref("services.sync.prefs.sync.security.OCSP.enabled", true);
pref("services.sync.prefs.sync.security.OCSP.require", true);
pref("services.sync.prefs.sync.security.default_personal_cert", true);
@ -1204,12 +1198,6 @@ pref("browser.cache.frecency_experiment", -1);
// Enable GMP support in the addon manager.
pref("media.gmp-provider.enabled", true);
#ifdef NIGHTLY_BUILD
pref("privacy.trackingprotection.ui.enabled", true);
#else
pref("privacy.trackingprotection.ui.enabled", false);
#endif
#ifndef RELEASE_OR_BETA
// At the moment, autostart.2 is used, while autostart.1 is unused.
// We leave it here set to false to reset users' defaults and allow

196
basilisk/base/content/blockedSite.xhtml

@ -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>

4
basilisk/base/content/browser-doctype.inc

@ -13,10 +13,6 @@
%customizeToolbarDTD;
<!ENTITY % placesDTD SYSTEM "chrome://browser/locale/places/places.dtd">
%placesDTD;
#ifdef MOZ_SAFE_BROWSING
<!ENTITY % safebrowsingDTD SYSTEM "chrome://browser/locale/safebrowsing/phishing-afterload-warning-message.dtd">
%safebrowsingDTD;
#endif
<!ENTITY % aboutHomeDTD SYSTEM "chrome://browser/locale/aboutHome.dtd">
%aboutHomeDTD;
#ifdef MOZ_SERVICES_SYNC

48
basilisk/base/content/browser-safebrowsing.js

@ -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);
}
}

130
basilisk/base/content/browser-trackingprotection.js

@ -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();
},
};

20
basilisk/base/content/browser.js

@ -50,11 +50,6 @@ Cu.import("resource://gre/modules/NotificationDB.jsm");
["webrtcUI", "resource:///modules/webrtcUI.jsm", ]
].forEach(([name, resource]) => XPCOMUtils.defineLazyModuleGetter(this, name, resource));
#ifdef MOZ_SAFE_BROWSING
XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing",
"resource://gre/modules/SafeBrowsing.jsm");
#endif
// lazy service getters
[
["Favicons", "@mozilla.org/browser/favicon-service;1", "mozIAsyncFavicons"],
@ -954,7 +949,6 @@ var gBrowserInit = {
BrowserOnClick.init();
FeedHandler.init();
AboutPrivateBrowsingListener.init();
TrackingProtection.init();
RefreshBlocker.init();
CaptivePortalWatcher.init();
@ -1163,11 +1157,6 @@ var gBrowserInit = {
}
}
#ifdef MOZ_SAFE_BROWSING
// Bug 778855 - Perf regression if we do this here. To be addressed in bug 779008.
setTimeout(function() { SafeBrowsing.init(); }, 2000);
#endif
Services.obs.addObserver(gIdentityHandler, "perm-changed", false);
Services.obs.addObserver(gSessionHistoryObserver, "browser:purge-session-history", false);
Services.obs.addObserver(gXPInstallObserver, "addon-install-disabled", false);
@ -1437,8 +1426,6 @@ var gBrowserInit = {
FeedHandler.uninit();
TrackingProtection.uninit();
RefreshBlocker.uninit();
CaptivePortalWatcher.uninit();
@ -4181,7 +4168,6 @@ var XULBrowserWindow = {
uri = Services.uriFixup.createExposableURI(uri);
} catch (e) {}
gIdentityHandler.updateIdentity(this._state, uri);
TrackingProtection.onSecurityChange(this._state, aIsSimulated);
},
// simulate all change notifications after switching tabs
@ -7617,12 +7603,6 @@ var AboutPrivateBrowsingListener = {
msg => {
OpenBrowserWindow({private: true});
});
window.messageManager.addMessageListener(
"AboutPrivateBrowsing:ToggleTrackingProtection",
msg => {
const PREF = "privacy.trackingprotection.pbmode.enabled";
Services.prefs.setBoolPref(PREF, !Services.prefs.getBoolPref(PREF));
});
}
};

4
basilisk/base/content/global-scripts.inc

@ -22,13 +22,9 @@
<script type="application/javascript" src="chrome://browser/content/browser-places.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-plugins.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-refreshblocker.js"/>
#ifdef MOZ_SAFE_BROWSING
<script type="application/javascript" src="chrome://browser/content/browser-safebrowsing.js"/>
#endif
<script type="application/javascript" src="chrome://browser/content/browser-sidebar.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-tabsintitlebar.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-thumbnails.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-trackingprotection.js"/>
#ifdef MOZ_DATA_REPORTING
<script type="application/javascript" src="chrome://browser/content/browser-data-submission-info-bar.js"/>

35
basilisk/base/content/report-phishing-overlay.xul

@ -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>

5
basilisk/base/content/tab-content.js

@ -195,8 +195,6 @@ var AboutPrivateBrowsingListener = {
init(chromeGlobal) {
chromeGlobal.addEventListener("AboutPrivateBrowsingOpenWindow", this,
false, true);
chromeGlobal.addEventListener("AboutPrivateBrowsingToggleTrackingProtection", this,
false, true);
},
get isAboutPrivateBrowsing() {
@ -211,9 +209,6 @@ var AboutPrivateBrowsingListener = {
case "AboutPrivateBrowsingOpenWindow":
sendAsyncMessage("AboutPrivateBrowsing:OpenPrivateWindow");
break;
case "AboutPrivateBrowsingToggleTrackingProtection":
sendAsyncMessage("AboutPrivateBrowsing:ToggleTrackingProtection");
break;
}
},
};

9
basilisk/base/jar.mn

@ -71,9 +71,6 @@ browser.jar:
* content/browser/browser-places.js (content/browser-places.js)
content/browser/browser-plugins.js (content/browser-plugins.js)
content/browser/browser-refreshblocker.js (content/browser-refreshblocker.js)
#ifdef MOZ_SAFE_BROWSING
content/browser/browser-safebrowsing.js (content/browser-safebrowsing.js)
#endif
content/browser/browser-sidebar.js (content/browser-sidebar.js)
* content/browser/browser-tabPreviews.xml (content/browser-tabPreviews.xml)
#ifdef MOZ_CAN_DRAW_IN_TITLEBAR
@ -82,7 +79,6 @@ browser.jar:
content/browser/browser-tabsintitlebar.js (content/browser-tabsintitlebar-stub.js)
#endif
content/browser/browser-thumbnails.js (content/browser-thumbnails.js)
content/browser/browser-trackingprotection.js (content/browser-trackingprotection.js)
content/browser/tab-content.js (content/tab-content.js)
content/browser/content.js (content/content.js)
content/browser/defaultthemes/1.footer.jpg (content/defaultthemes/1.footer.jpg)
@ -155,10 +151,5 @@ browser.jar:
# the following files are browser-specific overrides
* content/browser/license.html (/platform/toolkit/content/license.html)
% override chrome://global/content/license.html chrome://browser/content/license.html
#ifdef MOZ_SAFE_BROWSING
content/browser/report-phishing-overlay.xul (content/report-phishing-overlay.xul)
content/browser/blockedSite.xhtml (content/blockedSite.xhtml)
% overlay chrome://browser/content/browser.xul chrome://browser/content/report-phishing-overlay.xul
#endif
% override chrome://global/content/netError.xhtml chrome://browser/content/aboutNetError.xhtml

9
basilisk/components/about/AboutRedirector.cpp

@ -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 |

3
basilisk/components/build/nsModule.cpp

@ -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 },

31
basilisk/components/controlcenter/content/panel.inc.xul

@ -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">

209
basilisk/components/preferences/blocklists.js

@ -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);
}

56
basilisk/components/preferences/blocklists.xul

@ -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>

43
basilisk/components/preferences/donottrack.xul

@ -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>

139
basilisk/components/preferences/in-content/privacy.js

@ -20,37 +20,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.
*/
@ -76,10 +45,6 @@ var gPrivacyPane = {
this.updateHistoryModePane();
this.updatePrivacyMicroControls();
this.initAutoStartPrivateBrowsingReverter();
#ifdef MOZ_SAFE_BROWSING
this._initTrackingProtection();
this._initTrackingProtectionPBM();
#endif
this._initAutocomplete();
setEventListener("privacy.sanitize.sanitizeOnShutdown", "change",
@ -104,12 +69,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",
@ -118,64 +77,8 @@ 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
},
#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
/**
@ -412,48 +315,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
#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
/*

65
basilisk/components/preferences/in-content/privacy.xul

@ -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 -->

78
basilisk/components/preferences/in-content/security.js

@ -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

42
basilisk/components/preferences/in-content/security.xul

@ -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 -->

7
basilisk/components/preferences/jar.mn

@ -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

48
basilisk/components/privatebrowsing/content/aboutPrivateBrowsing.js

@ -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

15
basilisk/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml

@ -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>