Bug 1527127 update addon panel text for private windows r=flod,Gijs,mstriemer,rpl
authorShane Caraveo <scaraveo@mozilla.com>
Wed, 27 Feb 2019 20:05:38 +0000
changeset 519395 30aad4a580eb65ad099c1c4c2d897db85b7a76ec
parent 519394 3063f37eb7b21e145478f9ee641d2945e0e36986
child 519396 2c0ca241bd4b662f7022beb535509164ab7cde51
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflod, Gijs, mstriemer, rpl
bugs1527127
milestone67.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 1527127 update addon panel text for private windows r=flod,Gijs,mstriemer,rpl Differential Revision: https://phabricator.services.mozilla.com/D19845
browser/components/customizableui/content/panelUI.inc.xul
browser/locales/en-US/chrome/browser/browser.dtd
browser/locales/en-US/chrome/browser/browser.properties
browser/modules/ExtensionsUI.jsm
browser/themes/linux/browser.css
browser/themes/osx/browser.css
browser/themes/shared/addon-notification.inc.css
browser/themes/windows/browser.css
toolkit/locales/en-US/toolkit/about/aboutAddons.ftl
toolkit/mozapps/extensions/content/extensions.xul
toolkit/mozapps/extensions/test/xpinstall/browser_doorhanger_installs.js
--- a/browser/components/customizableui/content/panelUI.inc.xul
+++ b/browser/components/customizableui/content/panelUI.inc.xul
@@ -147,40 +147,47 @@
       <description id="update-restart-description">&updateRestart.message2;</description>
     </popupnotificationcontent>
   </popupnotification>
 
   <popupnotification id="appMenu-addon-installed-notification"
                      popupid="addon-installed"
                      closebuttonhidden="true"
                      secondarybuttonhidden="true"
+                     buttonlabel="&addonPrivateBrowsing.okButton.label;"
+                     buttonaccesskey="&addonPrivateBrowsing.okButton.accesskey;"
                      dropmarkerhidden="true"
                      checkboxhidden="true"
                      buttonhighlight="true"
                      hidden="true">
     <popupnotificationcontent class="addon-installed-notification-content" orient="vertical">
       <description>&addonPostInstallMessage.label;</description>
+      <checkbox id="addon-incognito-checkbox"
+                label="&addonPostInstall.incognito.label;"
+                accesskey="&addonPostInstall.incognito.accesskey;"/>
     </popupnotificationcontent>
   </popupnotification>
 
   <popupnotification id="appMenu-addon-private-browsing-notification"
                      popupid="addon-private-browsing"
-                     label="&addonPrivateBrowsing.header.label;"
+                     label="&addonPrivateBrowsing.header2.label;"
                      closebuttonhidden="true"
                      secondarybuttonhidden="false"
                      buttonlabel="&addonPrivateBrowsing.manageButton.label;"
                      buttonaccesskey="&addonPrivateBrowsing.manageButton.accesskey;"
                      secondarybuttonlabel="&addonPrivateBrowsing.okButton.label;"
                      secondarybuttonaccesskey="&addonPrivateBrowsing.okButton.accesskey;"
                      dropmarkerhidden="true"
                      checkboxhidden="true"
                      buttonhighlight="true"
                      hidden="true">
     <popupnotificationcontent class="addon-private-browsing-notification-content" orient="vertical">
-      <description>&addonPrivateBrowsing.body.label;</description>
+      <description>&addonPrivateBrowsing.body2.label;</description>
+      <label id="addon-private-browsing-learn-more"
+             class="text-link" is="text-link">&addonPrivateBrowsing.learnMore.label;</label>
     </popupnotificationcontent>
   </popupnotification>
 </panel>
 
 <menupopup id="customizationPaletteItemContextMenu"
            onpopupshowing="gCustomizeMode.onPaletteContextMenuShowing(event)">
   <menuitem oncommand="gCustomizeMode.addToToolbar(document.popupNode)"
             class="customize-context-addToToolbar"
