Bug 1511249 - Ensure that 3rdPartyStorage permissions are checked with the exact tracker origin not just with a prefix r=johannh
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 30 Nov 2018 14:36:36 +0000
changeset 508198 67670eab469be12d0626017f0bfedd6967d04320
parent 508197 ffa678d05ff52183eb3f56a61234248cbd51a9cb
child 508199 7b2786f1874312c62136e47722ffa55911fe8a4f
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1511249
milestone65.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 1511249 - Ensure that 3rdPartyStorage permissions are checked with the exact tracker origin not just with a prefix r=johannh Differential Revision: https://phabricator.services.mozilla.com/D13499
browser/modules/PermissionUI.jsm
--- a/browser/modules/PermissionUI.jsm
+++ b/browser/modules/PermissionUI.jsm
@@ -1046,16 +1046,23 @@ StorageAccessPermissionPrompt.prototype 
   },
 
   getOriginsThirdPartyHasAccessTo(thirdPartyOrigin) {
     let prefix = `3rdPartyStorage^${thirdPartyOrigin}`;
     let perms = Services.perms.getAllWithTypePrefix(prefix);
     let origins = new Set();
     while (perms.length) {
       let perm = perms.shift();
+      // Let's make sure that we're not looking at a permission for
+      // https://exampletracker.company when we mean to look for the
+      // permisison for https://exampletracker.com!
+      if (perm.type != prefix &&
+          !perm.type.startsWith(`${prefix}^`)) {
+        continue;
+      }
       origins.add(perm.principal.origin);
     }
     return origins.size;
   },
 
   onBeforeShow() {
     let thirdPartyOrigin = this.request.principal.origin;
     if (this._autoGrants &&