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"
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();
25 // Execute the next test in the generator function.
27 function nextTestAsync() {
28 SimpleTest.executeSoon(tests.next.bind(tests));
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);
42 var notificationCount =
0;
44 observe: function(aSubject, aTopic, aData) {
45 is(aSubject, browser.contentWindow,
47 is(aTopic,
"content-document-global-created",
49 is(aData,
"http://mochi.test:8888",
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");
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");
68 is(browser.contentWindow.wrappedJSObject.testVar, undefined,
69 "variable should no longer be there");
70 is(notificationCount,
2,
"Should notify on second navigation");
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");
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.
93 <browser type=
"content-primary" flex=
"1" id=
"content" src=
"about:blank"/>