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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/html/dom/self-origin.sub.html

Issue 2706013002: Added support for self.origin in Window and WorkerGlobalScope (Closed)
Patch Set: Created 3 years, 10 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
(Empty)
1 <!DOCTYPE HTML>
2 <meta charset=utf-8>
3 <script src="/resources/testharness.js"></script>
4 <script src="/resources/testharnessreport.js"></script>
5 <div id=log></div>
6 <iframe></iframe>
7 <iframe id="blob-test"></iframe> <!-- will get blob: URI -->
8 <iframe src="javascript:'javascript'"></iframe>
9 <iframe srcdoc="srcdoc"></iframe>
10 <!-- Use the non-default HTTP port so we can make sure it gets included in
11 self.origin -->
12 <iframe src="http://{{domains[www1]}}:{{ports[http][1]}}{{location[path]}}/../re sources/self-origin-subframe.html"></iframe>
13 <!-- Using the punycode version on purpose, we expect to get back the IDNA
14 version in self.origin -->
15 <iframe src="http://xn--lve-6lad.{{domains[]}}:{{ports[http][1]}}{{location[path ]}}/../resources/self-origin-subframe.html"></iframe>
16 <iframe src="resources/self-origin-subframe.html" sandbox="allow-scripts"></ifra me>
17 <script type="application/javascript">
18 test(function() {
19 var blob = new Blob(['blob']);
20 var url = URL.createObjectURL(blob);
21 document.getElementById("blob-test").src = url;
22 }, "Assigning blob url");
23
24 /* Each message test is a four things: window to send message to, message to
25 send, expected response, async test to use. */
26 var messageTests = [
27 [ frames[4], "getOrigin", "http://{{domains[www1]}}:{{ports[http][1]}}",
28 async_test("Should have the right origin for cross-origin subframe") ],
29 [ frames[4], "setDomainAndGetOrigin", "http://{{domains[www1]}}:{{ports[http][ 1]}}",
30 async_test("Should have the right origin for cross-origin subframe after set ting document.domain") ],
31 [ frames[5], "getOrigin", "http://élève.{{domains[]}}:{{ports[http][1]}}",
32 async_test("Should have the right origin for IDN subframe") ],
33 [ frames[5], "setDomainAndGetOrigin", "http://élève.{{domains[]}}:{{ports[http ][1]}}",
34 async_test("Should have the right origin for IDN subframe after setting docu ment.domain") ],
35 [ frames[6], "getOrigin", "null",
36 async_test("Should have the right origin for sandboxed iframe") ],
37 ];
38
39 var curTest = 0;
40 function nextMessageTest() {
41 if (curTest == messageTests.length) {
42 return;
43 }
44
45 var testData = messageTests[curTest];
46 testData[0].postMessage(testData[1], "*");
47 }
48
49 window.onmessage = function(e) {
50 console.log(e);
51 var testData = messageTests[curTest++];
52 testData[3].step_func(function() {
53 assert_equals(e.data, testData[2])
54 });
55 testData[3].done();
56 nextMessageTest();
57 }
58
59 addEventListener("load", nextMessageTest);
60
61 test(function() {
62 assert_equals(self.origin, "http://{{location[host]}}");
63 }, "We should have the right origin for our page");
64
65 var t1 = async_test("about:blank subframe origins");
66 addEventListener("load", t1.step_func_done(function() {
67 assert_equals(frames[0].location.origin, "null",
68 "Should have the right location origin for about:blank iframe");
69 assert_equals(frames[0].origin, "http://{{location[host]}}",
70 "Should have the right origin for about:blank iframe");
71 }));
72
73 var t2 = async_test("blob: subframe origins");
74 addEventListener("load", t2.step_func_done(function() {
75 assert_equals(frames[1].location.origin, "http://{{location[host]}}",
76 "Should have the right location origin for blob: iframe");
77 assert_equals(frames[1].origin, "http://{{location[host]}}",
78 "Should have the right origin for blob: iframe");
79 }));
80
81 var t3 = async_test("javascript: subframe origins");
82 addEventListener("load", t3.step_func_done(function() {
83 assert_equals(frames[2].origin, "http://{{location[host]}}",
84 "Should have the right origin for javascript: iframe");
85 }));
86
87 var t4 = async_test("srcdoc subframe origins");
88 addEventListener("load", t4.step_func_done(function() {
89 assert_equals(frames[3].location.origin, "null",
90 "Should have the right location origin for srcdoc iframe");
91 assert_equals(frames[3].origin, "http://{{location[host]}}",
92 "Should have the right origin for srcdoc iframe");
93 }));
94 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698