Here is an example that you can get loadContent from the request (which should be nsIChannel).
var loadContext;
try {
loadContext =
aRequest.QueryInterface(Components.interfaces.nsIChannel)
.notificationCallbacks
.getInterface(Components.interfaces.nsILoadContext);
} catch (ex) {
try {
loadContext =
aRequest.loadGroup.notificationCallbacks
.getInterface(Components.interfaces.nsILoadContext);
} catch (ex) {
loadContext = null;
}
}
And nsILoadContext has the property "relatedWindow", "topWindow", so you should get the original DOMWindow.
source
share