Bug 1814798 - pt 2. Add a PHCManager component to control PHC r=glandium,emilio
[gecko.git] / docshell / test / chrome / test_bug608669.xhtml
blobf6a62b0802a5792009017a8d19620bd2a5503cca
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
4 <!--
5 https://bugzilla.mozilla.org/show_bug.cgi?id=608669
6 -->
7 <window title="Mozilla Bug 608669"
8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
11 <!-- test results are displayed in the html:body -->
12 <body xmlns="http://www.w3.org/1999/xhtml">
13 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=608669"
14 target="_blank">Mozilla Bug 608669</a>
15 </body>
17 <!-- test code goes here -->
18 <script type="application/javascript"><![CDATA[
20 /** Test for Bug 608669 */
21 SimpleTest.waitForExplicitFinish();
23 addLoadEvent(nextTest);
25 let gen = doTest();
27 function nextTest() {
28 gen.next();
31 let chromeWindow = window.browsingContext.topChromeWindow;
33 function* doTest() {
34 var notificationCount = 0;
35 var observer = {
36 observe(aSubject, aTopic, aData) {
37 is(aTopic, "chrome-document-global-created",
38 "correct topic");
39 is(aData, "null",
40 "correct data");
41 notificationCount++;
45 var os = SpecialPowers.Services.obs;
46 os.addObserver(observer, "chrome-document-global-created");
47 os.addObserver(observer, "content-document-global-created");
49 is(notificationCount, 0, "initial count");
51 // create a new window
52 var testWin = chromeWindow.open("", "bug 608669", "chrome,width=600,height=600");
53 testWin.x = "y";
54 is(notificationCount, 1, "after created window");
56 // Try loading in the window
57 testWin.location = "bug608669.xhtml";
58 chromeWindow.onmessage = nextTest;
59 yield undefined;
60 is(notificationCount, 1, "after first load");
61 is(testWin.x, "y", "reused window");
63 // Try loading again in the window
64 testWin.location = "bug608669.xhtml?x";
65 chromeWindow.onmessage = nextTest;
66 yield undefined;
67 is(notificationCount, 2, "after second load");
68 is("x" in testWin, false, "didn't reuse window");
70 chromeWindow.onmessage = null;
72 testWin.close();
74 os.removeObserver(observer, "chrome-document-global-created");
75 os.removeObserver(observer, "content-document-global-created");
76 SimpleTest.finish();
79 ]]></script>
80 </window>