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

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

Issue 203053002: Add null check for frame when creating WebCore::Performance. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add rebaseline expectations Created 6 years, 9 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 | Annotate | Revision Log
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;
7
6 var childWindow; 8 var childWindow;
7 var propertiesToVerify = []; 9 var propertiesToVerify = [];
8 10
9 function insertExpectedResult(path, expected) 11 function insertExpectedResult(path, expected)
10 { 12 {
11 if (path.length < 2) 13 if (path.length < 2)
12 return; 14 return;
13 var propertyDir = path.slice(0, -1).join('.'); 15 var propertyDir = path.slice(0, -1).join('.');
14 var cachedPropertyDir = "cached_" + propertyDir.replace('.', '_'); 16 var cachedPropertyDir = "cached_" + propertyDir.replace('.', '_');
15 window[cachedPropertyDir] = eval("childWindow." + propertyDir); 17 window[cachedPropertyDir] = eval("childWindow." + propertyDir);
16 propertiesToVerify.push({ 18 propertiesToVerify.push({
17 'property': ["window", cachedPropertyDir, path[path.length - 1]].join(". "), 19 'property': ["window", cachedPropertyDir, path[path.length - 1]].join(". "),
18 'expected': expected, 20 'expected': expected,
19 }); 21 });
20 } 22 }
21 23
22 function runTest() 24 function runTest()
23 { 25 {
24 description("Tests access of cached DOMWindow properties after the associate d frame is no longer in a web page. 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.");
25 var frame = document.getElementById("frame"); 27 var frame = document.getElementById("frame");
26 childWindow = frame.contentWindow; 28 childWindow = frame.contentWindow;
27 collectProperties(); 29 collectProperties();
28 frame.parentNode.removeChild(frame); 30 frame.parentNode.removeChild(frame);
31 window.setTimeout(verifyResults, 0);
32 }
33
34 function verifyResults()
35 {
36 if (window.gc)
37 gc();
29 for (var i = 0; i < propertiesToVerify.length; ++i) 38 for (var i = 0; i < propertiesToVerify.length; ++i)
30 shouldBe(propertiesToVerify[i].property, propertiesToVerify[i].expected) ; 39 shouldBe(propertiesToVerify[i].property, propertiesToVerify[i].expected) ;
40 finishJSTest();
31 } 41 }
32 </script> 42 </script>
33 </head> 43 </head>
34 <body> 44 <body>
35 <iframe id="frame" src="about:blank" onload="runTest()"></iframe> 45 <iframe id="frame" src="about:blank" onload="runTest()"></iframe>
36 </body> 46 </body>
37 </html> 47 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698