summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts')
-rw-r--r--testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement-siblings.sub.html42
-rw-r--r--testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement.sub.html66
-rw-r--r--testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/name-attribute.window.js58
-rw-r--r--testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/frameElement-nested-frame.html7
-rw-r--r--testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/frameElement-sibling-accessed.html16
-rw-r--r--testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/frameElement-sibling-accessor.html33
-rw-r--r--testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/frameElement-window-post.html14
-rw-r--r--testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/post-to-opener.html7
-rw-r--r--testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/post-to-parent.html6
-rw-r--r--testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-parent-null.html66
-rw-r--r--testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-parent.html44
-rw-r--r--testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-top-null.html66
-rw-r--r--testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-top.html65
13 files changed, 490 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement-siblings.sub.html b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement-siblings.sub.html
new file mode 100644
index 0000000000..0c814d26d9
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement-siblings.sub.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>window.frameElement access to a same-origin-domain sibling</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<iframe src="//{{hosts[][]}}:{{ports[http][0]}}/html/browsers/windows/nested-browsing-contexts/resources/frameElement-sibling-accessed.html"></iframe>
+<iframe src="//{{hosts[][www]}}:{{ports[http][0]}}/html/browsers/windows/nested-browsing-contexts/resources/frameElement-sibling-accessor.html"></iframe>
+
+<script>
+"use strict";
+setup({ explicit_done: true });
+
+window.onload = () => {
+ promise_test(async () => {
+ frames[1].postMessage({}, "*");
+ const result = await waitForMessage();
+
+ assert_equals(result, "SecurityError");
+ }, "it must give a \"SecurityError\" DOMException if the pages are different-origin domain");
+
+ promise_test(async () => {
+ document.domain = document.domain;
+
+ frames[0].postMessage({ newDocumentDomain: document.domain }, "*");
+ assert_equals(await waitForMessage(), "done");
+
+ frames[1].postMessage({ newDocumentDomain: document.domain }, "*");
+ const result = await waitForMessage();
+
+ assert_equals(result, "HTMLIFrameElement");
+ }, "it must return the iframe element if the pages are same-origin domain");
+
+ done();
+};
+
+function waitForMessage() {
+ return new Promise(resolve => {
+ window.addEventListener("message", e => resolve(e.data), { once: true });
+ });
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement.sub.html b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement.sub.html
new file mode 100644
index 0000000000..7ea1182081
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement.sub.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <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>
+ </head>
+ <body>
+ <!-- t1 (same-origin)-->
+ <iframe id="iframe_0"></iframe>
+ <iframe id="iframe_1" src="./resources/frameElement-nested-frame.html"></iframe>
+ <object id="object_id" name="object_name" type="text/html" data="about:blank"></object>
+ <embed id="embed_id" name="embed_name" type="image/svg+xml" src="/images/green.svg" />
+
+ <!-- t2 (cross-origin) -->
+ <iframe name="iframe_2" src="http://{{hosts[alt][]}}:{{ports[http][0]}}/html/browsers/windows/nested-browsing-contexts/resources/frameElement-nested-frame.html"></iframe>
+
+ <!-- t3 (cross-origin) -->
+ <iframe id="iframe_3" src="http://{{hosts[alt][]}}:{{ports[http][0]}}/html/browsers/windows/nested-browsing-contexts/resources/frameElement-window-post.html"></iframe>
+
+ <script>
+ 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");
+
+ var t1 = async_test("The window's frameElement attribute must return its container element if it is a nested browsing context");
+ window.addEventListener("load", t1.step_func_done(function() {
+ assert_equals(frames[0].frameElement, document.getElementById("iframe_0"),
+ "The frameElement attribute should be the first iframe element.");
+ assert_equals(window["object_name"].frameElement, document.getElementById("object_id"),
+ "The frameElement attribute should be the object element.");
+ assert_equals(window["embed_name"].frameElement, document.getElementById("embed_id"),
+ "The frameElement attribute should be the embed element.");
+ assert_equals(document.getElementById("iframe_1").contentWindow[0].frameElement,
+ document.getElementById("iframe_1").contentDocument.getElementById("f1"),
+ "The frameElement attribute should be the frame element in 'resources/frameElement-nested-frame.html'.");
+ }));
+
+ 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");
+ window.addEventListener("load", t2.step_func_done(function() {
+ assert_throws_dom("SecurityError", function() {
+ frames["iframe_2"].frameElement;
+ },
+ "The SecurityError exception should be thrown.");
+ }));
+
+ 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");
+ window.addEventListener("load", function() {
+ 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);
+ document.getElementById("iframe_3").contentWindow.postMessage(null, "*");
+ })
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/name-attribute.window.js b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/name-attribute.window.js
new file mode 100644
index 0000000000..69908af71b
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/name-attribute.window.js
@@ -0,0 +1,58 @@
+// META: script=/common/get-host-info.sub.js
+
+[
+ "frame", // This works without <frameset>, so great
+ "iframe",
+ "object",
+ "embed",
+].forEach(element => {
+ [
+ null,
+ "",
+ "initialvalue"
+ ].forEach(initialNameValue => {
+ [
+ "same-origin",
+ "cross-origin"
+ ].forEach(originType => {
+ async_test(t => {
+ const ident = element + initialNameValue + originType,
+ file = `${new URL("resources/post-to-parent.html", location.href).pathname}?ident=${ident}`,
+ child = originType === "same-origin" ? file : `${get_host_info().HTTP_REMOTE_ORIGIN}${file}`,
+ frame = document.createElement(element),
+ expectedNameValue = initialNameValue || "";
+ let state = "set";
+ const listener = t.step_func(e => {
+ if (e.data.ident === ident) {
+ assert_equals(e.data.name, expectedNameValue); // This check is always the same
+ if (state === "set") {
+ frame.setAttribute("name", "meh");
+ state = "remove"
+ e.source.postMessage(null, "*");
+ return;
+ }
+ if (state === "remove") {
+ frame.removeAttribute("name");
+ state = "done";
+ e.source.postMessage(null, "*");
+ return;
+ }
+ if (state === "done") {
+ t.done();
+ }
+ }
+ });
+ frame.setAttribute(element === "object" ? "data" : "src", child);
+ if (initialNameValue !== null) {
+ frame.setAttribute("name", initialNameValue);
+ }
+ t.add_cleanup(() => {
+ self.removeEventListener("message", listener);
+ frame.remove();
+ });
+ self.addEventListener("message", listener);
+ document.body.append(frame);
+ }, `${originType} <${element}${initialNameValue !== null ? ' name=' + initialNameValue : ''}>`);
+ });
+ });
+});
diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/frameElement-nested-frame.html b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/frameElement-nested-frame.html
new file mode 100644
index 0000000000..d066b8d4cb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/frameElement-nested-frame.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<meta charset="utf-8"/>
+<title>HTML Test: child browsing context created by the frame element</title>
+<link rel="author" title="Intel" href="http://www.intel.com/" />
+<frameset>
+ <frame id="f1" name="frame">
+</frameset>
diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/frameElement-sibling-accessed.html b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/frameElement-sibling-accessed.html
new file mode 100644
index 0000000000..15245981ce
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/frameElement-sibling-accessed.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>This page will set its document.domain on request so that its sibling can access it</title>
+
+<h1>I did get loaded</h1>
+
+<script>
+"use strict";
+
+window.onmessage = e => {
+ const { newDocumentDomain } = e.data;
+ document.domain = newDocumentDomain;
+
+ parent.postMessage("done", "*");
+};
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/frameElement-sibling-accessor.html b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/frameElement-sibling-accessor.html
new file mode 100644
index 0000000000..4b4c7a87bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/frameElement-sibling-accessor.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>This page will attempt to access the frameElement of its sibling and report the results on request</title>
+
+<h1>I did get loaded</h1>
+
+<script>
+"use strict";
+
+window.onmessage = e => {
+ const { newDocumentDomain } = e.data;
+ if (newDocumentDomain) {
+ document.domain = newDocumentDomain;
+ }
+
+ const siblingWindow = parent.frames[0];
+
+ try {
+ const { frameElement } = siblingWindow;
+
+ let result = "something wierd happened";
+ if (frameElement === null) {
+ result = "null";
+ } else if (frameElement.constructor) {
+ result = frameElement.constructor.name;
+ }
+
+ parent.postMessage(result, "*");
+ } catch (e) {
+ parent.postMessage(e.name, "*");
+ }
+};
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/frameElement-window-post.html b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/frameElement-window-post.html
new file mode 100644
index 0000000000..d67bde26f4
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/frameElement-window-post.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<meta charset="utf-8"/>
+<title>Testcase 3: frameElement attribute must return null if the container\'s document does not have the same effective script origin</title>
+<script>
+window.addEventListener("message", function (event) {
+ try {
+ var result = "window.frameElement = " + window.frameElement;
+ } catch (e) {
+ result = e.message;
+ }
+ event.source.postMessage(JSON.stringify({name: "testcase3", result: result}),
+ "*");
+}, false);
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/post-to-opener.html b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/post-to-opener.html
new file mode 100644
index 0000000000..65a825f573
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/post-to-opener.html
@@ -0,0 +1,7 @@
+<script>
+ if (window.opener) {
+ window.opener.postMessage({
+ "parent_isTop": (window.parent === window)
+ }, "*");
+ }
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/post-to-parent.html b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/post-to-parent.html
new file mode 100644
index 0000000000..302e9d9cc1
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/post-to-parent.html
@@ -0,0 +1,6 @@
+<script>
+const ident = new URL(location).searchParams.get("ident"),
+ post = () => parent.postMessage({ name: window.name, ident }, "*");
+onmessage = () => post();
+post();
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-parent-null.html b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-parent-null.html
new file mode 100644
index 0000000000..428312086e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-parent-null.html
@@ -0,0 +1,66 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>window.parent: `null`</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+async_test(t => {
+ var iframe = document.createElement('iframe');
+ iframe.onload = t.step_func_done(() => {
+ var iWindow = iframe.contentWindow;
+ assert_equals(iWindow.parent, window);
+ document.body.removeChild(iframe);
+ assert_equals(iWindow.parent, null);
+ });
+
+ document.body.appendChild(iframe);
+}, '`window.parent` is null when browsing context container element removed');
+
+async_test(t => {
+ var iframe = document.createElement('iframe');
+ var iframe2, removedEl;
+
+ var testFunc = t.step_func(() => {
+ var frameWindow = iframe.contentWindow;
+ var frame2Window = iframe2.contentWindow;
+
+ assert_equals(frameWindow.parent, window);
+ assert_equals(frame2Window.parent, frameWindow);
+
+ iframe.removeEventListener('load', nestFrame);
+ iframe2.removeEventListener('load', testFunc);
+ removedEl = document.body.removeChild(iframe);
+
+ assert_equals(frameWindow.parent, null);
+ assert_equals(frame2Window.parent, null);
+
+ removedEl.addEventListener('load', t.step_func_done(() => {
+ // reattached iframe's browsing context will report window.parent again
+ assert_equals(removedEl.contentWindow.parent, window);
+ // The following window s are no longer referenced by active browsing contexts
+ assert_equals(frameWindow.parent, null);
+ assert_equals(frame2Window.parent, null);
+ // Per #the-iframe-element, reattaching a removed iframe will result in the
+ // browser creating a new browsing context once again, with a fresh
+ // document in our case, so the second iframe or any other elements
+ // previously added to iframe.contentDocument will be gone
+ assert_equals(removedEl.contentDocument.querySelector('iframe'), null);
+ assert_equals(removedEl.contentDocument.querySelector('hr'), null);
+ }));
+ document.body.appendChild(removedEl);
+ });
+
+ var nestFrame = function () {
+ iframe.contentDocument.body.appendChild(document.createElement('hr'));
+ iframe2 = iframe.contentDocument.createElement('iframe');
+ // Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1229707
+ iframe2.src = '/common/blank.html';
+ iframe2.addEventListener('load', testFunc);
+ iframe.contentDocument.body.appendChild(iframe2);
+ };
+
+ iframe.addEventListener('load', nestFrame);
+ document.body.appendChild(iframe);
+}, '`window.parent` null when parent browsing context container removed');
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-parent.html b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-parent.html
new file mode 100644
index 0000000000..ef662dca5e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-parent.html
@@ -0,0 +1,44 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>window.parent</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ test(function() {
+ assert_equals(window, parent)
+ }, '`window.parent` for top-level browsing context');
+
+async_test(t => {
+ var iframe = document.createElement('iframe');
+ iframe.onload = t.step_func_done(function () {
+ var iWindow = iframe.contentWindow;
+ assert_equals(iWindow.parent, window);
+ });
+ document.body.appendChild(iframe);
+}, '`window.parent` on single nested browsing context');
+
+async_test(t => {
+ var iframe = document.createElement('iframe');
+ var iframe2;
+
+ var testFunc = t.step_func_done(function () {
+ var frameWindow = iframe.contentWindow;
+ var frame2Window = iframe2.contentWindow;
+ assert_equals(frameWindow.parent, window);
+ assert_equals(frame2Window.parent, frameWindow);
+ assert_not_equals(frame2Window.parent, window);
+ });
+
+ var nestFrame = function () {
+ iframe2 = iframe.contentDocument.createElement('iframe');
+ // Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1229707
+ iframe2.src = '/common/blank.html';
+ iframe2.addEventListener('load', testFunc);
+ iframe.contentDocument.body.appendChild(iframe2);
+ };
+
+ iframe.addEventListener('load', nestFrame);
+ document.body.appendChild(iframe);
+}, '`window.parent` for multiple nested browsing contexts');
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-top-null.html b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-top-null.html
new file mode 100644
index 0000000000..cf7fcf2ae1
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-top-null.html
@@ -0,0 +1,66 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>window.top: `null`</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+async_test(function (t) {
+ var iframe = document.createElement('iframe');
+ iframe.onload = t.step_func_done(() => {
+ var iWindow = iframe.contentWindow;
+ /**
+ * `top` should return the top-level browsing context but will return
+ * `null` if none exists, such as when any of the BC's ancestor browsing
+ * context container's document elements are disconnected/removed.
+ */
+ assert_equals(iWindow.top, window);
+ document.body.removeChild(iframe);
+ assert_equals(iWindow.top, null);
+ });
+
+ document.body.appendChild(iframe);
+}, '`window.top` is null when browsing context container element removed');
+
+async_test(t => {
+ var iframe = document.createElement('iframe');
+ var iframe2, removedEl;
+
+ var testFunc = t.step_func(() => {
+ var frameWindow = iframe.contentWindow;
+ var frame2Window = iframe2.contentWindow;
+
+ assert_equals(frameWindow.top, window);
+ assert_equals(frame2Window.top, window);
+
+ iframe.removeEventListener('load', nestFrame);
+ iframe2.removeEventListener('load', testFunc);
+
+ removedEl = document.body.removeChild(iframe);
+
+ assert_equals(frameWindow.top, null);
+ assert_equals(frame2Window.top, null);
+
+ removedEl.addEventListener('load', t.step_func_done(() => {
+ // reattached iframe's browsing context will report window.top
+ assert_equals(removedEl.contentWindow.top, window);
+ // removed/re-added iframes will have new browsing context / window
+ assert_equals(frameWindow.top, null);
+ assert_equals(frame2Window.top, null);
+ }));
+
+ document.body.appendChild(removedEl);
+ });
+
+ var nestFrame = function () {
+ iframe2 = iframe.contentDocument.createElement('iframe');
+ // Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1229707
+ iframe2.src = '/common/blank.html';
+ iframe2.addEventListener('load', testFunc);
+ iframe.contentDocument.body.appendChild(iframe2);
+ };
+
+ iframe.addEventListener('load', nestFrame);
+ document.body.appendChild(iframe);
+}, '`window.top`null when any ancestor browsing context container removed');
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-top.html b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-top.html
new file mode 100644
index 0000000000..e5590adeb8
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-top.html
@@ -0,0 +1,65 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>window.top</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+test(function() {
+ assert_equals(window, top)
+}, "Top level browsing context");
+
+function step_func(test) {
+ return function (top_pointer) {
+ test.step(function() {assert_equals(top_pointer, window);})
+ test.done();
+ }
+}
+
+var t1 = async_test("One nested iframe");
+t1.step(function() {
+ var iframe = document.createElement("iframe");
+ //iframe.src = "data:text/html,"
+
+ iframe.onload = t1.step_func(
+ function() {
+ var doc = iframe.contentDocument;
+ iframe.contentWindow.test_func = step_func(t1);
+
+ var script = doc.createElement("script")
+ script.textContent = "test_func(top);"
+ doc.body.appendChild(script);
+ });
+ document.body.appendChild(iframe);
+});
+
+var t2 = async_test("Two nested iframes");
+t2.step(function() {
+ var iframe = document.createElement("iframe");
+ //iframe.src = "data:text/html,"
+
+ iframe.onload = t2.step_func(
+ function() {
+ var doc = iframe.contentDocument;
+ iframe2 = document.createElement("iframe");
+ //iframe2.src = "data:text/html,"
+ // Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1229707
+ iframe2.src = '/common/blank.html';
+
+ iframe2.onload = t2.step_func(
+ function() {
+ var doc2 = iframe2.contentDocument;
+
+ iframe2.contentWindow.test_func = step_func(t2);
+
+ var script = doc2.createElement("script")
+ script.textContent = "test_func(top);"
+ doc2.body.appendChild(script);
+ });
+ doc.body.appendChild(iframe2);
+ });
+
+ document.body.appendChild(iframe);
+});
+
+</script>