Bug 1484876 - Part 4: Remove nsIPrivateBrowsingTrackingProtectionWhitelist.existsInAllowList(); r=johannh
☠☠ backed out by 41ebcb085bb0 ☠ ☠
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 21 Aug 2018 09:55:49 -0400
changeset 432827 cd2ced68989568aaadd21e09d7d68664cf43e91d
parent 432826 d31e39a477046ed8a574e43dc6bbd4192829680d
child 432828 b1cb63d8c8bb98823dab57773d150178f19e694b
push id34488
push usernerli@mozilla.com
push dateWed, 22 Aug 2018 16:28:54 +0000
treeherdermozilla-central@d6e4d3e69d4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1484876
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1484876 - Part 4: Remove nsIPrivateBrowsingTrackingProtectionWhitelist.existsInAllowList(); r=johannh
browser/base/content/browser-contentblocking.js
toolkit/components/privatebrowsing/PrivateBrowsingTrackingProtectionWhitelist.js
toolkit/components/privatebrowsing/nsIPrivateBrowsingTrackingProtectionWhitelist.idl
toolkit/modules/PrivateBrowsingUtils.jsm
--- a/browser/base/content/browser-contentblocking.js
+++ b/browser/base/content/browser-contentblocking.js
@@ -407,23 +407,21 @@ var ContentBlocking = {
     // This state will be overriden later if there's an exception set for this site.
     let active = this.enabled && detected;
 
     for (let blocker of this.blockers) {
       blocker.categoryItem.classList.toggle("blocked", this.enabled && blocker.enabled);
     }
 
     // Check whether the user has added an exception for this site.
-    let hasException = false;
-    if (PrivateBrowsingUtils.isBrowserPrivate(gBrowser.selectedBrowser)) {
-      hasException = PrivateBrowsingUtils.existsInTrackingAllowlist(baseURI);
-    } else {
-      hasException = Services.perms.testExactPermission(baseURI,
-        "trackingprotection") == Services.perms.ALLOW_ACTION;
-    }
+    let type = PrivateBrowsingUtils.isBrowserPrivate(gBrowser.selectedBrowser) ?
+                 "trackingprotection-pb" :
+                 "trackingprotection";
+    let hasException = Services.perms.testExactPermission(baseURI, type) ==
+      Services.perms.ALLOW_ACTION;
 
     this.content.toggleAttribute("detected", detected);
     this.content.toggleAttribute("hasException", hasException);
 
     this.iconBox.toggleAttribute("active", active);
     this.iconBox.toggleAttribute("hasException", this.enabled && hasException);
 
     if (isSimulated) {
--- a/toolkit/components/privatebrowsing/PrivateBrowsingTrackingProtectionWhitelist.js
+++ b/toolkit/components/privatebrowsing/PrivateBrowsingTrackingProtectionWhitelist.js
@@ -30,27 +30,16 @@ PrivateBrowsingTrackingProtectionWhiteli
    *
    * @param uri nsIURI
    *        The URI to add to the list.
    */
   removeFromAllowList(uri) {
     Services.perms.remove(uri, "trackingprotection-pb");
   },
 
-  /**
-   * 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 Services.perms.testPermission(uri, "trackingprotection-pb") ==
-           Ci.nsIPermissionManager.ALLOW_ACTION;
-  },
-
   observe(subject, topic, data) {
     if (topic == "last-pb-context-exited") {
       Services.perms.removeByType("trackingprotection-pb");
     }
   }
 };
 
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PrivateBrowsingTrackingProtectionWhitelist]);
--- a/toolkit/components/privatebrowsing/nsIPrivateBrowsingTrackingProtectionWhitelist.idl
+++ b/toolkit/components/privatebrowsing/nsIPrivateBrowsingTrackingProtectionWhitelist.idl
@@ -26,21 +26,13 @@ interface nsIPrivateBrowsingTrackingProt
   /**
    * 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"
 %}
--- a/toolkit/modules/PrivateBrowsingUtils.jsm
+++ b/toolkit/modules/PrivateBrowsingUtils.jsm
@@ -55,20 +55,16 @@ var PrivateBrowsingUtils = {
   privacyContextFromWindow: function pbu_privacyContextFromWindow(aWindow) {
     return aWindow.docShell.QueryInterface(Ci.nsILoadContext);
   },
 
   addToTrackingAllowlist(aURI) {
     gPBMTPWhitelist.addToAllowList(aURI);
   },
 
-  existsInTrackingAllowlist(aURI) {
-    return gPBMTPWhitelist.existsInAllowList(aURI);
-  },
-
   removeFromTrackingAllowlist(aURI) {
     gPBMTPWhitelist.removeFromAllowList(aURI);
   },
 
   get permanentPrivateBrowsing() {
     try {
       return gTemporaryAutoStartMode ||
              Services.prefs.getBoolPref(kAutoStartPref);