Bug 1306536 - Don't set displayURI when it's set to false; r=mconley draft
authorChun-Min Chang <chun.m.chang@gmail.com>
Tue, 04 Oct 2016 13:27:32 +0800
changeset 420427 b3a9774ce78ac01f443068cd2375c59643739855
parent 420379 c8a660c5f105e60ad536ddde0c3edd637ab5b7c1
child 420428 8e7e4a54a5dcb778fcc5b0bfa5d53a277f555b26
child 420995 8e2a0a5ec1ac98bb4959c451055f1f2a2c722b6e
push id31194
push userbmo:cchang@mozilla.com
push dateTue, 04 Oct 2016 06:22:45 +0000
reviewersmconley
bugs1306536
milestone52.0a1
Bug 1306536 - Don't set displayURI when it's set to false; r=mconley MozReview-Commit-ID: DI52QqsS3BE
browser/modules/PermissionUI.jsm
--- a/browser/modules/PermissionUI.jsm
+++ b/browser/modules/PermissionUI.jsm
@@ -128,18 +128,19 @@ this.PermissionPromptPrototype = {
     return undefined;
   },
 
   /**
    * These are the options that will be passed to the
    * PopupNotification when it is shown. See the documentation
    * for PopupNotification for more details.
    *
-   * Note that prompt()  will automatically set displayURI to
-   * be the URI of the requesting pricipal.
+   * Note that prompt() will automatically set displayURI to
+   * be the URI of the requesting pricipal, unless the displayURI is exactly
+   * set to false.
    */
   get popupOptions() {
     return {};
   },
 
   /**
    * PopupNotification requires a unique ID to open the notification.
    * You must return a unique ID string here, for which PopupNotification
@@ -324,17 +325,20 @@ this.PermissionPromptPrototype = {
       popupNotificationActions.push(action);
     }
 
     let mainAction = popupNotificationActions.length ?
                      popupNotificationActions[0] : null;
     let secondaryActions = popupNotificationActions.splice(1);
 
     let options = this.popupOptions;
-    options.displayURI = this.principal.URI;
+
+    if (!options.hasOwnProperty('displayURI') || options.displayURI) {
+      options.displayURI = this.principal.URI;
+    }
 
     this.onBeforeShow();
     chromeWin.PopupNotifications.show(this.browser,
                                       this.notificationID,
                                       this.message,
                                       this.anchorID,
                                       mainAction,
                                       secondaryActions,