file:/// and LoadFromStream cases. There were some problems:
1. RandomHTMLInputStream was never returning -1 from available, even
when there was no more data to be read.
2. the available ivars in InputStreamShim were PRUint32, and needed to
be PRInt32 to accomodate the -1.
3. InputStreamShim wasn't looking for the -1 from java, and it was
incorrectly returning NS_ERROR_NOT_AVAILABLE in that case, when it
should have been returning NS_OK if there was more data for Mozilla.
4. The testcase had a deadlock: it tried to remove the
DocumentLoadListener from the DocumentLoadListener callback. I had
to move this outside of the listener callback.
M src_moz/InputStreamShim.cpp
M src_moz/InputStreamShim.h
- make available be a signed int.
- correctly handle the case when java says, "no more data available".
M test/automated/src/classes/org/mozilla/webclient/NavigationTest.java
- avoid deadlock by moving the call to removeDocumentLoadListener()
outside of the listener itself.
M test/automated/src/classes/org/mozilla/webclient/RandomHTMLInputStream.java
- make sure to return -1 from available() when we have no more data.
This fixes the problem with prefrences window and other configuration windows not being sized
properly to fit the whole content. The "size" of the system fonts ( in mozilla coordinates ) was wrong.
- Major enhancement of this class. Framework for all
WebclientEventListener subclasses now in place. This includes a
separate Theard event queue to send events from mozilla to java so
that the listener can call back into webclient without fear of
deadlock. I had to use semaphores! Thank you Michael Faiman
<http://www.cs.uiuc.edu/people/faculty/faiman2.html> who taught my
operating systems class where I learned semaphores.
M classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java
- use notifyAll() instead of notify, for best practice.
M src_moz/EmbedProgress.cpp
- flesh out rest of DocumentLoadListener code.
M test/automated/src/classes/org/mozilla/webclient/NavigationTest.java
- comment out code because I can't seem to get the END_DOCUMENT_LOAD
event to come from mozilla on the LoadFromStream case. Top men are
working on it.
Next step is to uncomment the rest of NavigationTest.
the DocumentLoadListener events will be trivial.
Next step: flesh out the rest of the DocumentLoadListener events.
Modify NavigationTest so that it does its selection checking inside the
listeners. This will probably require creating a Thread, managed by
EventRegistrationImpl, that is used to process callbacks from mozilla
into Java, so that we don't get deadlock.
M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java
- remove all dependencies on NativeEventThread
- introduce dependency on BrowserControlCanvas (needed for future
MouseListener) work.
- {add,remove}DocumentLoadListener() now just a matter of
adding/removing to List.
- add nativeEventOccurred() method, called from native code
M classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java
- remove dependency on BrowserControlCanvas
- removed nativeEventOccurred
M src_moz/EmbedProgress.cpp
- delete the global ref in the dtor.
- create the global ref in SetEventRegistration().
- call back to Java on startDocumentLoad.
M src_moz/NativeBrowserControl.cpp
- initialize our string constants.
M src_share/jni_util.cpp
M src_share/jni_util.h
- alter the signature of util_SendEventToJava
-void util_SendEventToJava(JNIEnv *yourEnv, jobject nativeEventThread,
- jobject webclientEventListener,
+void util_SendEventToJava(JNIEnv *yourEnv, jobject eventRegistrationImpl,
jstring eventListenerClassName,
jlong eventType, jobject eventData)
M test/automated/src/classes/org/mozilla/webclient/NavigationTest.java
- show that the DocumentLoadListener gets called.