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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-parent-explicit-domain-isolated-world.html

Issue 2630783003: PlzNavigate: Fix the http/tests/security/cross-frame-access-parent-isolated-world.html and http/tes… (Closed)
Patch Set: Created 3 years, 11 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 <script src="/js-test-resources/js-test.js"></script> 3 <script src="/js-test-resources/js-test.js"></script>
4 <body> 4 <body>
5 <p id="description"></p> 5 <p id="description"></p>
6 <p id="console"></p> 6 <p id="console"></p>
7 <iframe src="data:text/html,"></iframe> 7 <iframe src="data:text/html," onload="onFrameLoad()"></iframe>
8 <script> 8 <script>
9 // We should change the iframe src only after it finishes loading to avoid
10 // timing bugs due to PlzNavigate or cases where the browser handles all
11 // navigations.
12 var srcChanged = false;
ananta 2017/01/14 02:24:55 Should this function be moved to js-test.js or ano
Nate Chapin 2017/01/18 22:14:11 I don't feel strongly, do you see other tests that
13 function onFrameLoad() {
14 if (window.testRunner && !srcChanged) {
15 testRunner.setIsolatedWorldSecurityOrigin(2, 'chrome-extension://123');
16 var iframe = document.getElementsByTagName('iframe')[0];
17 iframe.focus();
18 iframe.src = 'http://subdomain.example.test:8000/security/resources/cross-fr ame-iframe-for-parent-isolated-world.html';
19 }
20 }
21
9 window.jsTestIsAsync = true; 22 window.jsTestIsAsync = true;
10 if (document.location.hostname == '127.0.0.1') { 23 if (document.location.hostname == '127.0.0.1') {
11 document.location.hostname = 'subdomain.example.test'; 24 document.location.hostname = 'subdomain.example.test';
12 } else { 25 } else {
13 description('Tests that isolated worlds do not allow cross-origin frame acce ss'); 26 description('Tests that isolated worlds do not allow cross-origin frame acce ss');
14 27
15 if (window.testRunner) { 28 if (window.testRunner) {
16 window.addEventListener('message', function(event) { 29 window.addEventListener('message', function(event) {
17 var message = JSON.parse(event.data); 30 var message = JSON.parse(event.data);
18 switch (message.type) { 31 switch (message.type) {
19 case 'debug': 32 case 'debug':
20 debug(message.message); 33 debug(message.message);
21 break; 34 break;
22 case 'finish': 35 case 'finish':
23 finishJSTest(); 36 finishJSTest();
24 break; 37 break;
25 } 38 }
26 }); 39 });
27 40
28 testRunner.setIsolatedWorldSecurityOrigin(2, 'chrome-extension://123');
29 var iframe = document.getElementsByTagName('iframe')[0];
30 iframe.focus();
31 document.domain = 'example.test'; 41 document.domain = 'example.test';
32 iframe.src = 'http://subdomain.example.test:8000/security/resources/cros s-frame-iframe-for-parent-isolated-world.html';
33 } else { 42 } else {
34 testFailed('Test depends on LayoutTestController and must be run by DRT' ); 43 testFailed('Test depends on LayoutTestController and must be run by DRT' );
35 } 44 }
36 } 45 }
37 </script> 46 </script>
38 </body> 47 </body>
39 </html> 48 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698