Bug 870728 The Geolocation prompt should not offer action in PB mode if the action remembers permission for more than a session r=Neil.
authorPhilip Chee <philip.chee@gmail.com>
Sat, 01 Jun 2013 02:28:53 +0800
changeset 12534 39546ca48c28919a875265d601f336e0ccabfe71
parent 12533 fe1ad12926b0803de6d8db184a185ffdec5acd1b
child 12535 800dca20e0a25e96b7a55192281f023c0e4d4d5b
push id9218
push userphilip.chee@gmail.com
push dateFri, 31 May 2013 18:45:03 +0000
treeherdercomm-central@1bc26fe50696 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil
bugs870728
Bug 870728 The Geolocation prompt should not offer action in PB mode if the action remembers permission for more than a session r=Neil.
suite/common/bindings/notification.xml
--- a/suite/common/bindings/notification.xml
+++ b/suite/common/bindings/notification.xml
@@ -75,16 +75,23 @@
               this._cwu = this.activeBrowser.contentWindow
                               .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                               .getInterface(Components.interfaces.nsIDOMWindowUtils);
             return this._cwu;
           ]]>
         </getter>
       </property>
 
+      <field name="usePrivateBrowsing" readonly="true">
+        window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+              .getInterface(Components.interfaces.nsIWebNavigation)
+              .QueryInterface(Components.interfaces.nsILoadContext)
+              .usePrivateBrowsing
+      </field>
+
       <method name="onDocumentChange">
         <body>
           <![CDATA[
             this.missingPlugins = null;
             this.crashNotified = false;
             this.clickToPlayPromptShown = false;
             this.clickToPlayPluginsActivated = false;
             if (this.popupCount) {
@@ -1406,17 +1413,20 @@
                                                   [file], 1);
             var box = this.appendNotification(message, type, null,
                                               this.PRIORITY_INFO_HIGH, buttons);
             // Force a style flush, so that we ensure the binding is attached.
             box.clientTop;
 
             // Create a dummy checkbox so file requests don't try to remember.
             box.checkbox = { checked: false };
-            if (site) {
+
+            // Don't offer action in Private Browsing mode if the action
+            // remembers permission for more than a session.
+            if (site && !this.usePrivateBrowsing) {
               box.checkbox = document.createElement("checkbox");
               box.checkbox.className = "rememberChoice";
               box.checkbox.setAttribute("label", this._stringBundle.GetStringFromName(type + ".remember"));
               box.appendChild(box.checkbox);
             }
 
             var link = document.createElement("label");
             link.className = "text-link";
@@ -2473,26 +2483,30 @@
             }, {
               label: this._stringBundle.GetStringFromName(type + ".alwaysShareLocation"),
               accessKey: this._stringBundle.GetStringFromName(type + ".alwaysShareLocation.accesskey"),
               callback: function (aNotification) {
                 allowCallback(true);
               }
             }];
 
+            // Don't offer action in Private Browsing mode if the action
+            // remembers permission for more than a session.
+            if (file || this.usePrivateBrowsing)
+              secondaryActions.length = 1;
+
             var message;
             if (site) {
               message = this._stringBundle
                             .formatStringFromName(type + ".siteWantsToKnow",
                                                   [site], 1);
             } else {
               message = this._stringBundle
                             .formatStringFromName(type + ".fileWantsToKnow",
                                                   [file], 1);
-              secondaryActions.length = 1;
             }
 
             var options = {
               value: this._stringBundle.GetStringFromName(type + ".learnMore"),
               href: this._urlFormatter.formatURLPref("browser." + type + ".warning.infoURL")
             };
 
             PopupNotifications.show(this.activeBrowser,