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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/Window/orphaned-frame-access.html

Issue 2706923002: Rework security checks to be based on Window rather than Frame. (Closed)
Patch Set: Fix test typo Created 3 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
OLDNEW
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Null frame access tests</title> 4 <title>Null frame access tests</title>
5 <script src="../../../resources/js-test.js"></script> 5 <script src="../../../resources/testharness.js"></script>
6 <script src="../../../resources/testharnessreport.js"></script>
6 <script> 7 <script>
7 description("This tests access to a window with a null frame. You should see \"P ASS\" for each of the three tests below."); 8 var t = async_test('This tests access to a window with a null frame.');
8 9
9 window.jsTestIsAsync = true; 10 window.onload = t.step_func(function () {
10 window.onload = function() { 11 var childWindow = window[0];
11 if (window.testRunner) { 12 childWindow.frameElement.remove();
12 testRunner.dumpAsText(); 13 // Removing the owner element from the DOM should null the frame. In Blink,
13 testRunner.waitUntilDone(); 14 // this can be observed by checking childWindow.parent == null.
14 } 15 assert_equals(childWindow.parent, null);
15 16
16 var tag = document.getElementById('subframe'); 17 assert_equals(childWindow.test, 'abc', 'Named property should still be accessi ble.');
17 var win = tag.contentWindow; 18 assert_equals(childWindow[20], '123', 'Indexed property should still be access ible.');
18 // remove the element so the window has a null frame 19 // TODO(dcheng): Why does this return null?
19 tag.parentNode.removeChild(tag); 20 assert_equals(childWindow.Comment, undefined, 'Interface Object should be gone .');
dcheng 2017/03/06 06:59:46 I don't understand this, btw... but that seems to
20 21 t.done();
21 // schedule to run after the frame is null 22 });
22 asyncGC(function() {
23 debug("missing property: " + (win.test || 'PASS'))
24 debug("missing array index: " + (win[20] || 'PASS'));
25 debug("missing interface object: " + (win.Comment || 'PASS'));
26 finishJSTest();
27 });
28 };
29 </script> 23 </script>
30 </head> 24 </head>
31 <body> 25 <body>
32 <iframe id="subframe" src="data:text/html,&lt;script&gt;window.test='FAIL ... '; window[20]='FAIL ... ';&lt;/script&gt;" /> 26 <iframe id="subframe" src="data:text/html,&lt;script&gt;window.test='abc';window [20]='123';&lt;/script&gt;" />
33 </body> 27 </body>
34 </html> 28 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698