How do I get the hook to parse the DOM?
Here's some code abstract:
// Listen for page loading...
gBrowser.addProgressListener(something_urlBarListener,Components.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
...
// Detect when a page has completed loading
onStateChange: function(aProgress, aRequest, aFlag, aStatus)
{
if(aFlag & Components.interfaces.nsIWebProgressListener.STATE_STOP)
something.processNewURL(aRequest.URI);
},
...
// Then, in something.processNewURL() I do this:
// Check if the document is HTML
if(document.contentType == "text/html") {
// HOW DO I HOOK UP TO THE DOM???
// TRIED THE FOLLOWING WITHOUT SUCCESS:
//var fW = document.commandDispatcher.focusedWindow;
//var fW = window.document.commandDispatcher; // works!!!
//var winWrapper = new
XPCNativeWrapper(contentWindow,'document','getSelection()');
//var docWrapper = new XPCNativeWrapper(winWrapper.document, 'title');
//var fW = browser.contentWindow.document;
}
Thanks!
content.document?
Nickolay