// looks like FireFox 1.5 fires this event every time when DOM changed.
// We need the first-time event only
if (m_window != 0 || m_windowPrivate != 0) {
return;
}
nsIWebBrowser webBrowser;
if (m_isBrowser33) {
// 3.3M5+
Field webBrowserField = m_webBrowser.getClass().getDeclaredField("webBrowser");
webBrowserField.setAccessible(true);
webBrowser = (nsIWebBrowser) webBrowserField.get(m_webBrowser);
} else {
// previous versions
webBrowser = (nsIWebBrowser) m_webBrowser;
}
long[] aContentDOMWindow = new long[1];
// use reflection for to be compiled under 32bit environment
// webBrowser.GetContentDOMWindow(aContentDOMWindow);
Method webBrowser_GetContentDOMWindow =
webBrowser.getClass().getMethod("GetContentDOMWindow", new Class[]{long[].class});
webBrowser_GetContentDOMWindow.invoke(webBrowser, new Object[]{aContentDOMWindow});
final long window = LowLevelMoz64.getScriptObjectProxy(aContentDOMWindow[0]);
if (window == 0) {
m_unsupportedBrowserVersion = true;
return;