I have an observer on "http-on-modify-request" and I need to get the DOMWindow that request is associated with.
The following code was taken from AdBlock Plus and is based on this article.
function getRequestWindow(/**nsIChannel*/ channel) /**nsIDOMWindow*/
{
try
{
if (channel.notificationCallbacks)
return channel.notificationCallbacks.getInterface(Ci.nsILoadContext).associatedWindow;
} catch(e) {}
try
{
if (channel.loadGroup && channel.loadGroup.notificationCallbacks)
return channel.loadGroup.notificationCallbacks.getInterface(Ci.nsILoadContext).associatedWindow;
} catch(e) {}
return null;
}
However, this code is no longer working on multiprocess Firefox (v36+, right now on Firefox Nightly).
Any ideas?