Closed Bug 688158 Opened 13 years ago Closed 13 years ago

geo.enable => false should make navigator.geolocation undefined

Categories

(Core :: DOM: Geolocation, defect)

8 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla10

People

(Reporter: paulirish, Assigned: jdm)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.4 (KHTML, like Gecko) Chrome/16.0.887.0 Safari/535.4

Steps to reproduce:

- about:config
- set geo.enable to false
- try:

navigator.geolocation && navigator.geolocation.getCurrentPosition(
  function(){ console.log('success', arguments); },
  function(){ console.log('error', arguments);    }
);


Actual results:

getCurrentPosition threw an exception: 
[11:44:41.359] [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIDOMGeoGeolocation.getCurrentPosition]"  nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)"  location: "JS frame :: Web Console :: <TOP_LEVEL> :: line 1"  data: no]


Expected results:

Ideally navigator.geolocation is undefined, so feature detection is accurate. Pages relying on detecting navigator.geolocation exists are changing behavior expecting it to succeed (or at least, prompt the user).

Next best thing is the error callback is executed.
Agreed, this DOM call shouldn't throw.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Component: General → Geolocation
QA Contact: general → geolocation
Comment on attachment 561469 [details] [diff] [review]
Make navigator.geolocation if geolocation is disabled.

Doug, is navigator.geolocation returning null a decent behaviour here?
Attachment #561469 - Flags: feedback?(doug.turner)
Comment on attachment 561469 [details] [diff] [review]
Make navigator.geolocation if geolocation is disabled.

this is okay... but I still think people will be able to test for interface Geolocation, and NavigatorGeolocation.
Attachment #561469 - Flags: feedback?(doug.turner) → feedback+
Attachment #561469 - Flags: review?(jst) → review+
http://hg.mozilla.org/integration/mozilla-inbound/rev/8232007db7e5
Assignee: nobody → josh
Flags: in-testsuite-
OS: Mac OS X → All
Hardware: x86 → All
Target Milestone: --- → mozilla10
https://hg.mozilla.org/mozilla-central/rev/8232007db7e5
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: