Open Bug 1037982 Opened 11 years ago Updated 3 years ago

Firefox for Desktop on OSX cannot do feature sniffing for deviceorientation

Categories

(Core :: DOM: Device Interfaces, defect, P3)

x86
macOS
defect

Tracking

()

People

(Reporter: janjongboom, Unassigned)

Details

Basically all tutorials say that this is the way to test for deviceorientation support in a browser: 'DeviceOrientationEvent' in window Now that's nice, but this returns true in FF for Desktop on OSX, even though Firefox is not able to track deviceorientation on my computer. Is there a better way to feature sniff this?
Ping Jonas, as he knows everything.
Flags: needinfo?(jonas)
I actually thought that we had deviceorientation implemented on OSX. But basic testing shows that that is not the case. I'm fairly sure there isn't any other way to test for deviceorientation support. So seems like we're out of luck. Adding Steven who knows OSX-specific code. If we're lacking the ability to get gyroscopic or acceleration orientation information we should disable this interface entirely. Not sure we need to do that at runtime based on hardware capabilities, or if we simply have no code on OSX to get this information, in which case we should disable this interface it at compile time. Also adding Doug T who might know if we have code for device orientation on OSX.
Flags: needinfo?(jonas)
Do we generate orientation events "from hardware" on any other platform than Android/Firefox OS? As best I can tell from a quick look through the tree, the answer is "no".
(In reply to Steven Michaud from comment #4) > Also, I can't find any support for orientation events in OS X. Do you mean that OSX doesn't have platform API for accessing orientation sensors? Or do you mean that there's no OSX APIs that map directly to the information that orientation events expose? Or do you just mean that Apple doesn't fire orientation events in Safari?
(In reply to comment #5) The best answer, I suppose, is that I meant exactly what I said ... and no more. This is something I know very little about. Doug T may know more.
Given that orientation events, and DOM events in general, is a web feature, I'm not surprised that OSX doesn't have it natively, which is how I interpret what you are saying. Anyhow, sounds like we should disable this interface, and the Window.ondeviceorientation property, on all desktop platforms.
Jan, would you be able to write a patch for this? I think we just need to add [Pref="dom.deviceorientation.enabled"] to both the interface and the Window.ondeviceorientation/ondevicemotion properties, and then set that pref only on Fennec and FirefoxOS.
Jonas, I just realized the problem is more broad than just on OSX. For example, my ZTE Open C does not have a proximity sensor, yet the proximity event is still there, there is no way for me to find out if the device has this feature...
Flags: needinfo?(jonas)
Yeah. That's a somewhat different problem code-wise I think. For in FirefoxOS we should add code that can somehow detect which sensors that there is hardware for and then disable the appropriate events based on that. But I think that is better done as a separate bug.
Flags: needinfo?(jonas)
This is still a problem. Taking to remind myself to look at cleaning this up on desktop platforms.
Assignee: nobody → kyle
Priority: -- → P3
Doing a bit of research, some browsers (Chrome on Windows/Linux/Mac, Edge on Windows) seem to expose this event on regardless of platform/capabilities. Safari on OS X does not expose this event.
Assignee: kyle → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.