--- a/browser/locales/en-US/chrome/browser/browser.dtd
+++ b/browser/locales/en-US/chrome/browser/browser.dtd
@@ -1126,15 +1126,18 @@ you can use these alternative items. Oth
      used as a textual label for the indicator used by assistive technology
      users. -->
 <!ENTITY accessibilityIndicator.tooltip "Accessibility Features Enabled">
 
 <!-- LOCALIZATION NOTE: (addonPostInstallMessage.label):
      The first <image> tag is replaced with the icon for the add-ons menu.
      The second <image> tag is replaced with the icon for the toolbar menu. -->
 <!ENTITY addonPostInstallMessage.label "Manage your add-ons by clicking <image class='addon-addon-icon'/> in the <image class='addon-toolbar-icon'/> menu.">
+<!ENTITY addonPostInstall.incognito.label "Allow this extension to run in Private Windows.">
+<!ENTITY addonPostInstall.incognito.accesskey "A">
 
-<!ENTITY addonPrivateBrowsing.header.label "Extensions in Private Windows">
-<!ENTITY addonPrivateBrowsing.body.label "Extensions are not allowed to run by default in Private Windows. They won’t work while private browsing, and they won’t have access to your online activities. You can allow each extension to run in Private Windows by managing your settings.">
+<!ENTITY addonPrivateBrowsing.header2.label "Change to extensions in Private Windows">
+<!ENTITY addonPrivateBrowsing.body2.label "Any new extensions you add to &brandShorterName; won’t work in Private Windows unless you allow this in the settings.">
+<!ENTITY addonPrivateBrowsing.learnMore.label "Learn how to manage extension settings.">
 <!ENTITY addonPrivateBrowsing.okButton.label "Okay, Got It">
 <!ENTITY addonPrivateBrowsing.okButton.accesskey "O">
 <!ENTITY addonPrivateBrowsing.manageButton.label "Manage Extensions">
 <!ENTITY addonPrivateBrowsing.manageButton.accesskey "M">
--- a/browser/locales/en-US/chrome/browser/browser.properties
+++ b/browser/locales/en-US/chrome/browser/browser.properties
@@ -168,18 +168,16 @@ webext.remove.confirmation.title=Remove 
 webext.remove.confirmation.message=Remove %1$S from %2$S?
 webext.remove.confirmation.button=Remove
 
 # LOCALIZATION NOTE (addonPostInstall.message1)
 # %1$S is replaced with the localized named of the extension that was
 # just installed.
 # %2$S is replaced with the localized name of the application.
 addonPostInstall.message1=%1$S has been added to %2$S.
-addonPostInstall.okay.label=OK
-addonPostInstall.okay.key=O
 
 # LOCALIZATION NOTE (addonDownloadingAndVerifying):
 # Semicolon-separated list of plural forms. See:
 # http://developer.mozilla.org/en/docs/Localization_and_Plurals
 # Also see https://bugzilla.mozilla.org/show_bug.cgi?id=570012 for mockups
 addonDownloadingAndVerifying=Downloading and verifying add-on…;Downloading and verifying #1 add-ons…
 addonDownloadVerifying=Verifying
 
--- a/browser/modules/ExtensionsUI.jsm
+++ b/browser/modules/ExtensionsUI.jsm
@@ -8,27 +8,31 @@ var EXPORTED_SYMBOLS = ["ExtensionsUI"];
 const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 const {EventEmitter} = ChromeUtils.import("resource://gre/modules/EventEmitter.jsm");
 
 XPCOMUtils.defineLazyModuleGetters(this, {
   AddonManager: "resource://gre/modules/AddonManager.jsm",
   AddonManagerPrivate: "resource://gre/modules/AddonManager.jsm",
   AMTelemetry:  "resource://gre/modules/AddonManager.jsm",
   AppMenuNotifications: "resource://gre/modules/AppMenuNotifications.jsm",
+  BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
   ExtensionData: "resource://gre/modules/Extension.jsm",
+  ExtensionPermissions: "resource://gre/modules/ExtensionPermissions.jsm",
   PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
   Services: "resource://gre/modules/Services.jsm",
 });
 
 XPCOMUtils.defineLazyPreferenceGetter(this, "WEBEXT_PERMISSION_PROMPTS",
                                       "extensions.webextPermissionPrompts", false);
 XPCOMUtils.defineLazyPreferenceGetter(this, "allowPrivateBrowsingByDefault",
                                       "extensions.allowPrivateBrowsingByDefault", true);
 XPCOMUtils.defineLazyPreferenceGetter(this, "privateNotificationShown",
                                       "extensions.privatebrowsing.notification", false);
