mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 774580 - Send the Geolocation status to web content [r=vingtetun]
This commit is contained in:
parent
a1206f42c8
commit
4425e23e2e
@ -613,3 +613,23 @@ Services.obs.addObserver(function ContentHandler(subject, topic, data) {
|
||||
});
|
||||
}, 'content-handler', false);
|
||||
|
||||
(function geolocationStatusTracker() {
|
||||
gGeolocationActiveCount = 0;
|
||||
|
||||
Services.obs.addObserver(function(aSubject, aTopic, aData) {
|
||||
let oldCount = gGeolocationActiveCount;
|
||||
if (aData == "starting") {
|
||||
gGeolocationActiveCount += 1;
|
||||
} else if (aData == "shutdown") {
|
||||
gGeolocationActiveCount -= 1;
|
||||
}
|
||||
|
||||
// We need to track changes from 1 <-> 0
|
||||
if (gGeolocationActiveCount + oldCount == 1) {
|
||||
shell.sendChromeEvent({
|
||||
type: 'geolocation-status',
|
||||
active: (gGeolocationActiveCount == 1)
|
||||
});
|
||||
}
|
||||
}, "geolocation-device-events", false);
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user