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

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

Issue 2706923002: Rework security checks to be based on Window rather than Frame. (Closed)
Patch Set: Do not hardcode V8Window::wrapperTypeInfo Created 3 years, 7 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 // Cached Location properties become undefined.
17 if (propertyDir == "location")
18 expected = "undefined";
19 var cachedPropertyDir = "cached_" + propertyDir.replace('.', '_'); 16 var cachedPropertyDir = "cached_" + propertyDir.replace('.', '_');
20 window[cachedPropertyDir] = eval("childWindow." + propertyDir); 17 window[cachedPropertyDir] = eval("childWindow." + propertyDir);
21 propertiesToVerify.push({ 18 propertiesToVerify.push({
22 'property': ["window", cachedPropertyDir, path[path.length - 1]].join(". "), 19 'property': ["window", cachedPropertyDir, path[path.length - 1]].join(". "),
23 'expected': expected, 20 'expected': expected,
24 }); 21 });
25 } 22 }
26 23
27 function runTest() 24 function runTest()
28 { 25 {
29 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 no longer in a web page. Test should not crash and properties should be set to sane defaults.");
30 var frame = document.getElementById("test_frame"); 27 var frame = document.getElementById("test_frame");
31 childWindow = frame.contentWindow; 28 childWindow = frame.contentWindow;
32 // Have expected results assume that the frame hasn't been closed (=> window .closed = false.) 29 // Have expected results assume that the frame hasn't been closed (=> window .closed = false.)
33 collectProperties(document.getElementById("src_frame").contentWindow, false) ; 30 collectProperties(document.getElementById("src_frame").contentWindow, false) ;
34 frame.parentNode.removeChild(frame); 31 frame.parentNode.removeChild(frame);
35 for (var i = 0; i < propertiesToVerify.length; ++i) 32 for (var i = 0; i < propertiesToVerify.length; ++i)
36 shouldBe(propertiesToVerify[i].property, propertiesToVerify[i].expected) ; 33 shouldBe(propertiesToVerify[i].property, propertiesToVerify[i].expected) ;
37 finishJSTest(); 34 finishJSTest();
38 } 35 }
39 </script> 36 </script>
40 </head> 37 </head>
41 <body onload="runTest()"> 38 <body onload="runTest()">
42 <iframe id="src_frame"></iframe> 39 <iframe id="src_frame"></iframe>
43 <iframe id="test_frame" src="about:blank"></iframe> 40 <iframe id="test_frame" src="about:blank"></iframe>
44 </body> 41 </body>
45 </html> 42 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698