Receiving a request nsIChannel nsIDOMWindow always returns null on e10s

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?

+4
source share
2 answers

I have not tried this myself, so take it with salt:

, nsIDOMWindow , innerWindowId nsIChannel.loadInfo. script QueryInterface nsIDOMWindowUtils.

+1

, , , , . MDN .

0

Source: https://habr.com/ru/post/1568220/


All Articles