Per spec, this never returns null, which is totally not what our implementation does when geo.enabled is not set....
Shouldn't that be solved by having the properties behind [PrefEnabled] when Navigator is converted to WebIDL?
I think so, yes; I'm just not willing to make that change as part of the navigator webidl conversion, since Doug thinks it's risky.
4 years ago
I'm not sure I understand the desired behavior here. Should navigator.geolocation never be null, but issue error events for all calls to getCurrentPosition/watchPosition when "geo.enabled" is false?
That's a good question. The options are either to do that or to have |"geolocation" in navigator| test false if geo.enabled is false and have navigator.geolocation be undefined. And also have the geolocation interface object disappear when the pref is not set, if we take this approach.
Created attachment 778682 [details] [diff] [review] navigator.geolocation should never be null. Here's my stab at the second option. This causes navigator.geolocation to be undefined when the pref is false on page load. However, if the pref is set to false after being true on page load, that doesn't cause navigator.geolocation to be undefined. Is that a problem? navigator.getGamepads seems to also behave like that. Feedback: firstname.lastname@example.org
Comment on attachment 778687 [details] [diff] [review] navigator.geolocation should never be null. > Is that a problem? No. And looks like Geolocation is [NoInterfaceObject] (why?) so there is no need to condition its interface object on the pref.
Comment on attachment 778687 [details] [diff] [review] navigator.geolocation should never be null. Doug, I don't know what concerns you had regarding this bug, so please let me know if anything is missing. Seems to work on try: https://tbpl.mozilla.org/?tree=Try&rev=ed06767dda70
(In reply to Boris Zbarsky (:bz) from comment #7) > And looks like Geolocation is [NoInterfaceObject] (why?) so there is no need > to condition its interface object on the pref. It is likely a bug in the specification.