diff options
Diffstat (limited to 'LayoutTests/fast/dom/Geolocation')
4 files changed, 87 insertions, 0 deletions
diff --git a/LayoutTests/fast/dom/Geolocation/resources/window-close-popup.html b/LayoutTests/fast/dom/Geolocation/resources/window-close-popup.html new file mode 100644 index 0000000..cfeabae --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/resources/window-close-popup.html @@ -0,0 +1,19 @@ +<script> +var mockLatitude = 51.478; +var mockLongitude = -0.166; +var mockAccuracy = 100.0; + +function loadNext() { + var geolocation = navigator.geolocation; + + if (window.layoutTestController) { + layoutTestController.setGeolocationPermission(true); + layoutTestController.setMockGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy); + } + + navigator.geolocation.watchPosition( + function(p) { window.opener.gotPosition(); }, + function(e) { window.opener.failedToCreateWatch(e); }); +} +</script> +<body onload="loadNext()"></body> diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/window-close-crash.js b/LayoutTests/fast/dom/Geolocation/script-tests/window-close-crash.js new file mode 100644 index 0000000..b27df61 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/script-tests/window-close-crash.js @@ -0,0 +1,41 @@ +description("Tests the assertion that the GeolocationClient should not be updating<br>" + + "when the GeolocationController is destroyed.<br>" + + "See https://bugs.webkit.org/show_bug.cgi?id=52216"); + +var otherWindow; + +if (window.layoutTestController) { + layoutTestController.waitUntilDone(); + layoutTestController.setCanOpenWindows(); + layoutTestController.setCloseRemainingWindowsWhenComplete(true); +} else + testFailed('This test can not be run without the LayoutTestController'); + +function gotPosition(p) +{ + testPassed("Received Geoposition."); + otherWindow.close(); + window.setTimeout(waitForWindowToClose, 0); +} + +function waitForWindowToClose() +{ + if (!otherWindow.closed) { + window.setTimeout(waitForWindowToClose, 0); + return; + } + testPassed("Success - no crash!"); + finishJSTest(); +} + +function failedToCreateWatch(e) +{ + testFailed("Failed to create watch: " + e); + finishJSTest(); +} + +debug("Main page opening resources/window-close-popup.html"); +otherWindow = window.open("resources/window-close-popup.html"); + +window.jsTestIsAsync = true; +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/window-close-crash-expected.txt b/LayoutTests/fast/dom/Geolocation/window-close-crash-expected.txt new file mode 100644 index 0000000..bc136e6 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/window-close-crash-expected.txt @@ -0,0 +1,14 @@ +Tests the assertion that the GeolocationClient should not be updating +when the GeolocationController is destroyed. +See https://bugs.webkit.org/show_bug.cgi?id=52216 + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +Main page opening resources/window-close-popup.html +PASS Received Geoposition. +PASS Success - no crash! +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/Geolocation/window-close-crash.html b/LayoutTests/fast/dom/Geolocation/window-close-crash.html new file mode 100644 index 0000000..fc23692 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/window-close-crash.html @@ -0,0 +1,13 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="script-tests/window-close-crash.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> |