Closed Bug 713304 Opened 13 years ago Closed 12 years ago

Setting geo.wifi.uri in FF9.0.1 results in error 2 when calling navigator.geolocation.getCurrentPosition in Javascript

Categories

(Core :: DOM: Geolocation, defect)

9 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: felixcatukpublic, Unassigned)

Details

Attachments

(5 files)

User Agent: Mozilla/5.0 (Windows NT 5.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1

Steps to reproduce:

FF 9.0. 1 (English/32 bit Windows).

Configured geo.wifi.uri to be a custom setting; for example https://www.google.com/loc/json (believe this is the default used on previous versions of FF).





Actual results:

Under FF3.6 Javascript calls to navigator.geolocation.getCurrentPosition resulted in a valid geolocation lat/long.

Under FF9.0.1 Javascript calls to navigator.geolocation.getCurrentPosition result in an error on callback (code: 2, message: undefined).



Expected results:

On callback, a geolocation lat/long should have been parsed from the return JSON data.

The geolocation providers (including Google) have been tested independently using wget with sample access point data, and are functioning correctly... returning correctly structured JSON geolocation data.
Component: General → Geolocation
Product: Firefox → Core
QA Contact: general → geolocation
Test page used to diagnose/investigate the problem. Works fine under FF3.6/XP, fails under FF9.0.1/WinXP.
Attachment #584137 - Attachment description: FF3.2.6 test case displaying lat/long details as expected → FF3.6.24 test case displaying lat/long details as expected
Summary: Setting geo.wifi.url in FF9.0.1 results in error 2 when calling navigator.geolocation.getCurrentPosition in Javascript → Setting geo.wifi.uri in FF9.0.1 results in error 2 when calling navigator.geolocation.getCurrentPosition in Javascript
With geo.wifi.uri set to match the hard coded value in the NetworkGeolocationProvider.js source code (https://maps.googleapis.com/maps/api/browserlocation/json) geolocation works fine.

Setting geo.wifi.logging enabled, and looking at the logging output, it seems the format of the JSON geolocation request/response has indeed changed... 

*** WIFI GEO: onChange called
*** WIFI GEO: ************************************* Sending request:
https://maps.googleapis.com/maps/api/browserlocation/json?browser=firefox&sensor
=true

*** WIFI GEO: ************************************* ------>>>> sending.
*** WIFI GEO: service returned: {
   "accuracy" : 25000.0,
   "location" : {
      "lat" : 51.000000,
      "lng" : -0.0000000
   },
   "status" : "OK"
}

*** WIFI GEO: shutdown called

For comparison, manually invoking the old geo.wifi.url (https://www.google.com/loc/json) with wget results in a response in this format;

{"location":{"latitude":51.0,"longitude":-0.1,"address":{"country":"United Kingd
om","country_code":"GB","city":"Haywards Heath","street":"Fairford Close","stree
t_number":"8","postal_code":"RH16 3EF"}},"access_token":"2:mduFkkwXVvMJI4Ve:Qow7
c9zk80hGcZRl"}

Setting the old preference value for geo.wifi.url (https://www.google.com/loc/json) suggests that the request format is also completely different because the service rejects the geolocation request as follows;

*** WIFI GEO: onChange called
*** WIFI GEO: ************************************* Sending request:
https://www.google.com/loc/json?browser=firefox&sensor=true

*** WIFI GEO: ************************************* ------>>>> sending.
*** WIFI GEO: service returned: JSON parsing error.

*** WIFI GEO: shutdown called

So it seems request and response formats for geolocation requests in FF have changed since v.3.6.24 (at least).

Checking against my own custom location provider, using the newer format for the JSON geolocation response, confirms the geolocation request/response format required by 9.0.1 is not the same as 3.6.24.

Is there any documentation covering this change? It is ever possible for a geolocation provider to be compatible with both older and newer FF versions... or is it now necessary to offer two different geolocation request/response formats?

Very grateful for any guidance.
Just did a comparison, to work out where this request/response format change first occurred...

FF8.0; the preference geo.wifi.uri = https://www.google.com/loc/json, and uses the old format request/response.

FF9.0.1; the preference geo.wifi.uri is effectively hardcoded as https://maps.googleapis.com/maps/api/browserlocation/json and uses a new format request/response.

This has the net effect that the same geolocation providers cannot be used with Firefox <9 and Firefox >8 anymore. FF8 won't accept the new format. FF9 won't accept the old format.

That doesn't seem like a good thing; maintaining backward compatibility with existing geolocation services would be welcome, else some guidance & documentation. :)
Hi Pete! Thanks for the thorough bug report. Please ping me if I haven't had a chance to look into this over the next week; it looks like something that should not be forgotten.
Attachment #584135 - Attachment mime type: text/plain → text/html
There is a solution for writing a custom geolocation provider compatible with both FF 3.6-8.0 and FF 9.0. See:

http://metaed.blogspot.com/2010/11/make-firefox-take-geolocation-from.html
Pete, it appears that this was an intentional change in bug 677256. Doug mentions that Google is deprecating the older provider, so I'm probably going to just close this bug as being by design.
Furthermore, the "*** WIFI GEO: service returned: JSON parsing error." in the log is actually the direct response text received from the provider, so it doesn't even look like something we could work around on our end by supporting both JSON response payloads.
per comment 10
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: