The default bug view has changed. See this FAQ.

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

RESOLVED FIXED in mozilla10

Status

()

Core
Geolocation
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: Paul Irish, Assigned: jdm)

Tracking

8 Branch
mozilla10
Points:
---
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
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.
(Assignee)

Comment 1

6 years ago
Agreed, this DOM call shouldn't throw.
Status: UNCONFIRMED → NEW
Ever confirmed: true
(Assignee)

Updated

6 years ago
Component: General → Geolocation
QA Contact: general → geolocation
(Assignee)

Comment 2

6 years ago
Created attachment 561469 [details] [diff] [review]
Make navigator.geolocation if geolocation is disabled.
Attachment #561469 - Flags: review?(jst)
(Assignee)

Comment 3

6 years ago
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 4

6 years ago
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+

Updated

6 years ago
Attachment #561469 - Flags: review?(jst) → review+
(Assignee)

Comment 5

6 years ago
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
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.