summaryrefslogtreecommitdiffstats
path: root/browser
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-05-16 17:11:17 +0200
committerGitHub <noreply@github.com>2018-05-16 17:11:17 +0200
commitb702d7d32a9edec41cd2dad81dcf39107c1c5ddc (patch)
tree84bd9a32203822c02fc8056eb55f0a68315a7afc /browser
parent90942a2af0cabb9345cf04fa6113e12197504fcf (diff)
parent79edb388a3ce6facbb11de51eeade667dae0d995 (diff)
downloadUXP-b702d7d32a9edec41cd2dad81dcf39107c1c5ddc.tar
UXP-b702d7d32a9edec41cd2dad81dcf39107c1c5ddc.tar.gz
UXP-b702d7d32a9edec41cd2dad81dcf39107c1c5ddc.tar.lz
UXP-b702d7d32a9edec41cd2dad81dcf39107c1c5ddc.tar.xz
UXP-b702d7d32a9edec41cd2dad81dcf39107c1c5ddc.zip
Merge pull request #368 from trav90/safebrowsing-work
Make safebrowsing optional at build time
Diffstat (limited to 'browser')
-rw-r--r--browser/app/profile/firefox.js2
-rw-r--r--browser/base/content/browser-doctype.inc2
-rw-r--r--browser/base/content/browser-safebrowsing.js2
-rwxr-xr-xbrowser/base/content/browser.js8
-rwxr-xr-xbrowser/base/content/global-scripts.inc2
-rw-r--r--browser/base/content/utilityOverlay.js3
-rw-r--r--browser/base/jar.mn4
-rw-r--r--browser/branding/shared/preferences.inc9
-rw-r--r--browser/components/about/AboutRedirector.cpp2
-rw-r--r--browser/components/build/nsModule.cpp2
-rw-r--r--browser/components/preferences/blocklists.js2
-rw-r--r--browser/components/preferences/in-content/jar.mn2
-rw-r--r--browser/components/preferences/in-content/security.js16
-rw-r--r--browser/components/preferences/in-content/security.xul18
-rwxr-xr-xbrowser/confvars.sh1
-rw-r--r--browser/installer/package-manifest.in2
-rw-r--r--browser/locales/jar.mn2
17 files changed, 45 insertions, 34 deletions
diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js
index c021da616..e432c511d 100644
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -964,8 +964,10 @@ 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);
diff --git a/browser/base/content/browser-doctype.inc b/browser/base/content/browser-doctype.inc
index 10015d898..ad08f4b03 100644
--- a/browser/base/content/browser-doctype.inc
+++ b/browser/base/content/browser-doctype.inc
@@ -13,8 +13,10 @@
%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;
<!ENTITY % syncBrandDTD SYSTEM "chrome://browser/locale/syncBrand.dtd">
diff --git a/browser/base/content/browser-safebrowsing.js b/browser/base/content/browser-safebrowsing.js
index 430d84f13..a66595b2d 100644
--- a/browser/base/content/browser-safebrowsing.js
+++ b/browser/base/content/browser-safebrowsing.js
@@ -2,6 +2,7 @@
* 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/. */
+#ifdef MOZ_SAFE_BROWSING
var gSafeBrowsing = {
setReportPhishingMenu: function() {
@@ -46,3 +47,4 @@ var gSafeBrowsing = {
return SafeBrowsing.getReportURL(name, gBrowser.currentURI);
}
}
+#endif
diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
index 2380f5d21..8679bca83 100755
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -60,8 +60,10 @@ Cu.import("resource://gre/modules/NotificationDB.jsm");
["webrtcUI", "resource:///modules/webrtcUI.jsm", ]
].forEach(([name, resource]) => XPCOMUtils.defineLazyModuleGetter(this, name, resource));
-XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing",
- "resource://gre/modules/SafeBrowsing.jsm");
+#ifdef MOZ_SAFE_BROWSING
+ XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing",
+ "resource://gre/modules/SafeBrowsing.jsm");
+#endif
// lazy service getters
[
@@ -1200,8 +1202,10 @@ 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);
diff --git a/browser/base/content/global-scripts.inc b/browser/base/content/global-scripts.inc
index dac75878d..ca942cec8 100755
--- a/browser/base/content/global-scripts.inc
+++ b/browser/base/content/global-scripts.inc
@@ -23,7 +23,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-social.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-syncui.js"/>
diff --git a/browser/base/content/utilityOverlay.js b/browser/base/content/utilityOverlay.js
index b041915a7..4ea6d8f90 100644
--- a/browser/base/content/utilityOverlay.js
+++ b/browser/base/content/utilityOverlay.js
@@ -819,9 +819,8 @@ function openTourPage()
function buildHelpMenu()
{
// Enable/disable the "Report Web Forgery" menu item.
- if (typeof gSafeBrowsing != "undefined") {
+ if (typeof gSafeBrowsing != "undefined")
gSafeBrowsing.setReportPhishingMenu();
- }
}
function isElementVisible(aElement)
diff --git a/browser/base/jar.mn b/browser/base/jar.mn
index c58265351..03854f75d 100644
--- a/browser/base/jar.mn
+++ b/browser/base/jar.mn
@@ -84,7 +84,9 @@ 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-social.js (content/browser-social.js)
* content/browser/browser-syncui.js (content/browser-syncui.js)
@@ -186,8 +188,10 @@ browser.jar:
# the following files are browser-specific overrides
* content/browser/license.html (/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
diff --git a/browser/branding/shared/preferences.inc b/browser/branding/shared/preferences.inc
index 90fd3da06..e1b8d3be6 100644
--- a/browser/branding/shared/preferences.inc
+++ b/browser/branding/shared/preferences.inc
@@ -22,14 +22,5 @@ pref("app.update.badgeWaitTime", 0);
// If this is less than 5, then pasting code into the web console or scratchpad is disabled
pref("devtools.selfxss.count", 100);
-// Disable Google Safebrowsing by default. Without an API key, this won't work.
-pref("browser.safebrowsing.phishing.enabled", false);
-pref("browser.safebrowsing.malware.enabled", false);
-pref("browser.safebrowsing.downloads.enabled", false);
-pref("browser.safebrowsing.downloads.remote.enabled", false);
-
-// Disable the UI controls for it as well for Basilisk-official.
-pref("browser.safebrowsing.UI.enabled", false);
-
//
pref("general.useragent.appVersionIsBuildID", true);
diff --git a/browser/components/about/AboutRedirector.cpp b/browser/components/about/AboutRedirector.cpp
index 717ae9c48..5e8df6ab2 100644
--- a/browser/components/about/AboutRedirector.cpp
+++ b/browser/components/about/AboutRedirector.cpp
@@ -40,6 +40,7 @@ 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 |
@@ -47,6 +48,7 @@ static RedirEntry kRedirMap[] = {
nsIAboutModule::ALLOW_SCRIPT |
nsIAboutModule::HIDE_FROM_ABOUTABOUT
},
+#endif
{
"certerror", "chrome://browser/content/aboutNetError.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
diff --git a/browser/components/build/nsModule.cpp b/browser/components/build/nsModule.cpp
index 1fad0ce68..967da3ebc 100644
--- a/browser/components/build/nsModule.cpp
+++ b/browser/components/build/nsModule.cpp
@@ -86,7 +86,9 @@ 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 "socialerror", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "providerdirectory", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
diff --git a/browser/components/preferences/blocklists.js b/browser/components/preferences/blocklists.js
index bc39eb6bd..c0ce5b656 100644
--- a/browser/components/preferences/blocklists.js
+++ b/browser/components/preferences/blocklists.js
@@ -6,9 +6,11 @@ Components.utils.import("resource://gre/modules/Services.jsm");
const BASE_LIST_ID = "base";
const CONTENT_LIST_ID = "content";
const TRACK_SUFFIX = "-track-digest256";
+#ifdef MOZ_SAFE_BROWSING
const TRACKING_TABLE_PREF = "urlclassifier.trackingTable";
const LISTS_PREF_BRANCH = "browser.safebrowsing.provider.mozilla.lists.";
const UPDATE_TIME_PREF = "browser.safebrowsing.provider.mozilla.nextupdatetime";
+#endif
var gBlocklistManager = {
_type: "",
diff --git a/browser/components/preferences/in-content/jar.mn b/browser/components/preferences/in-content/jar.mn
index 3497ff555..130bf8549 100644
--- a/browser/components/preferences/in-content/jar.mn
+++ b/browser/components/preferences/in-content/jar.mn
@@ -14,5 +14,5 @@ browser.jar:
content/browser/preferences/in-content/applications.js
* content/browser/preferences/in-content/content.js
content/browser/preferences/in-content/sync.js
- content/browser/preferences/in-content/security.js
+* content/browser/preferences/in-content/security.js
content/browser/preferences/in-content/search.js
diff --git a/browser/components/preferences/in-content/security.js b/browser/components/preferences/in-content/security.js
index 0d7af39a3..37a187f9c 100644
--- a/browser/components/preferences/in-content/security.js
+++ b/browser/components/preferences/in-content/security.js
@@ -23,7 +23,9 @@ var gSecurityPane = {
this._pane = document.getElementById("paneSecurity");
this._initMasterPasswordUI();
+#ifdef MOZ_SAFE_BROWSING
this._initSafeBrowsing();
+#endif
setEventListener("addonExceptions", "command",
gSecurityPane.showAddonExceptions);
@@ -160,6 +162,7 @@ var gSecurityPane = {
checkbox.checked = !noMP;
},
+#ifdef MOZ_SAFE_BROWSING
_initSafeBrowsing() {
let enableSafeBrowsing = document.getElementById("enableSafeBrowsing");
let blockDownloads = document.getElementById("blockDownloads");
@@ -168,24 +171,12 @@ var gSecurityPane = {
let safeBrowsingPhishingPref = document.getElementById("browser.safebrowsing.phishing.enabled");
let safeBrowsingMalwarePref = document.getElementById("browser.safebrowsing.malware.enabled");
- let safeBrowsingUIPref = document.getElementById("browser.safebrowsing.UI.enabled");
- let safeBrowsingUISep = document.getElementById("safeBrowsingUISep");
- let safeBrowsingUIGroup = document.getElementById("safeBrowsingUIGroup");
-
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");
- if (safeBrowsingUIPref.value == false) {
- safeBrowsingUISep.setAttribute("hidden", "true");
- safeBrowsingUIGroup.setAttribute("hidden", "true");
- } else {
- safeBrowsingUISep.removeAttribute("hidden");
- safeBrowsingUIGroup.removeAttribute("hidden");
- }
-
enableSafeBrowsing.addEventListener("command", function() {
safeBrowsingPhishingPref.value = enableSafeBrowsing.checked;
safeBrowsingMalwarePref.value = enableSafeBrowsing.checked;
@@ -244,6 +235,7 @@ var gSecurityPane = {
blockUncommonUnwanted.checked = blockUnwantedPref.value && blockUncommonPref.value;
},
+#endif
/**
* Enables/disables the master password button depending on the state of the
diff --git a/browser/components/preferences/in-content/security.xul b/browser/components/preferences/in-content/security.xul
index 5dc8ad5e9..33e1471bd 100644
--- a/browser/components/preferences/in-content/security.xul
+++ b/browser/components/preferences/in-content/security.xul
@@ -16,11 +16,13 @@
name="pref.privacy.disable_button.view_passwords_exceptions"
type="bool"/>
- <!-- Add-ons, malware, phishing -->
+ <!-- Add-ons -->
<preference id="xpinstall.whitelist.required"
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"/>
@@ -28,10 +30,6 @@
name="browser.safebrowsing.phishing.enabled"
type="bool"/>
- <preference id="browser.safebrowsing.UI.enabled"
- name="browser.safebrowsing.UI.enabled"
- type="bool"/>
-
<preference id="browser.safebrowsing.downloads.enabled"
name="browser.safebrowsing.downloads.enabled"
type="bool"/>
@@ -46,6 +44,7 @@
<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"/>
@@ -61,7 +60,7 @@
<html:a class="help-button" target="_blank" aria-label="&helpButton.label;"></html:a>
</hbox>
-<!-- addons, forgery (phishing) UI -->
+<!-- addons -->
<groupbox id="addonsPhishingGroup" data-category="paneSecurity" hidden="true">
<caption><label>&general.label;</label></caption>
@@ -77,8 +76,10 @@
accesskey="&addonExceptions.accesskey;"/>
</hbox>
- <separator id="safeBrowsingUISep" class="thin"/>
- <vbox id="safeBrowsingUIGroup" align="start">
+#ifdef MOZ_SAFE_BROWSING
+<!-- Safebrowsing (phishing) UI -->
+ <separator class="thin"/>
+ <vbox align="start">
<checkbox id="enableSafeBrowsing"
label="&enableSafeBrowsing.label;"
accesskey="&enableSafeBrowsing.accesskey;" />
@@ -91,6 +92,7 @@
accesskey="&blockUncommonUnwanted.accesskey;" />
</vbox>
</vbox>
+#endif
</groupbox>
<!-- Passwords -->
diff --git a/browser/confvars.sh b/browser/confvars.sh
index 41c0be3d7..0343034a4 100755
--- a/browser/confvars.sh
+++ b/browser/confvars.sh
@@ -59,6 +59,7 @@ MOZ_DEVTOOLS=1
MOZ_SERVICES_COMMON=1
MOZ_SERVICES_SYNC=1
MOZ_SERVICES_HEALTHREPORT=
+MOZ_SAFE_BROWSING=
# Disable checking that add-ons are signed by the trusted root
MOZ_ADDON_SIGNING=0
diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in
index 4ef8942b5..0f79bd031 100644
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -578,12 +578,14 @@
@RESPATH@/browser/modules/*
@RESPATH@/modules/*
+#ifdef MOZ_URL_CLASSIFIER
; Safe Browsing
@RESPATH@/components/nsURLClassifier.manifest
@RESPATH@/components/nsUrlClassifierHashCompleter.js
@RESPATH@/components/nsUrlClassifierListManager.js
@RESPATH@/components/nsUrlClassifierLib.js
@RESPATH@/components/url-classifier.xpt
+#endif
; Private Browsing
@RESPATH@/components/privatebrowsing.xpt
diff --git a/browser/locales/jar.mn b/browser/locales/jar.mn
index 6d76d20f0..31cbd9ccf 100644
--- a/browser/locales/jar.mn
+++ b/browser/locales/jar.mn
@@ -53,8 +53,10 @@
locale/browser/places/bookmarkProperties.properties (%chrome/browser/places/bookmarkProperties.properties)
locale/browser/preferences/selectBookmark.dtd (%chrome/browser/preferences/selectBookmark.dtd)
locale/browser/places/moveBookmarks.dtd (%chrome/browser/places/moveBookmarks.dtd)
+#ifdef MOZ_SAFE_BROWSING
locale/browser/safebrowsing/phishing-afterload-warning-message.dtd (%chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd)
locale/browser/safebrowsing/report-phishing.dtd (%chrome/browser/safebrowsing/report-phishing.dtd)
+#endif
locale/browser/feeds/subscribe.dtd (%chrome/browser/feeds/subscribe.dtd)
locale/browser/feeds/subscribe.properties (%chrome/browser/feeds/subscribe.properties)
locale/browser/migration/migration.dtd (%chrome/browser/migration/migration.dtd)