Hello,
I am developing an XPCOM and I encounter a problem:
My XPCOM implements the nsIWebProgressListener interface. Everytime when OnStateChange is fired, I take the DOMWindow and if it's the top DOMWindow, I save it somewhere:


OnStateChange(
nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
PRUint32 aStateFlags,
nsresult aStatus
)
{


        ....
        nsCOMPtr<nsIDOMWindow>    pDOMWindow = nsnull;
        nsCOMPtr<nsIDOMWindow>    pTopDOMWindow = nsnull; 

        aWebProgress->GetDOMWindow(getter_AddRefs(pDOMWindow));
        pDOMWindow->GetTop(getter_AddRefs(pParentDOMWindow));
        if (SameCOMIdentity(pParentDOMWindow, pDOMWindow)) {
                Save(pDOMWindow);
        }
        ....
}

It's clear that for every opened browser window we have only one such top-DOMWindow object.

Now, when the user closes a browser window, by catching the "domwindowclosed" topic within Observe(..), I can obtain an associated DOMWindow object:

Observe(
        nsISupports *aSubject,
        const char *aTopic,
        const PRUnichar *aData
        )
{
        if (aTopic && strcmp(aTopic, "domwindowclosed") == 0) {
                nsCOMPtr<nsIDOMWindow> pDOMWindow = nsnull;
                pDOMWindow      = do_QueryInterface(aSubject, &rv);
        }
}


The point is it turns out that this DOMWindow is NON of those saved before. Anyone has a clue why?

My aim is to determined which window was closed by the user. If any one has a clue, I would appriciate very much your help...
Thankyou in advance.
Vonuyx



_______________________________________________ Mozilla-xpcom mailing list [email protected] http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to