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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/html/browsers/windows/nested-browsing-contexts/frameElement.html

Issue 2446483002: Import wpt@c5a14f553cba5f197743b9af605a84eddd8692a2 (Closed)
Patch Set: Created 4 years, 1 month 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 <title>HTML Test: window.frameElement</title>
4 <link rel="author" title="Intel" href="http://www.intel.com/" />
5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script>
7 <script src="/common/get-host-info.sub.js"></script>
8 <script>
9
10 var t1 = async_test("The window's frameElement attribute must return its contain er element if it is a nested browsing context");
11 var t2 = async_test("The SecurityError must be thrown if the window accesses to frameElement attribute of a Window which does not have the same effective script origin");
12 var t3 = async_test("The window's frameElement attribute must return null if the container's document does not have the same effective script origin");
13
14 function on_load() {
15 t1.step(function () {
16 assert_equals(frames[0].frameElement, document.getElementById("fr1"),
17 "The frameElement attribute should be the first iframe element .");
18 assert_equals(window["win2"].frameElement, document.getElementById("obj"),
19 "The frameElement attribute should be the object element.");
20 assert_equals(window["win3"].frameElement, document.getElementById("emb"),
21 "The frameElement attribute should be the embed element.");
22 assert_equals(document.getElementById("fr4").contentWindow[0].frameElement,
23 document.getElementById("fr4").contentDocument.getElementById( "f1"),
24 "The frameElement attribute should be the frame element in 'te st.html'.");
25 });
26 t1.done();
27
28 t2.step(function () {
29 assert_throws("SecurityError", function () { frames[1].frameElement; },
30 "The SecurityError exception should be thrown.");
31 });
32 t2.done();
33
34 t3.step(function () {
35 document.getElementById("fr5").contentWindow.postMessage(null, "*");
36 });
37 window.addEventListener("message", function (event) {
38 var data = JSON.parse(event.data);
39 if (data.name == "testcase3") {
40 t3.step(function () {
41 assert_equals(data.result, "window.frameElement = null",
42 "The frameElement attribute should be null.");
43 });
44 t3.done();
45 }
46 }, false);
47 }
48
49 </script>
50 <body onload="on_load()">
51 <div id="log"></div>
52 <iframe id="fr1"></iframe>
53 <iframe id="fr2" src="test.html"></iframe> <!-- cross origin -->
54 <iframe id="fr3" src="" style="display:none"></iframe>
55 <object id="obj" name="win2" type="text/html" data="about:blank"></object>
56 <embed id="emb" name="win3" type="image/svg+xml" src="/images/green.svg" />
57 <iframe id="fr4" src="test.html"></iframe> <!-- same origin -->
58 <iframe id="fr5" src="testcase3.html"></iframe> <!-- cross origin -->
59 <script>
60
61 setup(function () {
62 var src_base = get_host_info().HTTP_REMOTE_ORIGIN;
63 src_base += document.location.pathname.substring(0, document.location.pathna me.lastIndexOf("/") + 1);
64 document.getElementById("fr2").src = src_base + "test.html";
65 document.getElementById("fr5").src = src_base + "testcase3.html";
66 });
67
68 test(function () {
69 assert_equals(window.frameElement, null,
70 "The frameElement attribute should be null.");
71 }, "The window's frameElement attribute must return null if it is not a nested browsing context");
72
73 </script>
74 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698