The W3C defined a generic sensor API for browsers which also allows to support sensors like the Magnetometer. The spec can be found here: https://www.w3.org/TR/generic-sensor/
Does Mozilla intend to support that API for Firefox? Is it maybe already under development?
(note: Chrome 63 does support it in it early version already)