gecko-dev/java/dom
edburns%acm.org 2da8b33fed This checkin gets webclient and sorta running with Firefox 1.5.0.1
Next step is to fix this:

D:\Projects\mozilla\MOZILLA_NIH\FIREFOX_1_5_0_1\mozilla\java\webclient\build-tests.xml:152: Test org.mozilla.webclient.DocumentLoadListenerTest failed

M build.properties.sample

- Add hint for msdev arguments.

M dom/build.xml
M util/build.xml
M webclient/build.xml

- compile.source to 1.3

M dom/jni/Makefile.in
M webclient/src_ie/Makefile.in
M webclient/src_moz/Makefile.in
M webclient/src_moz/gtk/Makefile.in
M webclient/src_share/Makefile.in

- +DEFINES += -DMOZILLA_INTERNAL_API

M dom/jni/nativeDOMProxyListener.cpp
M dom/src/nsJavaDOMImpl.cpp

- remove cast to (void **) in AttachCurrentThread

M dom/src/Makefile.in

- depend on layout

- +DEFINES += -DMOZILLA_INTERNAL_API

M webclient/build-tests.xml

- comment out ProfileManagerTest

- compile with compile.source

M webclient/src_moz/NativeBrowserControl.cpp

- nsIFocusController,nsIChromeEventHandler,nsIDomWindowInternal no
  longer needs nsCOMPtr

M webclient/src_moz/NativeEventThread.cpp

- remove IID defs for webShell, sHistory.

M webclient/src_moz/NavigationActionEvents.cpp

- remove nsIPresContext include

M webclient/src_moz/NavigationImpl.cpp

-#include "nsIServiceManagerUtils.h" // PENDING(edburns): when moving
-                                    // past 1.7, this changes to
-                                    // nsServiceManagerUtils.h
+#include "nsServiceManagerUtils.h"

M webclient/src_moz/ProfileManagerImpl.cpp

- This is currently totally broken.  Next step is to fix it.

M webclient/src_moz/WrapperFactoryImpl.cpp

- comment out profileManager accesses

M webclient/src_moz/ns_globals.h
M webclient/src_moz/ns_util.h

- take out nsIWebShell

M webclient/test/automated/src/classes/org/mozilla/webclient/BrowserControlFactoryTest.java

- comment out goldenFile assertion until ProfileManager works.
2006-03-05 03:53:26 +00:00
..
blackconnect/dom
classes/org/mozilla/dom This change-bundle solves the dom problem in a different way: by 2005-08-19 05:26:07 +00:00
jni This checkin gets webclient and sorta running with Firefox 1.5.0.1 2006-03-05 03:53:26 +00:00
src This checkin gets webclient and sorta running with Firefox 1.5.0.1 2006-03-05 03:53:26 +00:00
DOMAccessor.java.patch
README Bug 106386 Correct misspellings in source code 2005-11-25 08:16:51 +00:00
TODO Bug 106386 Correct misspellings in source code 2005-11-25 21:57:13 +00:00
build.xml This checkin gets webclient and sorta running with Firefox 1.5.0.1 2006-03-05 03:53:26 +00:00
nsWebShell.cpp.patch

README

Sources
=======

The sources are located in mozilla/java/dom.
Subdirectories 

    classes
    jni
    src
    tests

contain Java sources, Java native methods implementation, 
native c++ code and Java DOM API tests respectively.

Note: 
   Sources that work with mozilla PR1 and earlier
   versions should be checked out using DOM_PR1 tag.

   No tags are needed for the sources that work with
   the latest mozilla tree.

