Bug 510424 - Geolocation notification does not show requester of location for file:// URLs. r=dougt/gavin ui=beltzner
authorMartin McNickle <mmcnicklebugs@googlemail.com>
Sat, 12 Dec 2009 13:39:26 -0800
changeset 35684 0fbd5f6785090492cf757f5284b977f2913ddb83
parent 35683 296f74e81dcab9c8d3b64b6892d5236baa7b6b9b
child 35685 cedb40879bc62f3fb4dc656fa8c615fc632678f4
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
bugs510424
milestone1.9.3a1pre
Bug 510424 - Geolocation notification does not show requester of location for file:// URLs. r=dougt/gavin ui=beltzner
browser/components/nsBrowserGlue.js
browser/locales/en-US/chrome/browser/browser.properties
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -1196,18 +1196,26 @@ GeolocationPrompt.prototype = {
               callback: function(notification) {
                   var elements = notification.getElementsByClassName("rememberChoice");
                   if (elements.length && elements[0].checked)
                       setPagePermission(request.requestingURI, false);
                   request.cancel();
               },
           }];
       
-      var message = browserBundle.formatStringFromName("geolocation.siteWantsToKnow",
-                                                       [request.requestingURI.host], 1);      
+      var message;
+
+      // Different message/info if it is a local file
+      if (request.requestingURI.schemeIs("file")) {
+        message = browserBundle.formatStringFromName("geolocation.fileWantsToKnow",
+                                                     [request.requestingURI.path], 1);
+      } else {
+        message = browserBundle.formatStringFromName("geolocation.siteWantsToKnow",
+                                                     [request.requestingURI.host], 1);
+      }
 
       var newBar = notificationBox.appendNotification(message,
                                                       "geolocation",
                                                       "chrome://browser/skin/Geo.png",
                                                       notificationBox.PRIORITY_INFO_HIGH,
                                                       buttons);
 
       // For whatever reason, if we do this immediately
--- a/browser/locales/en-US/chrome/browser/browser.properties
+++ b/browser/locales/en-US/chrome/browser/browser.properties
@@ -191,16 +191,17 @@ editBookmark.removeBookmarks.label=Remov
 
 # LOCALIZATION NOTE (geolocation.shareLocation geolocation.dontShareLocation): 
 #If you're having trouble with the word Share, please use Allow and Block in your language.
 geolocation.shareLocation=Share Location
 geolocation.shareLocation.accesskey=a
 geolocation.dontShareLocation=Don't Share
 geolocation.dontShareLocation.accesskey=o
 geolocation.siteWantsToKnow=%S wants to know your location.
+geolocation.fileWantsToKnow=The file %S wants to know your location.
 # LOCALIZATION NOTE (geolocation.learnMore): Use the unicode ellipsis char, \u2026,
 # or use "..." if \u2026 doesn't suit traditions in your locale.
 geolocation.learnMore=Learn Moreā€¦
 geolocation.remember=Remember for this site
 geolocation.remember.accesskey=R
 
 # Phishing/Malware Notification Bar.
 # LOCALIZATION NOTE (notAForgery, notAnAttack)