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

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

Issue 2434563008: Import wpt@26c8d4e87448d1c4e5ebf2ddb4917c0633c201db (Closed)
Patch Set: Mark one more test as potentially timing out Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/wpt/html/browsers/windows/nested-browsing-contexts/frameElement.html
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/html/browsers/windows/nested-browsing-contexts/frameElement.html b/third_party/WebKit/LayoutTests/imported/wpt/html/browsers/windows/nested-browsing-contexts/frameElement.html
new file mode 100644
index 0000000000000000000000000000000000000000..f1d5581f68958390c81c008189cb34ed18ca6a25
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/wpt/html/browsers/windows/nested-browsing-contexts/frameElement.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<meta charset="utf-8"/>
+<title>HTML Test: window.frameElement</title>
+<link rel="author" title="Intel" href="http://www.intel.com/" />
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/get-host-info.sub.js"></script>
+<script>
+
+var t1 = async_test("The window's frameElement attribute must return its container element if it is a nested browsing context");
+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");
+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");
+
+function on_load() {
+ t1.step(function () {
+ assert_equals(frames[0].frameElement, document.getElementById("fr1"),
+ "The frameElement attribute should be the first iframe element.");
+ assert_equals(window["win2"].frameElement, document.getElementById("obj"),
+ "The frameElement attribute should be the object element.");
+ assert_equals(window["win3"].frameElement, document.getElementById("emb"),
+ "The frameElement attribute should be the embed element.");
+ assert_equals(document.getElementById("fr4").contentWindow[0].frameElement,
+ document.getElementById("fr4").contentDocument.getElementById("f1"),
+ "The frameElement attribute should be the frame element in 'test.html'.");
+ });
+ t1.done();
+
+ t2.step(function () {
+ assert_throws("SecurityError", function () { frames[1].frameElement; },
+ "The SecurityError exception should be thrown.");
+ });
+ t2.done();
+
+ t3.step(function () {
+ document.getElementById("fr5").contentWindow.postMessage(null, "*");
+ });
+ window.addEventListener("message", function (event) {
+ var data = JSON.parse(event.data);
+ if (data.name == "testcase3") {
+ t3.step(function () {
+ assert_equals(data.result, "window.frameElement = null",
+ "The frameElement attribute should be null.");
+ });
+ t3.done();
+ }
+ }, false);
+}
+
+</script>
+<body onload="on_load()">
+ <div id="log"></div>
+ <iframe id="fr1"></iframe>
+ <iframe id="fr2" src="test.html"></iframe> <!-- cross origin -->
+ <iframe id="fr3" src="" style="display:none"></iframe>
+ <object id="obj" name="win2" type="text/html" data="about:blank"></object>
+ <embed id="emb" name="win3" type="image/svg+xml" src="/images/green.svg" />
+ <iframe id="fr4" src="test.html"></iframe> <!-- same origin -->
+ <iframe id="fr5" src="testcase3.html"></iframe> <!-- cross origin -->
+ <script>
+
+ setup(function () {
+ var src_base = get_host_info().HTTP_REMOTE_ORIGIN;
+ src_base += document.location.pathname.substring(0, document.location.pathname.lastIndexOf("/") + 1);
+ document.getElementById("fr2").src = src_base + "test.html";
+ document.getElementById("fr5").src = src_base + "testcase3.html";
+ });
+
+ test(function () {
+ assert_equals(window.frameElement, null,
+ "The frameElement attribute should be null.");
+ }, "The window's frameElement attribute must return null if it is not a nested browsing context");
+
+ </script>
+</body>

Powered by Google App Engine
This is Rietveld 408576698