fune/docshell/test/browser/file_bug1328501_framescript.js
Kris Maglione 3a5c05e76f Bug 1484496: Part 5e - Convert remaining nsISimpleEnumerator users to use JS iteration. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D3733

--HG--
extra : rebase_source : c0fac176d7b3d840c4dbb14f8d95ccfc7f83a5a8
extra : histedit_source : a92c40117d0808a3ad68c972f622a7a42c9ae8ba
2018-08-18 18:13:14 -07:00

35 lines
1 KiB
JavaScript

// Forward iframe loaded event.
addEventListener("frames-loaded",
e => sendAsyncMessage("test:frames-loaded"), true, true);
let requestObserver = {
observe(subject, topic, data) {
if (topic == "http-on-opening-request") {
// Get DOMWindow on all child docshells to force about:blank
// content viewers being created.
getChildDocShells().map(ds => {
let window = ds.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsILoadContext)
.associatedWindow;
});
}
},
QueryInterface: ChromeUtils.generateQI([
Ci.nsIObserver
])
}
Services.obs.addObserver(requestObserver, "http-on-opening-request");
addEventListener("unload", e => {
if (e.target == this) {
Services.obs.removeObserver(requestObserver, "http-on-opening-request");
}
});
function getChildDocShells() {
let docShellsEnum = docShell.getDocShellEnumerator(
Ci.nsIDocShellTreeItem.typeAll,
Ci.nsIDocShell.ENUMERATE_FORWARDS
);
return Array.from(docShellsEnum);
}