Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
type="text/css"?>
<!--
-->
<window title="Mozilla Bug 1411707"
<!-- test results are displayed in the html:body -->
target="_blank">Mozilla Bug 1411707</a>
</body>
<!-- test code goes here -->
<script type="application/javascript"><![CDATA[
SimpleTest.waitForExplicitFinish();
async function waitForEvent(url) {
return new Promise(resolve => {
SpecialPowers.addObserver(function inserted(document) {
is(document.documentURI, url, "Correct URL");
is(document.readyState, "loading", "Correct readyState");
SpecialPowers.removeObserver(inserted, "document-element-inserted");
resolve();
}, "document-element-inserted");
})
}
// Load a XUL document that also has an iframe to a subdocument, and
// expect both events to fire with the docs in the correct state.
async function testEvents() {
info(`Waiting for events after loading ${OUTER_URL}`);
let win = window.browsingContext.topChromeWindow.openDialog(OUTER_URL, "_blank", "chrome,dialog=no,all");
await waitForEvent(OUTER_URL);
await waitForEvent(INNER_URL);
win.close();
}
(async function() {
// Test the same document twice to make to make sure we are
// firing properly when loading the protype document.
await testEvents();
await testEvents();
SimpleTest.finish();
})();
]]></script>
</window>