From 5909cef47a4aaf458e41e0d2a46b88972b934dff Mon Sep 17 00:00:00 2001 From: trav90 Date: Sat, 12 May 2018 08:17:44 -0500 Subject: Make safebrowsing optional at build time - Part 1: browser/ --- browser/base/content/browser-doctype.inc | 2 ++ browser/base/content/browser-safebrowsing.js | 2 ++ browser/base/content/browser.js | 8 ++++++-- browser/base/content/global-scripts.inc | 2 ++ browser/base/content/utilityOverlay.js | 3 +-- browser/base/jar.mn | 4 ++++ browser/components/about/AboutRedirector.cpp | 2 ++ browser/components/build/nsModule.cpp | 2 ++ browser/confvars.sh | 1 + browser/installer/package-manifest.in | 2 ++ browser/locales/jar.mn | 2 ++ 11 files changed, 26 insertions(+), 4 deletions(-) (limited to 'browser') 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; %placesDTD; +#ifdef MOZ_SAFE_BROWSING %safebrowsingDTD; +#endif %aboutHomeDTD; 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 @@