Webclient 2.0.a9: How to get DOM for all frames ?

[email protected] Sun, 26 Aug 2007 16:08:11 -0700
Newsgroups gmane.comp.mozilla.devel.java
Organization http://groups.google.com
Message-ID <1188169691.217461.20250__27041.6113351986$1188169828$gmane$org@g4g2000hsf.googlegroups.com>
Hi all,


I need to get DOM documents from every frame in a webpage.
The page is displaying fine in a JPanel using webclient 2.0.a9 and
XULRunner 1.8.1.3., both on OS X and on Windows 2000.

CurrentPageImpl.getDOM() only gives me the DOM for the main page, this
is a frameset. I cannot access the frames.

Does anyone know of a quick way to get to this data using webclient ?

I tried to write my own NativeObjectImpl subclass and native
implementation to recursively iterate the nsIDOMWindow's
nsIDOMWindowCollection's. I put it in a separate jar and jni library,
but I am getting stuck when I try to use it. Whenever I access the JNI
env passed into my implementation method to do anything, like env-
>FindClass( "java/lang/String" ), it will crash. When I try to use the
-Xcheck:jni argument to my java app startup, the app crashes way
before it gets to my code, at the point that it starts initializing a
NativeEventThread.

Being a complete C++ nono, I assumed this means that the jni.h used to
compile the webclient does not match the actual data structure passed
into the method by the VM. This assumption seems to hold halfway.
When picking up the G++ command line and adding the headers from the
actual Java framework to the include path BEFORE the mozilla includes
path, I can actually use the JNI env again in my own code. However,
now the application crashes when entering
Java_org_mozilla_dom_DOMAccessor_nativeGetNodeByHandle .

To test this assumption further, I should probably recompile the
webclient and javadom and direct it to the new java headers from the
actual JRE, right ?  But, I have no idea how to 'massage' the
Makefile.in, Makefile, etc. system to do that.

Can anyone tell me, if I am actually on the right track ? Is there any
chance of recompiling webclient from source ? And if so, how do I
prefix the includes path to include the JAVA_INCLUDE_PATH from
autoconf.mk ? And is it a good idea to replace Mozilla's jni.h with
the standard JRE one, at least for OS X ?


If necessary, I have all source code for this available.
Please help!