diff options
author | Moonchild <moonchild@palemoon.org> | 2023-03-07 00:01:58 +0100 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2023-03-07 00:01:58 +0100 |
commit | 517ab728ac483af67fadb6cb37c1d43905a36a74 (patch) | |
tree | fe23ac2d4707c8906b97345b250d710bcbcf1d5e /toolkit | |
parent | 4d38cb76c21607ef3c7b74686730e965343f3909 (diff) | |
download | uxp-517ab728ac483af67fadb6cb37c1d43905a36a74.tar.gz |
Issue #2133 - Part 2: Remove nsIPrivateBrowsingTrackingProtectionWhitelist
This removes the in-memory whitelist for PB mode.
Diffstat (limited to 'toolkit')
6 files changed, 0 insertions, 144 deletions
diff --git a/toolkit/components/moz.build b/toolkit/components/moz.build index 759b07e18e..bbf4b4d56a 100644 --- a/toolkit/components/moz.build +++ b/toolkit/components/moz.build @@ -39,7 +39,6 @@ DIRS += [ 'perf', 'perfmonitoring', 'places', - 'privatebrowsing', 'processsingleton', 'promiseworker', 'prompts', diff --git a/toolkit/components/privatebrowsing/PrivateBrowsing.manifest b/toolkit/components/privatebrowsing/PrivateBrowsing.manifest deleted file mode 100644 index 36b39bb85e..0000000000 --- a/toolkit/components/privatebrowsing/PrivateBrowsing.manifest +++ /dev/null @@ -1,2 +0,0 @@ -component {a319b616-c45d-4037-8d86-01c592b5a9af} PrivateBrowsingTrackingProtectionWhitelist.js -contract @mozilla.org/pbm-tp-whitelist;1 {a319b616-c45d-4037-8d86-01c592b5a9af} diff --git a/toolkit/components/privatebrowsing/PrivateBrowsingTrackingProtectionWhitelist.js b/toolkit/components/privatebrowsing/PrivateBrowsingTrackingProtectionWhitelist.js deleted file mode 100644 index 5c1c27874d..0000000000 --- a/toolkit/components/privatebrowsing/PrivateBrowsingTrackingProtectionWhitelist.js +++ /dev/null @@ -1,68 +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/. */ - -const Ci = Components.interfaces; -const Cu = Components.utils; - -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -Cu.import("resource://gre/modules/Services.jsm"); - -function PrivateBrowsingTrackingProtectionWhitelist() { - // The list of URIs explicitly excluded from tracking protection. - this._allowlist = []; - - Services.obs.addObserver(this, "last-pb-context-exited", true); -} - -PrivateBrowsingTrackingProtectionWhitelist.prototype = { - classID: Components.ID("{a319b616-c45d-4037-8d86-01c592b5a9af}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPrivateBrowsingTrackingProtectionWhitelist, - Ci.nsIObserver, - Ci.nsISupportsWeakReference, - Ci.nsISupports]), - _xpcom_factory: XPCOMUtils.generateSingletonFactory(PrivateBrowsingTrackingProtectionWhitelist), - - /** - * Add the provided URI to the list of allowed tracking sites. - * - * @param uri nsIURI - * The URI to add to the list. - */ - addToAllowList(uri) { - if (this._allowlist.indexOf(uri.spec) === -1) { - this._allowlist.push(uri.spec); - } - }, - - /** - * Remove the provided URI from the list of allowed tracking sites. - * - * @param uri nsIURI - * The URI to add to the list. - */ - removeFromAllowList(uri) { - let index = this._allowlist.indexOf(uri.spec); - if (index !== -1) { - this._allowlist.splice(index, 1); - } - }, - - /** - * Check if the provided URI exists in the list of allowed tracking sites. - * - * @param uri nsIURI - * The URI to add to the list. - */ - existsInAllowList(uri) { - return this._allowlist.indexOf(uri.spec) !== -1; - }, - - observe: function (subject, topic, data) { - if (topic == "last-pb-context-exited") { - this._allowlist = []; - } - } -}; - -this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PrivateBrowsingTrackingProtectionWhitelist]); diff --git a/toolkit/components/privatebrowsing/moz.build b/toolkit/components/privatebrowsing/moz.build deleted file mode 100644 index 834329e1d6..0000000000 --- a/toolkit/components/privatebrowsing/moz.build +++ /dev/null @@ -1,15 +0,0 @@ -# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# 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/. - -XPIDL_SOURCES += [ - 'nsIPrivateBrowsingTrackingProtectionWhitelist.idl', -] - -XPIDL_MODULE = 'privatebrowsing' - -EXTRA_COMPONENTS += [ - 'PrivateBrowsing.manifest', - 'PrivateBrowsingTrackingProtectionWhitelist.js', -] diff --git a/toolkit/components/privatebrowsing/nsIPrivateBrowsingTrackingProtectionWhitelist.idl b/toolkit/components/privatebrowsing/nsIPrivateBrowsingTrackingProtectionWhitelist.idl deleted file mode 100644 index d572b4e7e1..0000000000 --- a/toolkit/components/privatebrowsing/nsIPrivateBrowsingTrackingProtectionWhitelist.idl +++ /dev/null @@ -1,46 +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/. */ - -#include "nsISupports.idl" - -interface nsIURI; - -/** - * The Private Browsing Tracking Protection service checks a URI against an - * in-memory list of tracking sites. - */ -[scriptable, uuid(c77ddfac-6cd6-43a9-84e8-91682a1a7b18)] -interface nsIPrivateBrowsingTrackingProtectionWhitelist : nsISupports -{ - /** - * Add a URI to the list of allowed tracking sites in Private Browsing mode - * (essentially a tracking whitelist). This operation will cause the URI to - * be registered if it does not currently exist. If it already exists, then - * the operation is essentially a no-op. - * - * @param uri the uri to add to the list - */ - void addToAllowList(in nsIURI uri); - - /** - * Remove a URI from the list of allowed tracking sites in Private Browsing - * mode (the tracking whitelist). If the URI is not already in the list, - * then the operation is essentially a no-op. - * - * @param uri the uri to remove from the list - */ - void removeFromAllowList(in nsIURI uri); - - /** - * Check if a URI exists in the list of allowed tracking sites in Private - * Browsing mode (the tracking whitelist). - * - * @param uri the uri to look for in the list - */ - bool existsInAllowList(in nsIURI uri); -}; - -%{ C++ -#define NS_PBTRACKINGPROTECTIONWHITELIST_CONTRACTID "@mozilla.org/pbm-tp-whitelist;1" -%} diff --git a/toolkit/modules/PrivateBrowsingUtils.jsm b/toolkit/modules/PrivateBrowsingUtils.jsm index 6a84eef93f..bf59db22ed 100644 --- a/toolkit/modules/PrivateBrowsingUtils.jsm +++ b/toolkit/modules/PrivateBrowsingUtils.jsm @@ -50,18 +50,6 @@ this.PrivateBrowsingUtils = { .QueryInterface(Ci.nsILoadContext); }, - addToTrackingAllowlist(aURI) { - let pbmtpWhitelist = Cc["@mozilla.org/pbm-tp-whitelist;1"] - .getService(Ci.nsIPrivateBrowsingTrackingProtectionWhitelist); - pbmtpWhitelist.addToAllowList(aURI); - }, - - removeFromTrackingAllowlist(aURI) { - let pbmtpWhitelist = Cc["@mozilla.org/pbm-tp-whitelist;1"] - .getService(Ci.nsIPrivateBrowsingTrackingProtectionWhitelist); - pbmtpWhitelist.removeFromAllowList(aURI); - }, - get permanentPrivateBrowsing() { try { return gTemporaryAutoStartMode || |