window-close-crash.js revision 65f03d4f644ce73618e5f4f50dd694b26f55ae12
1description("Tests the assertion that the GeolocationClient should not be updating<br>" +
2            "when the GeolocationController is destroyed.<br>" +
3            "See https://bugs.webkit.org/show_bug.cgi?id=52216");
4
5var otherWindow;
6
7if (window.layoutTestController) {
8    layoutTestController.waitUntilDone();
9    layoutTestController.setCanOpenWindows();
10    layoutTestController.setCloseRemainingWindowsWhenComplete(true);
11} else
12    testFailed('This test can not be run without the LayoutTestController');
13
14function gotPosition(p)
15{
16    testPassed("Received Geoposition.");
17    otherWindow.close();
18    window.setTimeout(waitForWindowToClose, 0);
19}
20
21function waitForWindowToClose()
22{
23    if (!otherWindow.closed) {
24        window.setTimeout(waitForWindowToClose, 0);
25        return;
26    }
27    testPassed("Success - no crash!");
28    finishJSTest();
29}
30
31function failedToCreateWatch(e)
32{
33    testFailed("Failed to create watch: " + e);
34    finishJSTest();
35}
36
37debug("Main page opening resources/window-close-popup.html");
38otherWindow = window.open("resources/window-close-popup.html");
39
40window.jsTestIsAsync = true;
41window.successfullyParsed = true;
42