Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1026)

Side by Side Diff: LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-and-gced.html

Issue 538323003: Have window.closed return true when frame is closed. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Un-inline and improve formatting of Frame::setHasBeenClosed() Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../../resources/js-test.js"></script> 3 <script src="../../../resources/js-test.js"></script>
4 <script src="resources/window-property-collector.js"></script> 4 <script src="resources/window-property-collector.js"></script>
5 <script> 5 <script>
6 var jsTestIsAsync = true; 6 var jsTestIsAsync = true;
7 7
8 var childWindow; 8 var childWindow;
9 var propertiesToVerify = []; 9 var propertiesToVerify = [];
10 10
11 function insertExpectedResult(path, expected) 11 function insertExpectedResult(path, expected)
12 { 12 {
13 var propertyPath = path.join('.'); 13 var propertyPath = path.join('.');
14 propertiesToVerify.push({'property': "childWindow." + propertyPath, 'expecte d': expected}); 14 propertiesToVerify.push({'property': "childWindow." + propertyPath, 'expecte d': expected});
15 } 15 }
16 16
17 function runTest() 17 function runTest()
18 { 18 {
19 description("Tests property access on a cached DOMWindow after the associate d frame is removed from a web page and garbage collected. Test should not crash and properties should be set to sane defaults."); 19 description("Tests property access on a cached DOMWindow after the associate d frame is removed from a web page and garbage collected. Test should not crash and properties should be set to sane defaults.");
20 var frame = document.getElementById("frame"); 20 var frame = document.getElementById("frame");
21 childWindow = frame.contentWindow; 21 childWindow = frame.contentWindow;
22 collectProperties(); 22 // Have expected results assume that the frame has been closed and GCed (=> window.closed = true.)
23 collectProperties(true);
23 frame.parentNode.removeChild(frame); 24 frame.parentNode.removeChild(frame);
24 window.setTimeout(verifyResults, 0); 25 window.setTimeout(verifyResults, 0);
25 } 26 }
26 27
27 function verifyResults() 28 function verifyResults()
28 { 29 {
29 if (window.gc) 30 if (window.gc)
30 gc(); 31 gc();
31 for (var i = 0; i < propertiesToVerify.length; ++i) 32 for (var i = 0; i < propertiesToVerify.length; ++i)
32 shouldBe(propertiesToVerify[i].property, propertiesToVerify[i].expected) ; 33 shouldBe(propertiesToVerify[i].property, propertiesToVerify[i].expected) ;
33 finishJSTest(); 34 finishJSTest();
34 } 35 }
35 </script> 36 </script>
36 </head> 37 </head>
37 <body> 38 <body>
38 <iframe id="frame" src="about:blank" onload="runTest()"></iframe> 39 <iframe id="frame" src="about:blank" onload="runTest()"></iframe>
39 </body> 40 </body>
40 </html> 41 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698