On 21 Feb., 16:10, Boris Zbarsky <[EMAIL PROTECTED]> wrote:
> fi wrote:
>
> In nsIURIContentListener::DoContent, the channel's loadgroup's notifications
> callbacks should be the same as the window context passed to
> nsIContentHandler....  It's a little roundabout, but there it is.
>
> -Boris

Please bear with me! The nsIURIContentListener is not invoked.

I created a component, implementing the following interfaces:

nsISupports
nsISupportsWeakReference
nsIClassInfo
nsIURIContentListener

I don't know why I have to implement nsIClassInfo, but QueryInterface
throws an exception, if I do not. No example I found on the web
implements nsIClassInfo. Here I have my first question: how do I set
the flages?

getHelperForLanguage and getInterfaces are called later.

As a first attempt I had my listener registered in the command-line
handler of my XULRunner application, before the first call to
openWindow. Nothing happened. No method of nsIContentListener was
invoked.

Then I had my listener registered in an iframe of my first page (in
the onLoad event) using the following code, attributed to boris and
found here:

http://forums.mozillazine.org/viewtopic.php?t=501254&sid=a2f27a7ca70ecb78ef834d80ec86286e

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

This improved things, since now onStartURIOpen is called.  If I return
true, the load is aborted. However, if I return false, no other
function of my ContentListener is invoked, but a new window is opened
right on top of the first one, displaying the following content

XML Parsing Error: undefined entity
Location: chrome://mozapps/content/downloads/unknownContentType.xul
Line Number 28, Column 18:    <description>&intro.label;</description>
-----------------^

However, this is not part of the response.

I checked a lot of examples on the web, but they don't give me any
clue. What did I miss now?

And do I have to register my listener on any frame, as the code above
indicates? I thougt that is enough to register is once and that it
will be invoked as needed.

- Andreas

_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to