Bug 510523 - Checking "Remember for this site" stops prompt from working on file:// URIs. r=dougt/gavin
authorMartin McNickle <mmcnicklebugs@googlemail.com>
Sun, 13 Dec 2009 14:38:16 -0800
changeset 35685 cedb40879bc62f3fb4dc656fa8c615fc632678f4
parent 35684 0fbd5f6785090492cf757f5284b977f2913ddb83
child 35686 8291a0d511ae0d47fe8d2efaa048dc96f950805c
push id10679
push userdougt@mozilla.com
push dateSun, 13 Dec 2009 22:39:47 +0000
treeherdermozilla-central@cedb40879bc6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdougt, gavin
bugs510523
milestone1.9.3a1pre
Bug 510523 - Checking "Remember for this site" stops prompt from working on file:// URIs. r=dougt/gavin
browser/components/nsBrowserGlue.js
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -1223,17 +1223,24 @@ GeolocationPrompt.prototype = {
       // element does not show up in the notification
       // bar.
       function geolocation_hacks_to_notification () {
 
         // Never show a remember checkbox inside the private browsing mode
         var inPrivateBrowsing = Cc["@mozilla.org/privatebrowsing;1"].
                                 getService(Ci.nsIPrivateBrowsingService).
                                 privateBrowsingEnabled;
-        if (!inPrivateBrowsing) {
+
+        // don't show "Remember for this site" checkbox for file:
+        var host;
+        try {
+            host = request.requestingURI.host;
+        } catch (ex) {}
+
+        if (!inPrivateBrowsing && host) {
           var checkbox = newBar.ownerDocument.createElementNS(XULNS, "checkbox");
           checkbox.className = "rememberChoice";
           checkbox.setAttribute("label", browserBundle.GetStringFromName("geolocation.remember"));
           checkbox.setAttribute("accesskey", browserBundle.GetStringFromName("geolocation.remember.accesskey"));
           newBar.appendChild(checkbox);
         }
 
         var link = newBar.ownerDocument.createElementNS(XULNS, "label");