DO NOT MERGE Fix flakiness in WebChromeClientTest#testWindows
Bug 6460200
childWindow was referenced in the fireOpen function and called
setTimeout("childWindow.close(), 2000). If gc occured between
the call to setTimeout and the callback, childWindow would have
been collected and the reference lost. This change adds a reference
outside of the function so that it cannot be collected.
Change-Id: Id3717104c3a1a0b7da26bfb0a7f939e88d9ed582
diff --git a/tests/assets/webkit/jswindow.html b/tests/assets/webkit/jswindow.html
index bc723f7..534a683 100644
--- a/tests/assets/webkit/jswindow.html
+++ b/tests/assets/webkit/jswindow.html
@@ -18,12 +18,13 @@
<title>javascript window</title>
</head>
<script type="text/javascript">
+ var childWindow;
function fireOpen() {
childWindow = window.open();
childWindow.document.title = "javascript child window";
childWindow.document.write("javascript child window");
childWindow.focus();
- setTimeout("childWindow.close()", 2000);
+ setTimeout(function(){childWindow.close();}, 2000);
}
</script>
<body onload="fireOpen()">