Bug 1521598 - Part 2: Only update the identity panel for permissions that are visible inside it; r=johannh
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 23 Jan 2019 15:57:10 +0000
changeset 515118 ce0aae2058f2a3a4321e562b29e3a5a340d92e10
parent 515117 b6167098e831d161bfa877537aa9f5e0c6bd83a2
child 515119 1428560105ca3feeb8c8ad2aa023d6355a0be395
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1521598
milestone66.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 1521598 - Part 2: Only update the identity panel for permissions that are visible inside it; r=johannh Profiles show that we do a lot of needless work in response to notifications for other permissions such as "storageAccessAPI". Depends on D17362 Differential Revision: https://phabricator.services.mozilla.com/D17155
browser/base/content/browser-siteIdentity.js
--- a/browser/base/content/browser-siteIdentity.js
+++ b/browser/base/content/browser-siteIdentity.js
@@ -895,17 +895,21 @@ var gIdentityHandler = {
       // Hide the panel when focusing an element that is
       // neither an ancestor nor descendant unless the panel has
       // @noautohide (e.g. for a tour).
       PanelMultiView.hidePopup(this._identityPopup);
     }
   },
 
   observe(subject, topic, data) {
-    if (topic == "perm-changed") {
+    // Exclude permissions which do not appear in the UI in order to avoid
+    // doing extra work here.
+    if (topic == "perm-changed" && subject &&
+        SitePermissions.listPermissions().includes(
+          subject.QueryInterface(Ci.nsIPermission).type)) {
       this.refreshIdentityBlock();
     }
   },
 
   onDragStart(event) {
     if (gURLBar.getAttribute("pageproxystate") != "valid")
       return;