mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-05 02:39:10 +02:00
Removing timerRestartWatch, which is added by bug 489813 to make watchPosition time out multiple times. This patch is reverting that behavior and adding a replacement WPT test. Differential Revision: https://phabricator.services.mozilla.com/D243808
22 lines
761 B
JavaScript
22 lines
761 B
JavaScript
// META: script=/resources/testdriver.js
|
|
// META: script=/resources/testdriver-vendor.js
|
|
|
|
promise_setup(async () => {
|
|
await test_driver.set_permission({ name: "geolocation" }, "granted");
|
|
});
|
|
|
|
promise_test(async (t) => {
|
|
let timeoutCount = 0;
|
|
|
|
// This may still succeed without timeout in case there's a cache.
|
|
const watchId = navigator.geolocation.watchPosition(() => {}, (error) => {
|
|
if (error.code === GeolocationPositionError.TIMEOUT) {
|
|
++timeoutCount;
|
|
}
|
|
}, { timeout: 1 });
|
|
t.add_cleanup(() => navigator.geolocation.clearWatch(watchId));
|
|
|
|
await new Promise(r => setTimeout(r, 100));
|
|
|
|
assert_true(timeoutCount < 2, "At most one timeout should have been seen");
|
|
}, "Passing timeout=1 should not cause multiple timeout errors");
|