get current content document inside Firefox cpp code

DONG Xinshu <[email protected]>
Newsgroups gmane.comp.mozilla.devel.dom
Message-ID <[email protected]>
Hi,

I've been struggled with this problem for a while. In Firefox 
extensions, we can easily get the current content document in the 
selected tab by:

content.document or gBrowser.contentDocument

However, if I want to get this info inside Firefox code base 
(nsHttpChannel::Init), what shall I do?

I tried with the following piece of code, but GetContentDOMWindow always 
failed. And I debugged into the function body of GetContentDOMWindow, 
the variable mDocShell was null. As in extensions we can get content 
document in any scope of code, so in Firefox native cpp code can I also 
get it in nsHttpChannel::Init or some other functions? My purpose is 
just to get the original URI of a page before it's changed. Thanks.

Regards,
Xinshu
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.