зеркало из https://github.com/mozilla/gecko-dev.git
Backout b3b4311176fa (bug 816850) for test_mozsettingsWatch.html failures
This commit is contained in:
Родитель
d3f354af96
Коммит
24f71e48c8
|
@ -740,8 +740,10 @@ void
|
|||
nsGeolocationService::HandleMozsettingValue(const bool aValue)
|
||||
{
|
||||
if (!aValue) {
|
||||
// Do not shutdown the mGeolocators, but instead just stop the
|
||||
// device and do a final update of null. See bug #816850.
|
||||
// turn things off
|
||||
for (uint32_t i = 0; i< mGeolocators.Length(); i++) {
|
||||
mGeolocators[i]->Shutdown();
|
||||
}
|
||||
StopDevice();
|
||||
Update(nullptr);
|
||||
mLastPosition = nullptr;
|
||||
|
|
|
@ -42,50 +42,30 @@ SpecialPowers.addPermission("settings-read", true, document);
|
|||
SpecialPowers.addPermission("settings-write", true, document);
|
||||
SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.jsm");
|
||||
|
||||
ok(navigator.geolocation, "get geolocation object");
|
||||
|
||||
toggleGeolocationSetting(false, function() {
|
||||
ok(true, "turned off geolocation via mozSettings");
|
||||
setTimeout(function() {
|
||||
navigator.geolocation.getCurrentPosition(successCallbackAfterMozsettingOff, failureCallbackAfterMozsettingOff);
|
||||
navigator.geolocation.getCurrentPosition(successCallbackAfterMozsetting, failureCallbackAfterMozsetting);
|
||||
}, 500); // need to wait a bit for all of these async callbacks to finish
|
||||
});
|
||||
|
||||
function successCallbackAfterMozsettingOff(position) {
|
||||
function successCallbackAfterMozsetting(position) {
|
||||
ok(false, "Success callback should not have been called after setting geolocation.enabled to false.");
|
||||
|
||||
toggleGeolocationSetting(true, function() {
|
||||
ok(true, "turned on geolocation via mozSettings");
|
||||
setTimeout(function() {
|
||||
navigator.geolocation.watchPosition(successCallbackAfterMozsettingOn, failureCallbackAfterMozsettingOn);
|
||||
}, 500); // need to wait a bit for all of these async callbacks to finish
|
||||
reset_prompt();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
|
||||
function failureCallbackAfterMozsettingOff(error) {
|
||||
function failureCallbackAfterMozsetting(error) {
|
||||
ok(true, "Geolocation didn't work after setting geolocation.enabled to false.");
|
||||
|
||||
toggleGeolocationSetting(true, function() {
|
||||
ok(true, "turned on geolocation via mozSettings");
|
||||
setTimeout(function() {
|
||||
navigator.geolocation.watchPosition(successCallbackAfterMozsettingOn, failureCallbackAfterMozsettingOn);
|
||||
}, 500); // need to wait a bit for all of these async callbacks to finish
|
||||
reset_prompt();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
|
||||
function successCallbackAfterMozsettingOn(position) {
|
||||
ok(true, "Geolocation worked after setting geolocation.enabled to true.");
|
||||
|
||||
reset_prompt();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function failureCallbackAfterMozsettingOn(error) {
|
||||
ok(false, "Geolocation didn't work after setting geolocation.enabled to true.");
|
||||
|
||||
reset_prompt();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
|
|
@ -42,50 +42,30 @@ SpecialPowers.addPermission("settings-read", true, document);
|
|||
SpecialPowers.addPermission("settings-write", true, document);
|
||||
SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.jsm");
|
||||
|
||||
ok(navigator.geolocation, "get geolocation object");
|
||||
|
||||
toggleGeolocationSetting(false, function() {
|
||||
ok(true, "turned off geolocation via mozSettings");
|
||||
setTimeout(function() {
|
||||
navigator.geolocation.watchPosition(successCallbackAfterMozsettingOff, failureCallbackAfterMozsettingOff);
|
||||
navigator.geolocation.watchPosition(successCallbackAfterMozsetting, failureCallbackAfterMozsetting);
|
||||
}, 500); // need to wait a bit for all of these async callbacks to finish
|
||||
});
|
||||
|
||||
function successCallbackAfterMozsettingOff(position) {
|
||||
function successCallbackAfterMozsetting(position) {
|
||||
ok(false, "Success callback should not have been called after setting geolocation.enabled to false.");
|
||||
|
||||
toggleGeolocationSetting(true, function() {
|
||||
ok(true, "turned on geolocation via mozSettings");
|
||||
setTimeout(function() {
|
||||
navigator.geolocation.watchPosition(successCallbackAfterMozsettingOn, failureCallbackAfterMozsettingOn);
|
||||
}, 500); // need to wait a bit for all of these async callbacks to finish
|
||||
reset_prompt();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
|
||||
function failureCallbackAfterMozsettingOff(error) {
|
||||
function failureCallbackAfterMozsetting(error) {
|
||||
ok(true, "Geolocation didn't work after setting geolocation.enabled to false.");
|
||||
|
||||
toggleGeolocationSetting(true, function() {
|
||||
ok(true, "turned on geolocation via mozSettings");
|
||||
setTimeout(function() {
|
||||
navigator.geolocation.watchPosition(successCallbackAfterMozsettingOn, failureCallbackAfterMozsettingOn);
|
||||
}, 500); // need to wait a bit for all of these async callbacks to finish
|
||||
reset_prompt();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
|
||||
function successCallbackAfterMozsettingOn(position) {
|
||||
ok(true, "Geolocation worked after setting geolocation.enabled to true.");
|
||||
|
||||
reset_prompt();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function failureCallbackAfterMozsettingOn(error) {
|
||||
ok(false, "Geolocation didn't work after setting geolocation.enabled to true.");
|
||||
|
||||
reset_prompt();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
|
Загрузка…
Ссылка в новой задаче