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.
Trying to get the exact nsIWebBrowser interface from the window using
QueryInterface did not succeed.
Firefox doesn't use nsIWebBrowser.
// Setting up the content listener: attempt 3
var uriLoader =
Components.classes["@mozilla.org/uriloader;1"].getService(Components.interfaces.nsIURILoader);
uriLoader.registerContentListener(myListener);
This sets up a listener that will only be invoked if the load has a type that
can't be handled by any content viewer. Its OnStartURIOpen will never be called.
Finally I tried to set the content listener like that:
// Setting up the content listener: attempt 4
var myIWebBrowser =
(Components.classes["@mozilla.org/embedding/browser/nsWebBrowser;1"]).getService(Components.interfaces.nsIWebBrowser);
Er... WHY? nsWebBrowser is NOT a service. Where did you see code that does
this? In any case, as I said above Firefox doesn't use nsWebBrowser.
-Boris
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding