Files
tubestation/docshell/test/browser/file_bug1328501_framescript.js
Kris Maglione fd7e9e6a69 Bug 1456035: Part 4 - Convert callers of XPCOMUtils.generateQI to ChromeUtils.generateQI. r=mccr8
This also removes any redundant Ci.nsISupports elements in the interface
lists.

This was done using the following script:

acecb401b7/processors/chromeutils-generateQI.jsm

MozReview-Commit-ID: AIx10P8GpZY
2018-04-22 20:55:06 -07:00

41 lines
1.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
);
let docShells = [];
while (docShellsEnum.hasMoreElements()) {
let ds = docShellsEnum.getNext();
docShells.push(ds);
}
return docShells;
}