Bug 752461 - Hide click-to-play overlays when choosing "never activate plugins.....
[gecko.git] / docshell / test / chrome / bug449780_window.xul
blob5733f93d61f8e83eda737dcfdd44887fb902b33e
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
3 <window title="Mozilla Bug 449780" onload="doTheTest()"
4 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
6 <hbox id="parent">
7 </hbox>
9 <!-- test code goes here -->
10 <script type="application/javascript"><![CDATA[
11 var imports = [ "SimpleTest", "is", "isnot", "ok", "onerror" ];
12 for each (var name in imports) {
13 window[name] = window.opener.wrappedJSObject[name];
16 function $(id) {
17 return document.getElementById(id);
20 function addBrowser(parent, id, width, height) {
21 var b =
22 document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "browser");
23 b.setAttribute("type", "content");
24 b.setAttribute("id", id);
25 b.setAttribute("width", width);
26 b.setAttribute("height", height);
27 $(parent).appendChild(b);
29 addBrowser("parent", "f1", 300, 200);
30 addBrowser("parent", "f2", 300, 200);
32 /** Test for Bug 449780 **/
33 var doc1 = "data:text/html,<html><body>This is a test</body></html>";
34 var doc2 = "data:text/html,<html><body>This is a second test</body></html>";
36 function getDOM(id) {
37 return $(id).contentDocument.documentElement.innerHTML;
40 var tester = (function() {
41 var origDOM = getDOM("f1");
42 $("f1").contentDocument.body.textContent = "Modified";
43 var modifiedDOM = getDOM("f1");
44 isnot(origDOM, modifiedDOM, "DOM should be different");
45 $("f1").contentWindow.location.href = doc2;
46 yield;
48 $("f1").goBack();
49 yield;
51 is(getDOM("f1"), modifiedDOM, "Should have been bfcached");
52 $("f1").goForward();
53 yield;
55 // Ignore the notifications during swap
56 $("f1").removeEventListener("pageshow", testDriver, false);
57 $("f1").swapDocShells($("f2"));
58 $("f2").addEventListener("pageshow", testDriver, false);
59 $("f2").goBack();
60 yield;
62 is(getDOM("f2"), origDOM, "Should have not have been bfcached");
63 window.close();
64 SimpleTest.finish();
65 yield;
66 })();
68 function testDriver() {
69 setTimeout(function() { tester.next() }, 0);
72 function doTheTest() {
73 $("f1").addEventListener("pageshow", testDriver, false);
74 $("f1").setAttribute("src", doc1);
76 ]]></script>
77 </window>