Building
========

   Requirenments:
   --------------
     Current mozilla build
     JDK1.2 or JDK1.3 
     Perl 5 must be in your path
     JDKHOME environment variable set to your JDK dir
     CLASSPATH environment cvariable set to contain 
	org.w3c.dom classes. The sources can be found at	
        http://www.w3.org/TR/2000/CR-DOM-Level-2-20000307/java-binding.html
	(for mozilla PR1 and earlie versions)
        http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/java-binding.html
	(for the latest mozilla)

     Solaris specific
     ----------------
	Add following directories to LD_LIBRARY_PATH environment variable:
          $MOZILLA_FIVE_HOME
          $JDKHOME/jre/lib/$HOSTTYPE/native_threads
          $JDKHOME/jre/lib/$HOSTTYPE/classic
          $JDKHOME/jre/lib/$HOSTTYPE/

	goto mozilla/java/dom directory and type "gmake"
        

     Windows NT specific
     -------------------
	To enable OJI usage set environment variable JAVA_DOM_OJI_ENABLE=1
	Add following directories to PATH environment variable:
	  %MOZILLA_FIVE_HOME%
	  %JDKHOME%\jre\bin\classic (only in case you don't use OJI)

	goto mozilla/java/dom directory and type "nmake /f makefile.win"
        

Using the Java DOM API
======================

A Java component obtains a org.w3c.dom.Document by registering for
Document load notifications. The Document is passed in along with the
notifications. The preferred way for a Java component to register for
Document load notifications is to register via the DOMAccessor class.

However, this is possible only if OJI usage is enabled. This works
on Windows NT platform.

On Solaris currently the nsJavaDOM component instantiates its own JVM.
When an OJI-compatible JVM is available, we will move over to using it.
So, one has to apply two patches to

  mozilla/webshell/src/nsWebShell.cpp
  mozilla/java/dom/classes/org/mozilla/dom/DOMAccessor.java

They can be found at mozilla/java/dom directory.
The first one inits nsJavaDOM component and adds it as a
document load observer listener.

The second one registers a document load listener via DOMAccessor. 
Note:
  any class that implements the DocumentLoadListener interface may
  stand for GenericDocLoadListener.

After applying a patch to nsWebShell.cpp edit 
mozilla/webshell/src/Makefile.in to add -DJAVA_DOM to the list of 
defines. Then do a gmake in this directory.

After applying a patch to DOMAccessor.java go to mozilla/java/dom/classes
and do a gmake. No changes in makefiles are needed.

You can find examples of Java DOM API usage in 

   mozilla/java/dom/classes/org/mozilla/dom/util
   mozilla/java/dom/tests/src/applets


DOM2 events
------------

At the moment all DOM2 event-related interfaces are present
however they are not fully implemented yet
because Mozilla's core DOM does not support DOM2 events fully. 
Consequences:
  - some methods throws OperationUnsupportedException()

The basic implementation architecture is following:
   - NodeImpl is extended to support EventTarget interface
   - for every addEventListener call special NativeDOMProxyListener object is 
       created and is registered with Mozilla's DOM 
     It's task is to propagate event notifications from Mozilla's DOM
       to target Java EventListener
   - In order to successfully unregister EventListeners we need to 
       save association between java EventListener and corresponding 
       NativeDOMProxyListener object. This is done by storing such
       associations Vector at NodeImpl
   - javaDOMEventsGlobals class is used much like javaDOMGlobals for caching
     (this code may be moved to javaDOMGlobals) 
     
NSPR Logging
------------

The NSPR Log module name is javadom. For instructions on how to enable
logging, see dist/include/prlog.h


Debug output
------------

The debug build of the Java DOM API creates the JVM with the verbose
and the verboseGC options turned on, to help in debugging. It also
creates two files in the current working directory, dom-java.txt and
dom-cpp.txt, which are simple dumps of the DOM, as printed from C++
and from Java. The two should be identical. The code to write these
files is, essentially, my regression test. Feel free to add to it.


Dependencies
------------

Currently tested on Solaris 7 only with Java 2 SDK 1.2.1. egcs-2.91.66, 
Sun Workshop C++ 4.2 and 5.0 have been know to compile this code
fine. gcc-2.8.1 does *not* work. I have not used anything
Java2-specific, and it works with JDK1.1.x too (I have been using JDK
1.1.6 too).


References
----------

I highly recommend reading Sheng Liang's new JNI book.