Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: os == 'android'
- Manifest: docshell/test/chrome/chrome.toml
<?xml version="1.0"?>
<!--
-->
<!-- test results are displayed in the html:body -->
</body>
<!-- test code goes here -->
<script type="application/javascript"><![CDATA[
SimpleTest.waitForExplicitFinish();
addLoadEvent(nextTest);
let gen = doTest();
function nextTest() {
gen.next();
}
let chromeWindow = window.browsingContext.topChromeWindow;
function* doTest() {
var notificationCount = 0;
var observer = {
observe(aSubject, aTopic, aData) {
is(aTopic, "chrome-document-global-created",
"correct topic");
is(aData, "null",
"correct data");
notificationCount++;
}
};
var os = SpecialPowers.Services.obs;
os.addObserver(observer, "chrome-document-global-created");
os.addObserver(observer, "content-document-global-created");
is(notificationCount, 0, "initial count");
// create a new window
testWin.x = "y";
is(notificationCount, 1, "after created window");
// Try loading in the window
chromeWindow.onmessage = nextTest;
yield undefined;
is(notificationCount, 1, "after first load");
is(testWin.x, "y", "reused window");
// Try loading again in the window
chromeWindow.onmessage = nextTest;
yield undefined;
is(notificationCount, 2, "after second load");
is("x" in testWin, false, "didn't reuse window");
chromeWindow.onmessage = null;
testWin.close();
os.removeObserver(observer, "chrome-document-global-created");
os.removeObserver(observer, "content-document-global-created");
SimpleTest.finish();
}
]]></script>
</window>