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

Side by Side Diff: LayoutTests/fast/dom/Window/property-access-on-cached-properties-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 if (path.length < 2) 13 if (path.length < 2)
14 return; 14 return;
15 var propertyDir = path.slice(0, -1).join('.'); 15 var propertyDir = path.slice(0, -1).join('.');
16 var cachedPropertyDir = "cached_" + propertyDir.replace('.', '_'); 16 var cachedPropertyDir = "cached_" + propertyDir.replace('.', '_');
17 window[cachedPropertyDir] = eval("childWindow." + propertyDir); 17 window[cachedPropertyDir] = eval("childWindow." + propertyDir);
18 propertiesToVerify.push({ 18 propertiesToVerify.push({
19 'property': ["window", cachedPropertyDir, path[path.length - 1]].join(". "), 19 'property': ["window", cachedPropertyDir, path[path.length - 1]].join(". "),
20 'expected': expected, 20 'expected': expected,
21 }); 21 });
22 } 22 }
23 23
24 function runTest() 24 function runTest()
25 { 25 {
26 description("Tests access of cached DOMWindow properties 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."); 26 description("Tests access of cached DOMWindow properties 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.");
27 var frame = document.getElementById("frame"); 27 var frame = document.getElementById("frame");
28 childWindow = frame.contentWindow; 28 childWindow = frame.contentWindow;
29 collectProperties(); 29 // Have expected results assume that the frame has been closed (=> window.cl osed = true.)
30 collectProperties(true);
30 frame.parentNode.removeChild(frame); 31 frame.parentNode.removeChild(frame);
31 window.setTimeout(verifyResults, 0); 32 window.setTimeout(verifyResults, 0);
32 } 33 }
33 34
34 function verifyResults() 35 function verifyResults()
35 { 36 {
36 if (window.gc) 37 if (window.gc)
37 gc(); 38 gc();
38 for (var i = 0; i < propertiesToVerify.length; ++i) 39 for (var i = 0; i < propertiesToVerify.length; ++i)
39 shouldBe(propertiesToVerify[i].property, propertiesToVerify[i].expected) ; 40 shouldBe(propertiesToVerify[i].property, propertiesToVerify[i].expected) ;
40 finishJSTest(); 41 finishJSTest();
41 } 42 }
42 </script> 43 </script>
43 </head> 44 </head>
44 <body> 45 <body>
45 <iframe id="frame" src="about:blank" onload="runTest()"></iframe> 46 <iframe id="frame" src="about:blank" onload="runTest()"></iframe>
46 </body> 47 </body>
47 </html> 48 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698