OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <body> |
| 3 <script src="../../resources/js-test.js"></script> |
| 4 <script> |
| 5 description("This test checks that the page visibility event is fired when frame
is unloaded."); |
| 6 |
| 7 var jsTestIsAsync = true; |
| 8 var frameDocs = []; |
| 9 var docsLoaded = 0; |
| 10 var numFrames = 3; |
| 11 |
| 12 function startTest() { |
| 13 if (++docsLoaded < numFrames) |
| 14 return; |
| 15 |
| 16 debug("Loaded all frames."); |
| 17 |
| 18 frameDocs.push(window[0].document); |
| 19 frameDocs.push(window[0][0].document); |
| 20 frameDocs.push(window[0][1].document); |
| 21 |
| 22 for (var i = 0; i < frameDocs.length; ++i) { |
| 23 frameDocs[i].addEventListener( |
| 24 "visibilitychange", |
| 25 onVisibilityChange.bind(null, i), false); |
| 26 } |
| 27 |
| 28 document.body.removeChild(document.getElementById("frame1")); |
| 29 |
| 30 finishJSTest(); |
| 31 } |
| 32 |
| 33 function onVisibilityChange(i) { |
| 34 shouldBe('frameDocs[' + i + '].visibilityState', '"hidden"'); |
| 35 } |
| 36 |
| 37 </script> |
| 38 <iframe id="frame1" src="resources/page-visibility-iframe-with-subframes.html"><
/iframe> |
| 39 </body> |
| 40 </html> |
OLD | NEW |