timeout-clear-watch.js revision 545e470e52f0ac6a3a072bf559c796b42c6066b6
1description("Tests that when a watch times out and is cleared from the error callback, there is no crash. This a regression test for https://bugs.webkit.org/show_bug.cgi?id=32111.");
2
3if (window.layoutTestController)
4    layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0);
5
6var error;
7var watchId = navigator.geolocation.watchPosition(function() {
8    testFailed('Success callback invoked unexpectedly');
9    finishJSTest();
10}, function(e) {
11    error = e;
12    shouldBe('error.code', 'error.TIMEOUT');
13    shouldBe('error.message', '"Timeout expired"');
14    navigator.geolocation.clearWatch(watchId);
15    window.setTimeout(finishJSTest, 0);
16}, {
17    timeout: 0
18});
19
20
21window.jsTestIsAsync = true;
22window.successfullyParsed = true;
23