timeout-clear-watch.js revision e78cbe89e6f337f2f1fe40315be88f742b547151
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
3window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0);
4
5var error;
6var watchId = navigator.geolocation.watchPosition(function() {
7    testFailed('Success callback invoked unexpectedly');
8    finishJSTest();
9}, function(e) {
10    error = e
11    shouldBe('error.code', 'error.TIMEOUT');
12    shouldBe('error.message', '"Timeout expired"');
13    navigator.geolocation.clearWatch(watchId);
14    window.setTimeout(finishJSTest, 0);
15}, {
16    timeout: 0
17});
18
19window.layoutTestController.waitUntilDone();
20
21window.jsTestIsAsync = true;
22window.successfullyParsed = true;
23