2 <body onload=
"startTest()">
4 <script src=
"../../resources/js-test.js"></script>
8 description("This test checks that an iframe that moves between pages with different visibility will have the correct visibility value.");
10 var jsTestIsAsync
= true;
13 var numVisibilityChanges
= 0;
15 function window2Loaded() {
16 debug("Window 2 Loaded");
18 iframe
= window2
.document
.getElementById("iframe");
20 shouldBeFalse("window.document.hidden");
21 shouldBeFalse("window2.document.hidden");
22 shouldBeFalse("iframe.contentDocument.hidden");
24 // Change the visibility of the current page to invisible.
25 if (window
.testRunner
) {
26 numVisibilityChanges
++;
27 window
.testRunner
.setPageVisibility("hidden");
31 function onVisibilityChange() {
32 shouldBeTrue("window.document.hidden");
33 shouldBeFalse("window2.document.hidden");
34 shouldBeFalse("iframe.contentDocument.hidden");
36 window
.document
.adoptNode(iframe
);
37 window
.document
.body
.appendChild(iframe
);
38 debug("Adopted iframe to Window 1");
40 shouldBeTrue("window.document.hidden");
41 shouldBeFalse("window2.document.hidden");
42 shouldBeTrue("iframe.contentDocument.hidden");
49 function startTest() {
50 if (window
.testRunner
) {
51 testRunner
.waitUntilDone();
52 testRunner
.setCanOpenWindows();
55 debug("Window 1 Loaded");
56 document
.addEventListener("visibilitychange",
57 onVisibilityChange
, false);
59 window2
= window
.open("resources/page-visibility-iframe-move-new-page.html");
60 window2
.addEventListener("load", window2Loaded
, false);