From d0b0207613472ef8d68240864a7e8758612ef547 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Mon, 18 Oct 2021 16:19:08 +0000 Subject: Issue #2 - Remove Safebrowsing and TrackingProtection from the FE This resolves #2 --- basilisk/app/profile/basilisk.js | 12 -- basilisk/base/content/blockedSite.xhtml | 196 ------------------- basilisk/base/content/browser-doctype.inc | 4 - basilisk/base/content/browser-safebrowsing.js | 48 ----- .../base/content/browser-trackingprotection.js | 177 ----------------- basilisk/base/content/browser.js | 20 -- basilisk/base/content/global-scripts.inc | 4 - basilisk/base/content/report-phishing-overlay.xul | 35 ---- basilisk/base/content/tab-content.js | 5 - basilisk/base/jar.mn | 9 - basilisk/components/about/AboutRedirector.cpp | 9 - basilisk/components/build/nsModule.cpp | 3 - .../components/controlcenter/content/panel.inc.xul | 31 --- basilisk/components/preferences/blocklists.js | 209 --------------------- basilisk/components/preferences/blocklists.xul | 56 ------ basilisk/components/preferences/donottrack.xul | 43 ----- .../components/preferences/in-content/privacy.js | 139 -------------- .../components/preferences/in-content/privacy.xul | 65 ------- .../components/preferences/in-content/security.js | 78 -------- .../components/preferences/in-content/security.xul | 42 ----- basilisk/components/preferences/jar.mn | 7 - .../content/aboutPrivateBrowsing.js | 48 ----- .../content/aboutPrivateBrowsing.xhtml | 15 -- basilisk/confvars.sh | 1 - basilisk/installer/package-manifest.in | 10 - .../en-US/chrome/browser/aboutPrivateBrowsing.dtd | 4 - basilisk/locales/en-US/chrome/browser/browser.dtd | 27 --- .../en-US/chrome/browser/browser.properties | 3 - .../chrome/browser/preferences/donottrack.dtd | 13 -- .../browser/preferences/preferences.properties | 2 - .../en-US/chrome/browser/preferences/privacy.dtd | 25 --- .../phishing-afterload-warning-message.dtd | 32 ---- .../browser/safebrowsing/report-phishing.dtd | 13 -- basilisk/locales/jar.mn | 10 - .../shared/incontentprefs/preferences.inc.css | 7 - .../extension/configurations/ControlCenter.jsm | 34 ---- 36 files changed, 1436 deletions(-) delete mode 100644 basilisk/base/content/blockedSite.xhtml delete mode 100644 basilisk/base/content/browser-safebrowsing.js delete mode 100644 basilisk/base/content/browser-trackingprotection.js delete mode 100644 basilisk/base/content/report-phishing-overlay.xul delete mode 100644 basilisk/components/preferences/blocklists.js delete mode 100644 basilisk/components/preferences/blocklists.xul delete mode 100644 basilisk/components/preferences/donottrack.xul delete mode 100644 basilisk/locales/en-US/chrome/browser/preferences/donottrack.dtd delete mode 100644 basilisk/locales/en-US/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd delete mode 100644 basilisk/locales/en-US/chrome/browser/safebrowsing/report-phishing.dtd diff --git a/basilisk/app/profile/basilisk.js b/basilisk/app/profile/basilisk.js index f6575d8..d97660d 100644 --- a/basilisk/app/profile/basilisk.js +++ b/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); @@ -1208,12 +1202,6 @@ pref("toolkit.telemetry.archive.enabled", true); // 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 diff --git a/basilisk/base/content/blockedSite.xhtml b/basilisk/base/content/blockedSite.xhtml deleted file mode 100644 index 10a4b33..0000000 --- a/basilisk/base/content/blockedSite.xhtml +++ /dev/null @@ -1,196 +0,0 @@ - - - - %htmlDTD; - - %globalDTD; - - %brandDTD; - - %blockedSiteDTD; -]> - - - - - - - - - - - - -
- - -
-

&safeb.blocked.phishingPage.title2;

-

&safeb.blocked.malwarePage.title;

-

&safeb.blocked.unwantedPage.title;

-
- -
- - -
-

&safeb.blocked.phishingPage.shortDesc2;

-

&safeb.blocked.malwarePage.shortDesc;

-

&safeb.blocked.unwantedPage.shortDesc;

-
- - -
-

&safeb.blocked.phishingPage.longDesc2;

-

