2 <?xml-stylesheet href=
"chrome://global/skin" type=
"text/css"?>
3 <?xml-stylesheet href=
"chrome://mochikit/content/tests/SimpleTest/test.css" type=
"text/css"?>
5 https://bugzilla.mozilla.org/show_bug.cgi?id=608669
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>
17 <!-- test code goes here -->
18 <script type=
"application/javascript"><![CDATA[
20 /** Test for Bug
608669 */
21 SimpleTest.waitForExplicitFinish();
23 addLoadEvent(nextTest);
31 let chromeWindow = window.browsingContext.topChromeWindow;
34 var notificationCount =
0;
36 observe(aSubject, aTopic, aData) {
37 is(aTopic,
"chrome-document-global-created",
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");
54 is(notificationCount,
1,
"after created window");
56 // Try loading in the window
57 testWin.location =
"bug608669.xhtml";
58 chromeWindow.onmessage = nextTest;
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;
67 is(notificationCount,
2,
"after second load");
68 is(
"x" in testWin, false,
"didn't reuse window");
70 chromeWindow.onmessage = null;
74 os.removeObserver(observer,
"chrome-document-global-created");
75 os.removeObserver(observer,
"content-document-global-created");