I have an observer in "http-on-modify-request" and I need to get the DOMWindow that the 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 no longer works on Firefox multiprocessor (v36 +, right now on Firefox Nightly ).
Any ideas?
source
share