Bug 1538546 - Check AddonManager PERM_CAN_CHANGE_PRIVATEBROWSING_ACCESS permission instead of the incognito manifest property. r=kmag,mixedpuppy
authorLuca Greco <lgreco@mozilla.com>
Tue, 26 Mar 2019 19:04:01 +0000
changeset 466387 96def3091254f269c517bf29b808c03a6f056a68
parent 466386 2b51e70c12fbda2e2ff0c9a929743b3709b9eaca
child 466388 ac9662d71fec689129fb315a9aac1f8a6166bbd4
push id35768
push useropoprus@mozilla.com
push dateThu, 28 Mar 2019 09:55:54 +0000
treeherdermozilla-central@c045dd97faf2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag, mixedpuppy
bugs1538546
milestone68.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 1538546 - Check AddonManager PERM_CAN_CHANGE_PRIVATEBROWSING_ACCESS permission instead of the incognito manifest property. r=kmag,mixedpuppy Depends on D24719 Differential Revision: https://phabricator.services.mozilla.com/D24720
browser/modules/ExtensionsUI.jsm
toolkit/mozapps/extensions/content/extensions.js
--- a/browser/modules/ExtensionsUI.jsm
+++ b/browser/modules/ExtensionsUI.jsm
@@ -138,21 +138,20 @@ var ExtensionsUI = {
 
     this.showAddonsManager(browser, strings, addon.iconURL, "sideload")
         .then(async answer => {
           if (answer) {
             await addon.enable();
 
             this._updateNotifications();
 
-            // If private browsing access is not allowed by default,
-            // show the post-install doorhanger notification to
-            // allow the user to give the extension access from the
-            // checkbox included in the doorhanger.
-            if (!allowPrivateBrowsingByDefault && addon.incognito !== "not_allowed") {
+            // The user has just enabled a sideloaded extension, if the permission
+            // can be changed for the extension, show the post-install panel to
+            // give the user that opportunity.
+            if (addon.permissions & AddonManager.PERM_CAN_CHANGE_PRIVATEBROWSING_ACCESS) {
               this.showInstallNotification(browser, addon);
             }
           }
           this.emit("sideload-response");
         });
   },
 
   showUpdate(browser, info) {
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -1280,21 +1280,20 @@ var gViewController = {
                 info: {
                   type: "sideload",
                   addon: aAddon,
                   icon: aAddon.iconURL,
                   permissions: perms,
                   resolve() {
                     aAddon.markAsSeen();
                     aAddon.enable().then(() => {
-                      // If private browsing access is not allowed by default,
-                      // show the post-install doorhanger notification to
-                      // allow the user to give the extension access from the
-                      // checkbox included in the doorhanger.
-                      if (!allowPrivateBrowsingByDefault && aAddon.incognito !== "not_allowed") {
+                      // The user has just enabled a sideloaded extension, if the permission
+                      // can be changed for the extension, show the post-install panel to
+                      // give the user that opportunity.
+                      if (aAddon.permissions & AddonManager.PERM_CAN_CHANGE_PRIVATEBROWSING_ACCESS) {
                         Services.obs.notifyObservers({
                           addon: aAddon, target,
                         }, "webextension-install-notify");
                       }
                     });
                   },
                   reject() {},
                 },