On Dec 19 2006, 9:54 am, "Andrei Korostelev" <[EMAIL PROTECTED]> wrote:
> On Dec 19, 3:58 pm, Boris Zbarsky <[EMAIL PROTECTED]> wrote:
>
> > Andrei Korostelev wrote:
> > > // I set up the content listener: attempt 1
> > > var wnd =
> > > window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
>
> > > .getInterface(Components.interfaces.nsIWebNavigation)
>
> > > .QueryInterface(Components.interfaces.nsIDocShell)
>
> > > .QueryInterface(Components.interfaces.nsIInterfaceRequestor);
> > > wnd.parentURIContentListener = myListener;parentURIContentListener
lives on nsIURIContentListener, no?  This seems to be
> > missing a getInterface for that interface after you QI the docshell to
> > nsIInterfaceRequestor.  This should work with that change.
>
> > -Boris
>
> Tnanks a lot, Boris!
> It works with that change.

Following what was described above I added " .getInterface(
Components.interfaces.nsIURIContentListener)" to get a wrapped
nsIURIContentListener.

   var wnd = window.QueryInterface(
Components.interfaces.nsIInterfaceRequestor)
       .getInterface(Components.interfaces.nsIWebNavigation)
       .QueryInterface(Components.interfaces.nsIDocShell)
       .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
       .getInterface(Components.interfaces.nsIURIContentListener);
   wnd.parentURIContentListener = myListener;

However, I still cannot set the property parentURIContentListener on the
nsIURIContentListener. That seems to be disallowed, and I get same exception
as listed above:
Error: uncaught exception: [Exception... "Cannot modify properties of a
WrappedNative"  nsresult: "0x80570034
(NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN)"  location: "JS frame ::
chrome://test/content/TestEventHandler.js :: testSwitch :: line 109"  data:
no]

Don't we need to get the nsIURILoader interface to be able to
registerContentListener? If yes, how can I get that interface?

Thanks
-ashish
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to