From 547396f6fdd394a7c0cb4c81d314e3261fc67394 Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sat, 17 Jun 2023 09:23:37 -0400 Subject: [PATCH 1/1] Fix for UXP #2133 with adjustments from Basilisk #2 Removes Safebrowsing and TrackingProtection from the FE which was removed in UXP --- app/profile/iceweasel-uxp.js | 7 - base/content/blockedSite.xhtml | 196 ----------------- base/content/browser-safebrowsing.js | 50 ----- base/content/browser-trackingprotection.js | 132 ----------- base/content/browser.js | 20 -- base/content/global-scripts.inc | 1 - base/content/report-phishing-overlay.xul | 35 --- base/content/tab-content.js | 5 - base/jar.mn | 4 - components/about/AboutRedirector.cpp | 9 - .../controlcenter/content/panel.inc.xul | 31 --- components/preferences/blocklists.js | 206 ------------------ components/preferences/blocklists.xul | 56 ----- components/preferences/donottrack.xul | 43 ---- components/preferences/in-content/privacy.js | 125 ----------- components/preferences/in-content/privacy.xul | 65 ------ components/preferences/in-content/security.js | 78 ------- .../preferences/in-content/security.xul | 42 ---- components/preferences/jar.mn | 3 - .../content/aboutPrivateBrowsing.js | 40 ---- .../content/aboutPrivateBrowsing.xhtml | 11 - installer/package-manifest.in | 5 - .../chrome/browser/aboutPrivateBrowsing.dtd | 4 - locales/en-US/chrome/browser/browser.dtd | 27 --- .../en-US/chrome/browser/browser.properties | 3 - .../chrome/browser/preferences/donottrack.dtd | 13 -- .../preferences/preferences.properties | 2 - .../chrome/browser/preferences/privacy.dtd | 24 -- .../phishing-afterload-warning-message.dtd | 32 --- .../browser/safebrowsing/report-phishing.dtd | 13 -- locales/jar.mn | 6 - .../shared/incontentprefs/preferences.inc.css | 7 - .../configurations/ControlCenter.jsm | 35 --- .../extension/configurations/Preferences.jsm | 7 - 34 files changed, 1337 deletions(-) delete mode 100644 base/content/blockedSite.xhtml delete mode 100644 base/content/browser-safebrowsing.js delete mode 100644 base/content/browser-trackingprotection.js delete mode 100644 base/content/report-phishing-overlay.xul delete mode 100644 components/preferences/blocklists.js delete mode 100644 components/preferences/blocklists.xul delete mode 100644 components/preferences/donottrack.xul delete mode 100644 locales/en-US/chrome/browser/preferences/donottrack.dtd delete mode 100644 locales/en-US/chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd delete mode 100644 locales/en-US/chrome/browser/safebrowsing/report-phishing.dtd diff --git a/app/profile/iceweasel-uxp.js b/app/profile/iceweasel-uxp.js index f5b75e9..b2c8c34 100644 --- a/app/profile/iceweasel-uxp.js +++ b/app/profile/iceweasel-uxp.js @@ -956,7 +956,6 @@ 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); @@ -1111,12 +1110,6 @@ pref("browser.cache.frecency_experiment", -1); // Enable GMP support in the addon manager. pref("media.gmp-provider.enabled", false); -#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/base/content/blockedSite.xhtml b/base/content/blockedSite.xhtml deleted file mode 100644 index 10a4b33..0000000 --- a/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/base/content/browser-safebrowsing.js b/base/content/browser-safebrowsing.js deleted file mode 100644 index a66595b..0000000 --- a/base/content/browser-safebrowsing.js +++ /dev/null @@ -1,50 +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/. */ - -#ifdef MOZ_SAFE_BROWSING -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); - } -} -#endif diff --git a/base/content/browser-trackingprotection.js b/base/content/browser-trackingprotection.js deleted file mode 100644 index 426ed70..0000000 --- a/base/content/browser-trackingprotection.js +++ /dev/null @@ -1,132 +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 = { - 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(); - }, -}; diff --git a/base/content/browser.js b/base/content/browser.js index 58a57be..8bcee8b 100755 --- a/base/content/browser.js +++ b/base/content/browser.js @@ -49,11 +49,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"], @@ -947,7 +942,6 @@ var gBrowserInit = { BrowserOnClick.init(); FeedHandler.init(); AboutPrivateBrowsingListener.init(); - TrackingProtection.init(); RefreshBlocker.init(); CaptivePortalWatcher.init(); @@ -1156,11 +1150,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); @@ -1422,8 +1411,6 @@ var gBrowserInit = { FeedHandler.uninit(); - TrackingProtection.uninit(); - RefreshBlocker.uninit(); CaptivePortalWatcher.uninit(); @@ -4258,7 +4245,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 @@ -7709,12 +7695,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/base/content/global-scripts.inc b/base/content/global-scripts.inc index e11f4e9..2775dea 100755 --- a/base/content/global-scripts.inc +++ b/base/content/global-scripts.inc @@ -24,4 +24,3 @@