2 * Copyright 2016 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 function nav_parent_test() {
20 external.trace("Running _parent navigation tests...");
22 var iframe = document.getElementById("testframe");
23 var subframe = iframe.contentWindow.document.createElement("iframe");
25 subframe.onload = function() {
26 var doc = subframe.contentWindow.document;
27 doc.body.innerHTML = '<a href="blank2.html" id="aid" target="_parent">test</a>';
28 doc.getElementById("aid").click();
31 iframe.onload = function() {
33 var href = iframe.contentWindow.location.href;
34 ok(/.*blank2.html/.test(href), "Unexpected href " + href);
38 iframe.contentWindow.document.body.appendChild(subframe);
39 subframe.src = "blank.html";
42 function window_navigate_test() {
43 external.trace("Running window.navigate() tests...");
45 var iframe = document.getElementById("testframe");
47 iframe.onload = function() {
49 var href = iframe.contentWindow.location.href;
50 ok(href === "about:blank", "Unexpected href " + href);
54 iframe.contentWindow.navigate("about:blank");
57 function window_open_self_test() {
58 external.trace("Running window.open(_self) tests...");
60 var iframe = document.getElementById("testframe");
61 var iframe_window = iframe.contentWindow;
63 iframe.onload = function() {
65 var href = iframe.contentWindow.location.href;
66 ok(/.*blank.html\?window_open_self/.test(href), "Unexpected href " + href);
67 ok(iframe.contentWindow === iframe_window, "iframe.contentWindow !== iframe_window");
71 iframe_window.open("blank.html?window_open_self", "_self");
74 function detached_src_test() {
75 var iframe = document.createElement("iframe");
76 var onload_called = false;
78 iframe.onload = function() {
83 iframe.src = "blank.html";
84 document.body.appendChild(iframe);
85 ok(onload_called === false, "called onload too early?");
88 function init_test_iframe() {
89 var iframe = document.createElement("iframe");
91 iframe.onload = next_test;
92 iframe.id = "testframe";
93 iframe.src = "about:blank";
94 document.body.appendChild(iframe);
100 window_navigate_test,
101 window_open_self_test,