Index: LayoutTests/fast/dom/Window/Location/set-location-after-close.html |
diff --git a/LayoutTests/fast/dom/Window/Location/set-location-after-close.html b/LayoutTests/fast/dom/Window/Location/set-location-after-close.html |
index 5ec615c805899708fdc88ec7ca3f37110707c6d7..ee2e340cc7d600ded8cc760b00a382908500dea1 100644 |
--- a/LayoutTests/fast/dom/Window/Location/set-location-after-close.html |
+++ b/LayoutTests/fast/dom/Window/Location/set-location-after-close.html |
@@ -1,8 +1,13 @@ |
-<html> |
-<body> |
-This tests opens a new window, sets a timeout to close it, then sets a timeout to navigate it via window.location. |
-We pass if we don't crash when setting the location of the already closed window. |
+<!DOCTYPE HTML> |
+<script src="../../../../resources/js-test.js"></script> |
<script> |
+description("Updating window.location after the window has been closed, without crashing."); |
+ |
+// This tests opens a new window, sets a timeout to close it, then |
+// sets a timeout to navigate it via window.location. We pass if we |
+// don't crash when setting the location of the already closed window, |
+// or when shutting down just after. |
+ |
if (window.testRunner) { |
testRunner.dumpAsText(); |
testRunner.setCanOpenWindows(); |
@@ -13,15 +18,22 @@ var w = window.open('resources/set-location-after-close-new-window.html'); |
window.addEventListener("message", processMessage, false); |
+function finish() { |
+ // Clear out window and force a GC to finalize the Window |
+ // object and its wrapper. Verifies that the shutdown is |
+ // done in an orderly manner. |
+ w = null; |
+ gc(); |
+ if (window.testRunner) |
+ testRunner.notifyDone(); |
+} |
+ |
function processMessage(event) { |
if (event.data == "opened") |
w.close(); |
else if (event.data == "closed") { |
w.location = ''; |
- if (window.testRunner) |
- testRunner.notifyDone(); |
+ setInterval(finish, 0); |
} |
} |
</script> |
-</body> |
-</html> |