Hey Yonggang,

You might find nsIWebProgressListener useful:
https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIWebProgressListener

Specifically the onLocationChange method. This is fired once we've
determined that we're going to load a new URI for a DOM Window.

From the passed in nsIWebProgress[1], you should be able to get at the
nsIDOMWindow, and from there, I *think* you can get to the nsIDocShell
by QI'ing the nsIWebProgress to an nsIInterfaceRequestor and then
GetInterface'ing nsIDocShell. I haven't tried this, but I'm reasonably
certain it will work.

-Mike

[1]:
https://dxr.mozilla.org/mozilla-central/rev/9ed17db42e3e46f1c712e4dffd62d54e915e0fac/uriloader/base/nsIWebProgress.idl#134

On 13/09/2015 8:17 AM, 罗勇刚(Yonggang Luo)  wrote:
> So that I know what's the docshell is and the URL is.
> 
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to