ok, I have finally managed. Heres the code: //class decl class LocationListener: public nsIWebProgressListener, public nsSupportsWeakReference { public: LocationListener(); virtual ~LocationListenerW(); NS_DECL_ISUPPORTS NS_DECL_NSIWEBPROGRESSLISTENER };
//class impl NS_IMPL_ISUPPORTS2(LocationListener, nsIWebProgressListener, nsISupportsWeakReference) NS_IMETHODIMP LocationListener::OnXXChange(...) { return NS_OK; } //and class usage. plistener must be created non-locally LocationListener * listener = new LocationListener(); nsCOMPtr<nsISupports> plistener = static_cast<nsIWebProgressListener *>(listener); nsCOMPtr<nsIWeakReference> weakref = do_GetWeakReference(plistener, &retval); retval = browser->AddWebBrowserListener(weakref, NS_GET_IID(nsIWebProgressListener)); _______________________________________________ dev-embedding mailing list dev-embedding@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-embedding