Bug 754472 - Implement multiple plugin click-to-play UI. r=jaws r=margaret r=dietrich
[gecko.git] / docshell / test / chrome / bug582176_window.xul
blob8a486ceb574cbc77dcdd16c44a27c472d86a38b1
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
4 <window id="303267Test"
5 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
6 width="600"
7 height="600"
8 onload="nextTestAsync();"
9 title="bug 582176 test">
11 <script type="text/javascript"
12 src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
13 <script type="text/javascript"
14 src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
15 <script type="text/javascript"
16 src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
17 <script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
18 <script type="application/javascript" src="docshell_helpers.js" />
19 <script type="application/javascript"><![CDATA[
21 // Define the generator-iterator for the tests.
22 var tests = testIterator();
24 ////
25 // Execute the next test in the generator function.
27 function nextTestAsync() {
28 SimpleTest.executeSoon(tests.next.bind(tests));
31 ////
32 // Generator function for test steps for bug 582176:
33 // Description goes here.
35 function testIterator()
37 var browser = document.getElementById('content');
38 browser.addEventListener("pageshow", nextTestAsync, true);
40 enableBFCache(true);
42 var notificationCount = 0;
43 var observer = {
44 observe: function(aSubject, aTopic, aData) {
45 is(aSubject, browser.contentWindow,
46 "correct subject");
47 is(aTopic, "content-document-global-created",
48 "correct topic");
49 is(aData, "http://mochi.test:8888",
50 "correct data");
51 notificationCount++;
55 os = Components.classes["@mozilla.org/observer-service;1"].
56 getService(Components.interfaces.nsIObserverService);
57 os.addObserver(observer, "content-document-global-created", false);
59 browser.loadURI("http://mochi.test:8888/tests/docshell/test/chrome/582176_dummy.html");
60 yield;
61 is(browser.contentWindow.testVar, undefined,
62 "variable unexpectedly there already");
63 browser.contentWindow.wrappedJSObject.testVar = 1;
64 is(notificationCount, 1, "Should notify on first navigation");
66 browser.loadURI("http://mochi.test:8888/tests/docshell/test/chrome/582176_dummy.html?2");
67 yield;
68 is(browser.contentWindow.wrappedJSObject.testVar, undefined,
69 "variable should no longer be there");
70 is(notificationCount, 2, "Should notify on second navigation");
72 browser.goBack();
73 yield;
74 is(browser.contentWindow.wrappedJSObject.testVar, 1,
75 "variable should still be there");
76 is(notificationCount, 2, "Should not notify on back navigation");
78 browser.loadURI("http://mochi.test:8888/tests/docshell/test/chrome/582176_xml.xml");
79 yield;
80 is(browser.contentDocument.body.textContent, "xslt result",
81 "Transform performed successfully");
82 is(notificationCount, 3, "Should notify only once on XSLT navigation");
84 os.removeObserver(observer, "content-document-global-created")
86 // Tell the framework the test is finished. Include the final 'yield'
87 // statement to prevent a StopIteration exception from being thrown.
88 finish();
89 yield;
92 ]]></script>
93 <browser type="content-primary" flex="1" id="content" src="about:blank"/>
94 </window>