+XPCOMUtils.defineLazyPreferenceGetter(this, "SUPPORT_URL", "app.support.baseURL",
+                                      "", null, val => Services.urlFormatter.formatURL(val));
 
 const DEFAULT_EXTENSION_ICON = "chrome://mozapps/skin/extensions/extensionGeneric.svg";
 
 const BROWSER_PROPERTIES = "chrome://browser/locale/browser.properties";
 const BRAND_PROPERTIES = "chrome://branding/locale/brand.properties";
 
 const HTML_NS = "http://www.w3.org/1999/xhtml";
 
@@ -431,35 +435,52 @@ var ExtensionsUI = {
 
     let brandBundle = window.document.getElementById("bundle_brand");
     let appName = brandBundle.getString("brandShortName");
     let bundle = window.gNavigatorBundle;
 
     let message = bundle.getFormattedString("addonPostInstall.message1",
                                             ["<>", appName]);
     return new Promise(resolve => {
+      // Show or hide private permission ui based on the pref.
+      let checkbox = window.document.getElementById("addon-incognito-checkbox");
+      checkbox.checked = false;
+      checkbox.hidden = allowPrivateBrowsingByDefault ||
+                        PrivateBrowsingUtils.permanentPrivateBrowsing;
+
+      async function actionResolve() {
+        if (checkbox.checked) {
+          let perms = {permissions: ["internal:privateBrowsingAllowed"], origins: []};
+          await ExtensionPermissions.add(addon.id, perms);
+          // Reload the extension if it is already enabled.  This ensures any change
+          // on the private browsing permission is properly handled.
+          if (addon.isActive) {
+            await addon.reload();
+          }
+        }
+
+        resolve();
+      }
+
       let action = {
-        label: bundle.getString("addonPostInstall.okay.label"),
-        accessKey: bundle.getString("addonPostInstall.okay.key"),
-        callback: resolve,
+        callback: actionResolve,
       };
 
       let icon = addon.isWebExtension ?
                  AddonManager.getPreferredIconURL(addon, 32, window) || DEFAULT_EXTENSION_ICON :
                  "chrome://browser/skin/addons/addon-install-installed.svg";
       let options = {
         name: addon.name,
         message,
         popupIconURL: icon,
         onDismissed: () => {
           AppMenuNotifications.removeNotification("addon-installed");
-          resolve();
+          actionResolve();
         },
       };
-
       AppMenuNotifications.showNotification("addon-installed", action, null, options);
     });
   },
 
   promisePrivateBrowsingNotification(window) {
     return new Promise(resolve => {
       let action = {
         callback: () => {
@@ -474,30 +495,34 @@ var ExtensionsUI = {
       };
       let manage = {
         callback: () => {
           AMTelemetry.recordActionEvent({
             object: "doorhanger",
             action: "manage",
             view: "privateBrowsing",
           });
-          window.BrowserOpenAddonsMgr("addons://list/extension");
+          // Callback may happen in a different window, use the top window
+          // for the new tab.
+          let win = BrowserWindowTracker.getTopWindow();
+          win.BrowserOpenAddonsMgr("addons://list/extension");
           resolve();
         },
         dismiss: false,
       };
 
       let options = {
         popupIconURL: "chrome://browser/skin/addons/addon-private-browsing.svg",
         onDismissed: () => {
           AppMenuNotifications.removeNotification("addon-private-browsing");
           resolve();
         },
       };
-
+      window.document.getElementById("addon-private-browsing-learn-more")
+                     .setAttribute("href", SUPPORT_URL + "extensions-pb");
       AppMenuNotifications.showNotification("addon-private-browsing", manage, action, options);
     });
   },
 
   showPrivateBrowsingNotification(window) {
     // Show the addons private browsing panel the first time a private window
     // is opened.
     if (!allowPrivateBrowsingByDefault && !privateNotificationShown &&
--- a/browser/themes/linux/browser.css
+++ b/browser/themes/linux/browser.css
@@ -265,69 +265,17 @@ menuitem.bookmark-item {
 #identity-box:not(:active):-moz-focusring {
   outline: 1px dotted;
   outline-offset: -3px;
 }
 
 %include ../shared/identity-block/identity-block.inc.css
 
 %include ../shared/notification-icons.inc.css
-
-.popup-notification-body[popupid="addon-progress"],
-.popup-notification-body[popupid="addon-install-confirmation"] {
-  width: 28em;
-  max-width: 28em;
-}
-
-.addon-install-confirmation-name {
-  font-weight: bold;
-}
-
-html|*.addon-webext-perm-list {
-  margin-block-end: 0;
-  padding-inline-start: 10px;
-}
-
-.addon-webext-perm-text {
-  margin-inline-start: 0;
-}
-
-.popup-notification-description[popupid="addon-webext-permissions"],
-.popup-notification-description[popupid="addon-webext-permissions-notification"] {
-  margin-inline-start: -1px;
-}
-
-.addon-webext-perm-notification-content,
-.addon-installed-notification-content {
-  margin-top: 0;
-}
-
-.addon-webext-name {
-  display: inline;
-  font-weight: bold;
-  margin: 0;
-}
-
-.addon-addon-icon,
-.addon-toolbar-icon {
-  width: 14px;
-  height: 14px;
-  vertical-align: bottom;
-  margin-bottom: 1px;
-  -moz-context-properties: fill;
-  fill: currentColor;
-}
-
-.addon-addon-icon {
-  list-style-image: url("chrome://mozapps/skin/extensions/extensionGeneric-16.svg");
-}
-
-.addon-toolbar-icon {
-  list-style-image: url("chrome://browser/skin/menu.svg");
-}
+%include ../shared/addon-notification.inc.css
 
 /* Notification icon box */
 
 .notification-anchor-icon:-moz-focusring {
   outline: 1px dotted -moz-DialogText;
 }
 
 /* Translation infobar */
--- a/browser/themes/osx/browser.css
+++ b/browser/themes/osx/browser.css
@@ -821,68 +821,17 @@ menulist.translate-infobar-element[open=
                                     rgba(255,255,255,0.6));
 }
 
 menulist.translate-infobar-element > .menulist-dropmarker {
   display: -moz-box;
   list-style-image: url("chrome://global/skin/icons/arrow-dropdown-12.svg");
 }
 
-.popup-notification-body[popupid="addon-progress"],
-.popup-notification-body[popupid="addon-install-confirmation"] {
-  width: 28em;
-  max-width: 28em;
-}
-
-.addon-install-confirmation-name {
-  font-weight: bold;
-}
-
-html|*.addon-webext-perm-list {
-  margin-block-end: 0;
-  padding-inline-start: 10px;
-}
-
-.addon-webext-perm-text {
-  margin-inline-start: 0;
-}
-
-.popup-notification-description[popupid="addon-webext-permissions"],
-.popup-notification-description[popupid="addon-webext-permissions-notification"] {
-  margin-inline-start: -1px;
-}
-
-.addon-webext-perm-notification-content,
-.addon-installed-notification-content {
-  margin-top: 0;
-}
-
-.addon-webext-name {
-  display: inline;
-  font-weight: bold;
-  margin: 0;
-}
-
-.addon-addon-icon,
-.addon-toolbar-icon {
-  width: 14px;
-  height: 14px;
-  vertical-align: bottom;
-  margin-bottom: 1px;
-  -moz-context-properties: fill;
-  fill: currentColor;
-}
-
-.addon-addon-icon {
-  list-style-image: url("chrome://mozapps/skin/extensions/extensionGeneric-16.svg");
-}
-
-.addon-toolbar-icon {
-  list-style-image: url("chrome://browser/skin/menu.svg");
-}
+%include ../shared/addon-notification.inc.css
 
 /* Status panel */
 
 #statuspanel-label {
   margin: 0;
   padding: 2px 4px;
   background-color: #f9f9fa;
   border: 1px none #ddd;
new file mode 100644
--- /dev/null
+++ b/browser/themes/shared/addon-notification.inc.css
@@ -0,0 +1,63 @@
+%if 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/. */
+%endif
+
+.popup-notification-body[popupid="addon-progress"],
+.popup-notification-body[popupid="addon-install-confirmation"] {
+  width: 28em;
+  max-width: 28em;
+}
+
+.addon-install-confirmation-name {
+  font-weight: bold;
+}
+
+html|*.addon-webext-perm-list {
+  margin-block-end: 0;
+  padding-inline-start: 10px;
+}
+
+.addon-webext-perm-text {
+  margin-inline-start: 0;
+}
+
+.popup-notification-description[popupid="addon-webext-permissions"],
+.popup-notification-description[popupid="addon-webext-permissions-notification"] {
+  margin-inline-start: -1px;
+}
+
+.addon-webext-perm-notification-content,
+.addon-installed-notification-content {
+  margin-top: 0;
+}
+
+.addon-installed-notification-content > checkbox {
+  margin: 8px 4px 2px;
+  flex-wrap: wrap;
+}
+
+.addon-webext-name {
+  display: inline;
+  font-weight: bold;
+  margin: 0;
+}
+
+.addon-addon-icon,
+.addon-toolbar-icon {
+  width: 14px;
+  height: 14px;
+  vertical-align: bottom;
+  margin-bottom: 1px;
+  -moz-context-properties: fill;
+  fill: currentColor;
+}
+
+.addon-addon-icon {
+  list-style-image: url("chrome://mozapps/skin/extensions/extensionGeneric-16.svg");
+}
+
+.addon-toolbar-icon {
+  list-style-image: url("chrome://browser/skin/menu.svg");
+}
--- a/browser/themes/windows/browser.css
+++ b/browser/themes/windows/browser.css
@@ -758,69 +758,17 @@ toolbarbutton.bookmark-item[dragover="tr
 .menupopup-drop-indicator {
   list-style-image: none;
   height: 2px;
   margin-inline-end: -4em;
   background-color: Highlight;
 }
 
 %include ../shared/notification-icons.inc.css
-
-.popup-notification-body[popupid="addon-progress"],
-.popup-notification-body[popupid="addon-install-confirmation"] {
-  width: 28em;
-  max-width: 28em;
-}
-
-.addon-install-confirmation-name {
-  font-weight: bold;
-}
-
-html|*.addon-webext-perm-list {
-  margin-block-end: 0;
-  padding-inline-start: 10px;
-}
-
-.addon-webext-perm-text {
-  margin-inline-start: 0;
-}
-
-.popup-notification-description[popupid="addon-webext-permissions"],
-.popup-notification-description[popupid="addon-webext-permissions-notification"] {
-  margin-inline-start: -1px;
-}
-
-.addon-webext-perm-notification-content,
-.addon-installed-notification-content {
-  margin-top: 0;
-}
-
-.addon-webext-name {
-  display: inline;
-  font-weight: bold;
-  margin: 0;
-}
-
-.addon-addon-icon,
-.addon-toolbar-icon {
-  width: 14px;
-  height: 14px;
-  vertical-align: bottom;
-  margin-bottom: 1px;
-  -moz-context-properties: fill;
-  fill: currentColor;
-}
-
-.addon-addon-icon {
-  list-style-image: url("chrome://mozapps/skin/extensions/extensionGeneric-16.svg");
-}
-
-.addon-toolbar-icon {
-  list-style-image: url("chrome://browser/skin/menu.svg");
-}
+%include ../shared/addon-notification.inc.css
 
 /* Notification icon box */
 
 .notification-anchor-icon:-moz-focusring {
   outline: 1px dotted -moz-DialogText;
 }
 
 /* Translation infobar */
--- a/toolkit/locales/en-US/toolkit/about/aboutAddons.ftl
+++ b/toolkit/locales/en-US/toolkit/about/aboutAddons.ftl
@@ -198,21 +198,22 @@ plugin-deprecation-description =
 legacy-warning-show-legacy = Show legacy extensions
 
 legacy-extensions =
     .value = Legacy Extensions
 
 legacy-extensions-description =
     These extensions do not meet current { -brand-short-name } standards so they have been deactivated. <label data-l10n-name="legacy-learn-more">Learn about the changes to add-ons</label>
 
-private-browsing-description =
-    Extensions are not allowed to run by default in Private Windows. This means they won’t work
-    while private browsing, and they won’t have access to your online activities there. To allow
-    an extension to run in Private Windows, select the extension card below and change your setting.
-    <label data-l10n-name="private-browsing-learn-more">Learn More.</label>
+private-browsing-description2 =
+    { -brand-short-name } is changing how extensions work in private browsing. Any new extensions you add to
+    { -brand-short-name } won’t run by default in Private Windows. Unless you allow it in settings, the
+    extension won’t work while private browsing, and won’t have access to your online activities
+    there. We’ve made this change to keep your private browsing private.
+    <label data-l10n-name="private-browsing-learn-more">Learn how to manage extension settings.</label>
 
 extensions-view-discover =
     .name = Get Add-ons
     .tooltiptext = { extensions-view-discover.name }
 
 extensions-view-recent-updates =
     .name = Recent Updates
     .tooltiptext = { extensions-view-recent-updates.name }
--- a/toolkit/mozapps/extensions/content/extensions.xul
+++ b/toolkit/mozapps/extensions/content/extensions.xul
@@ -311,17 +311,17 @@
                     <label class="plain" id="legacy-extensions-learnmore-link" data-l10n-id="legacy-warning-show-legacy" is="text-link"/>
                   </description>
                 </vbox>
               </vbox>
               <vbox id="private-browsing-notice" class="alert-container" hidden="true" align="start">
                 <hbox class="message-bar" align="start">
                   <image class="message-bar-icon"/>
                   <vbox class="message-container">
-                    <description class="message-bar-description" data-l10n-id="private-browsing-description">
+                    <description class="message-bar-description" data-l10n-id="private-browsing-description2">
                       <label class="plain" id="private-browsing-learnmore-link" data-l10n-name="private-browsing-learn-more" is="text-link"/>
                     </description>
                   </vbox>
                 </hbox>
               </vbox>
               <vbox id="plugindeprecation-notice" class="list-view-notice" align="start">
                 <hbox class="message-bar">
                   <image class="message-bar-icon"/>
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_doorhanger_installs.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_doorhanger_installs.js
@@ -68,17 +68,17 @@ async function waitForProgressNotificati
     ok(notification, `Should have seen the right notification`);
     is(notification.button.hasAttribute("disabled"), wantDisabled,
        "The install button should be disabled?");
   }
 
   return PopupNotifications.panel;
 }
 
-function acceptAppMenuNotificationWhenShown(id, dismiss = false) {
+function acceptAppMenuNotificationWhenShown(id, {dismiss = false, checkIncognito = false} = {}) {
   const {AppMenuNotifications} = ChromeUtils.import("resource://gre/modules/AppMenuNotifications.jsm");
   return new Promise(resolve => {
     function appMenuPopupHidden() {
       PanelUI.panel.removeEventListener("popuphidden", appMenuPopupHidden);
       is(PanelUI.menuButton.getAttribute("badge-status"), false, "badge is not set after addon-installed");
       resolve();
     }
     function appMenuPopupShown() {
@@ -91,16 +91,24 @@ function acceptAppMenuNotificationWhenSh
         return;
       }
 
       is(notification.id, id, `${id} notification shown`);
       ok(PanelUI.isNotificationPanelOpen, "notification panel open");
 
       PanelUI.notificationPanel.removeEventListener("popupshown", popupshown);
 
+      let allowPrivate = Services.prefs.getBoolPref("extensions.allowPrivateBrowsingByDefault", true);
+      let checkbox = document.getElementById("addon-incognito-checkbox");
+      is(checkbox.hidden, allowPrivate && !checkIncognito, "checkbox visibility is correct");
+      is(checkbox.checked, false, "checkbox is not initially checked");
+      if (checkIncognito) {
+        checkbox.checked = true;
+      }
+
       if (dismiss) {
         // Dismiss the panel by clicking on the appMenu button.
         PanelUI.panel.addEventListener("popupshown", appMenuPopupShown);
         PanelUI.panel.addEventListener("popuphidden", appMenuPopupHidden);
         PanelUI.menuButton.click();
         return;
       }
 
@@ -277,16 +285,17 @@ async function test_blockedInstall() {
 
   let addon = await AddonManager.getAddonByID("amosigned-xpi@tests.mozilla.org");
   addon.uninstall();
 
   await BrowserTestUtils.removeTab(gBrowser.selectedTab);
 },
 
 async function test_whitelistedInstall() {
+  Services.prefs.setBoolPref("extensions.allowPrivateBrowsingByDefault", false);
   let originalTab = gBrowser.selectedTab;
   let tab;
   gBrowser.selectedTab = originalTab;
   let pm = Services.perms;
   pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
 
   let progressPromise = waitForProgressNotification();
   let dialogPromise = waitForInstallDialog();
@@ -297,27 +306,36 @@ async function test_whitelistedInstall()
                                                 + triggers).then(newTab => tab = newTab);
   await progressPromise;
   let installDialog = await dialogPromise;
   await BrowserTestUtils.waitForCondition(() => !!tab, "tab should be present");
 
   is(gBrowser.selectedTab, tab,
      "tab selected in response to the addon-install-confirmation notification");
 
-  let notificationPromise = acceptAppMenuNotificationWhenShown("addon-installed", true);
+  let notificationPromise = acceptAppMenuNotificationWhenShown("addon-installed", {dismiss: true});
   acceptInstallDialog(installDialog);
   await notificationPromise;
 
   let installs = await AddonManager.getAllInstalls();
   is(installs.length, 0, "Should be no pending installs");
 
   let addon = await AddonManager.getAddonByID("amosigned-xpi@tests.mozilla.org");
+
+  // Test that the addon does not have permission. Reload it to ensure it would
+  // have been set if possible.
+  await addon.reload();
+  let policy = WebExtensionPolicy.getByID(addon.id);
+  ok(!policy.privateBrowsingAllowed, "private browsing permission was not granted");
+
   addon.uninstall();
 
   Services.perms.remove(makeURI("http://example.com/"), "install");
+
+  Services.prefs.clearUserPref("extensions.allowPrivateBrowsingByDefault");
   await removeTabAndWaitForNotificationClose();
 },
 
 async function test_failedDownload() {
   let pm = Services.perms;
   pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
 
   let progressPromise = waitForProgressNotification();
@@ -415,38 +433,50 @@ async function test_localFile() {
   is(notification.getAttribute("label"),
      "This add-on could not be installed because it appears to be corrupt.",
      "Should have seen the right message");
 
   await removeTabAndWaitForNotificationClose();
 },
 
 async function test_urlBar() {
+  Services.prefs.setBoolPref("extensions.allowPrivateBrowsingByDefault", false);
   let progressPromise = waitForProgressNotification();
   let dialogPromise = waitForInstallDialog();
 
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:blank");
   await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
   gURLBar.value = TESTROOT + "amosigned.xpi";
   gURLBar.focus();
   EventUtils.synthesizeKey("KEY_Enter");
 
   await progressPromise;
   let installDialog = await dialogPromise;
 
-  let notificationPromise = acceptAppMenuNotificationWhenShown("addon-installed");
+  let notificationPromise = acceptAppMenuNotificationWhenShown("addon-installed", {checkIncognito: true});
   installDialog.button.click();
   await notificationPromise;
 
   let installs = await AddonManager.getAllInstalls();
   is(installs.length, 0, "Should be no pending installs");
 
   let addon = await AddonManager.getAddonByID("amosigned-xpi@tests.mozilla.org");
+  // The panel is reloading the addon due to the permission change, we need some way
+  // to wait for the reload to finish. addon.startupPromise doesn't do it for
+  // us, so we'll just restart again.
+  await addon.reload();
+
+  // This addon should have private browsing permission.
+  let policy = WebExtensionPolicy.getByID(addon.id);
+  ok(policy.privateBrowsingAllowed, "private browsing permission granted");
+
   addon.uninstall();
 
+  Services.prefs.clearUserPref("extensions.allowPrivateBrowsingByDefault");
+
   await removeTabAndWaitForNotificationClose();
 },
 
 async function test_wrongHost() {
   let requestedUrl = TESTROOT2 + "enabled.html";
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
 
   let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, requestedUrl);
@@ -620,16 +650,17 @@ add_task(async function() {
     aInstalls.forEach(function(aInstall) {
       aInstall.cancel();
     });
 
     Services.prefs.clearUserPref("extensions.logging.enabled");
     Services.prefs.clearUserPref("extensions.strictCompatibility");
     Services.prefs.clearUserPref("extensions.install.requireSecureOrigin");
     Services.prefs.clearUserPref("security.dialog_enable_delay");
+    Services.prefs.clearUserPref("extensions.allowPrivateBrowsingByDefault");
 
     Services.obs.removeObserver(XPInstallObserver, "addon-install-started");
     Services.obs.removeObserver(XPInstallObserver, "addon-install-blocked");
     Services.obs.removeObserver(XPInstallObserver, "addon-install-failed");
   });
 
   for (let i = 0; i < TESTS.length; ++i) {
     if (gTestStart)