&safeb.blocked.malwarePage.longDesc;

-

&safeb.blocked.unwantedPage.longDesc;

-
- - -
- - -
- -
-
-
- -
-
- - - - diff --git a/basilisk/base/content/browser-doctype.inc b/basilisk/base/content/browser-doctype.inc index 30d70cc..14f5f80 100644 --- a/basilisk/base/content/browser-doctype.inc +++ b/basilisk/base/content/browser-doctype.inc @@ -13,10 +13,6 @@ %customizeToolbarDTD; %placesDTD; -#ifdef MOZ_SAFE_BROWSING - -%safebrowsingDTD; -#endif %aboutHomeDTD; #ifdef MOZ_SERVICES_SYNC diff --git a/basilisk/base/content/browser-safebrowsing.js b/basilisk/base/content/browser-safebrowsing.js deleted file mode 100644 index 430d84f..0000000 --- a/basilisk/base/content/browser-safebrowsing.js +++ /dev/null @@ -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); - } -} diff --git a/basilisk/base/content/browser-trackingprotection.js b/basilisk/base/content/browser-trackingprotection.js deleted file mode 100644 index 20917a0..0000000 --- a/basilisk/base/content/browser-trackingprotection.js +++ /dev/null @@ -1,177 +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"); - - this.enabledHistogramAdd(this.enabledGlobally); - this.disabledPBMHistogramAdd(!this.enabledInPrivateWindows); - }, - - 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; - }, - - enabledHistogramAdd(value) { - if (PrivateBrowsingUtils.isWindowPrivate(window)) { - return; - } - Services.telemetry.getHistogramById("TRACKING_PROTECTION_ENABLED").add(value); - }, - - disabledPBMHistogramAdd(value) { - if (PrivateBrowsingUtils.isWindowPrivate(window)) { - return; - } - Services.telemetry.getHistogramById("TRACKING_PROTECTION_PBM_DISABLED").add(value); - }, - - eventsHistogramAdd(value) { - if (PrivateBrowsingUtils.isWindowPrivate(window)) { - return; - } - Services.telemetry.getHistogramById("TRACKING_PROTECTION_EVENTS").add(value); - }, - - shieldHistogramAdd(value) { - if (PrivateBrowsingUtils.isWindowPrivate(window)) { - return; - } - Services.telemetry.getHistogramById("TRACKING_PROTECTION_SHIELD").add(value); - }, - - 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"); - - this.shieldHistogramAdd(2); - } else if (isAllowing) { - this.icon.setAttribute("tooltiptext", this.disabledTooltipText); - this.icon.setAttribute("state", "loaded-tracking-content"); - this.content.setAttribute("state", "loaded-tracking-content"); - - this.shieldHistogramAdd(1); - } else { - this.icon.removeAttribute("tooltiptext"); - this.icon.removeAttribute("state"); - this.content.removeAttribute("state"); - - // We didn't show the shield - this.shieldHistogramAdd(0); - } - - // Telemetry for state change. - this.eventsHistogramAdd(0); - }, - - 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); - } - - // Telemetry for disable protection. - this.eventsHistogramAdd(1); - - // 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"); - } - - // Telemetry for enable protection. - this.eventsHistogramAdd(2); - - // Hide the control center. - document.getElementById("identity-popup").hidePopup(); - - BrowserReload(); - }, -}; diff --git a/basilisk/base/content/browser.js b/basilisk/base/content/browser.js index 13fc774..6d48373 100644 --- a/basilisk/base/content/browser.js +++ b/basilisk/base/content/browser.js @@ -51,11 +51,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"], @@ -955,7 +950,6 @@ var gBrowserInit = { BrowserOnClick.init(); FeedHandler.init(); AboutPrivateBrowsingListener.init(); - TrackingProtection.init(); RefreshBlocker.init(); CaptivePortalWatcher.init(); @@ -1168,11 +1162,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); @@ -1476,8 +1465,6 @@ var gBrowserInit = { FeedHandler.uninit(); - TrackingProtection.uninit(); - RefreshBlocker.uninit(); CaptivePortalWatcher.uninit(); @@ -4292,7 +4279,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 @@ -7742,12 +7728,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)); - }); } }; diff --git a/basilisk/base/content/global-scripts.inc b/basilisk/base/content/global-scripts.inc index 6edb112..d974856 100644 --- a/basilisk/base/content/global-scripts.inc +++ b/basilisk/base/content/global-scripts.inc @@ -22,13 +22,9 @@