Bug 870728 The Geolocation prompt should not offer action in PB mode if the action remembers permission for more than a session r=Neil a=Callek
authorPhilip Chee <philip.chee@gmail.com>
Sat, 11 May 2013 02:47:20 +0800
changeset 15307 659a7205d5b92c5f6384c57515c4995bb3318857
parent 15306 3b677d66a77c9f531879ab2bf631f247cefd35b1
child 15308 2214c8559f0f1b942ac868b9e3d8127d3e88cc91
push id910
push userphilip.chee@gmail.com
push dateSat, 01 Jun 2013 16:28:02 +0000
treeherdercomm-beta@659a7205d5b9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil, Callek
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 a=Callek a=CLOSED TREE
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,