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=
"application/javascript" src=
"chrome://mochikit/content/chrome-harness.js" />
12 <script type=
"application/javascript" src=
"docshell_helpers.js" />
13 <script type=
"application/javascript"><![CDATA[
15 // Define the generator-iterator for the tests.
16 var tests = testIterator();
19 // Execute the next test in the generator function.
21 function nextTestAsync() {
22 SimpleTest.executeSoon(tests.next.bind(tests));
26 // Generator function for test steps for bug
582176:
27 // Description goes here.
29 function testIterator()
31 var browser = document.getElementById('content');
32 browser.addEventListener(
"pageshow", nextTestAsync, true);
36 var notificationCount =
0;
38 observe: function(aSubject, aTopic, aData) {
39 is(aSubject, browser.contentWindow,
41 is(aTopic,
"content-document-global-created",
43 is(aData,
"http://mochi.test:8888",
49 os = Components.classes[
"@mozilla.org/observer-service;1"].
50 getService(Components.interfaces.nsIObserverService);
51 os.addObserver(observer,
"content-document-global-created", false);
53 browser.loadURI(
"http://mochi.test:8888/tests/docshell/test/chrome/582176_dummy.html");
55 is(browser.contentWindow.testVar, undefined,
56 "variable unexpectedly there already");
57 browser.contentWindow.wrappedJSObject.testVar =
1;
58 is(notificationCount,
1,
"Should notify on first navigation");
60 browser.loadURI(
"http://mochi.test:8888/tests/docshell/test/chrome/582176_dummy.html?2");
62 is(browser.contentWindow.wrappedJSObject.testVar, undefined,
63 "variable should no longer be there");
64 is(notificationCount,
2,
"Should notify on second navigation");
68 is(browser.contentWindow.wrappedJSObject.testVar,
1,
69 "variable should still be there");
70 is(notificationCount,
2,
"Should not notify on back navigation");
72 browser.loadURI(
"http://mochi.test:8888/tests/docshell/test/chrome/582176_xml.xml");
74 is(browser.contentDocument.body.textContent,
"xslt result",
75 "Transform performed successfully");
76 is(notificationCount,
3,
"Should notify only once on XSLT navigation");
78 os.removeObserver(observer,
"content-document-global-created")
80 // Tell the framework the test is finished. Include the final 'yield'
81 // statement to prevent a StopIteration exception from being thrown.
87 <browser type=
"content-primary" flex=
"1" id=
"content" src=
"about:blank"/>