summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/dom/Geolocation/script-tests/timeout-clear-watch.js
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/fast/dom/Geolocation/script-tests/timeout-clear-watch.js')
-rw-r--r--LayoutTests/fast/dom/Geolocation/script-tests/timeout-clear-watch.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/timeout-clear-watch.js b/LayoutTests/fast/dom/Geolocation/script-tests/timeout-clear-watch.js
new file mode 100644
index 0000000..63e0569
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/timeout-clear-watch.js
@@ -0,0 +1,22 @@
+description("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.");
+
+window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0);
+
+var error;
+var watchId = navigator.geolocation.watchPosition(function() {
+ testFailed('Success callback invoked unexpectedly');
+ finishJSTest();
+}, function(e) {
+ error = e
+ shouldBe('error.code', 'error.TIMEOUT');
+ shouldBe('error.message', '"Timeout expired"');
+ navigator.geolocation.clearWatch(watchId);
+ window.setTimeout(finishJSTest, 0);
+}, {
+ timeout: 0
+});
+
+window.layoutTestController.waitUntilDone();
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;