behavior. Next step is to enable the java side in test-first design
fashion.
A webclient/src_moz/EmbedEventListener.cpp
A webclient/src_moz/EmbedEventListener.h
- carried over directly from GtkMozEmbed, minus GTK code.
M webclient/src_moz/EmbedProgress.cpp
- call to NativeBrowserControl::ContentStateChange() to hook up listeners.
M webclient/src_moz/Makefile.in
- add new EmbedEventListener.cpp file
M webclient/src_moz/NativeBrowserControl.cpp
M webclient/src_moz/NativeBrowserControl.h
- new methods for hooking up listeners.
but I wanted it for completeness with respect to response header
sniffing.
M webclient/src_moz/EmbedProgress.cpp
- visit request headers on startUrlLoad.
M webclient/test/automated/src/classes/org/mozilla/webclient/DocumentLoadListenerTest.java
M webclient/test/manual/src/classes/org/mozilla/webclient/test/TestBrowser.java
- exercise new code.
I have changed the usage contract of the DocumentLoadListener slightly.
Prior to this checkin, calling getEventData() on the DocumentLoadEvent
passed in to your eventDispatched() method returned the URI to which the
event applies.
Now the getEventData() returns a Map. You must look up the "URI" key to
find the URI to which the event applies. If your listener is an
instance of PageInfoListener, and your event mask is
END_URL_LOAD_EVENT_MASK, your Map will have an additional entry under
the key "headers". This entry is another Map representing the response
headers.
DocumentLoadListener:
* <p>The <code>eventDispatched()</code> method is passed a {@link
* DocumentLoadEvent} instance. The <code>type</code> property of the
* event will be one of the types defined as a <code>public static final
* int</code> in <code>DocumentLoadEvent</code>.</p>
*
* <p>The <code>eventData</code> property of the
* <code>DocumentLoadEvent</code> instance will be a
* <code>java.util.Map</code>. For all <code>EVENT_MASK</code> types in
* <code>DocumentLoadEvent</code> the map will contain an entry under
* the key "<code>URI</code>" without the quotes. This will be the
* fully qualified URI for the event.</p>
*
* <p>For the <code>PROGRESS_URL_LOAD_EVENT_MASK</code> there will be an
* entry in the map for the key "<code>message</code>". This will be
* the progress message from the browser.</p>
PageInfoListener:
* <p>This {@link DocumentLoadListener} subclass adds the ability to get
* detailed information on each event. </p>
*
* <p>The <code>eventDispatched()</code> method is passed the same thing
* as in the {@link DocumentLoadListener}.</p>
*
* <p>The <code>eventData</code> property of the
* <code>DocumentLoadEvent</code> instance will be a
* <code>java.util.Map</code>. For the
* <code>END_URL_LOAD_EVENT_MASK</code> type in
* <code>DocumentLoadEvent</code> the map will contain an entry under
* the key "<code>URI</code>" without the quotes. This will be the
* fully qualified URI for the event. The map will also contain an
* entry under the key "<code>headers</code>". This entry will be a
* <code>Map</code> of all the response headers.</p>
The next step will be to allow the same procedure to work to discover
the request headers.
Ed
A classes_spec/org/mozilla/webclient/PageInfoListener.java
- marker class for listenening for high fidelity page information.
A src_moz/EventRegistrationImpl.cpp
- add boolean property, capturePageInfo to turn on or off high fidelity
page information collection.
M build-tests.xml
- add new test, DocumentLoadListenerTest
M build.xml
- added new JNI class, EventRegistrationImpl
M classes_spec/org/mozilla/webclient/CurrentPage2.java
M classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java
- rollback previous API for headers discovery
M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java
- pass thru the capturePageInfo property
- add URIToStringMap, currently not working.
M classes_spec/org/mozilla/webclient/test/EMWindow.java
- call toString() on the eventData, don't cast it to a String.
M src_moz/EmbedProgress.cpp
M src_moz/EmbedProgress.h
- leverage the nsIHttpHeaderVisitor interface to discover the response
headers.
- add boolean property capturePageInfo
A src_moz/HttpHeaderVisitorImpl.cpp
A src_moz/HttpHeaderVisitorImpl.h
- copy the headers to a Properties object.
M src_moz/Makefile.in
- compile two new files:
+ EventRegistrationImpl.cpp \
+ HttpHeaderVisitorImpl.cpp \
M src_moz/NativeBrowserControl.cpp
M src_moz/NativeBrowserControl.h
- pass the NativeWrapperFactory to our Init() method
- add wrapperFactory getter.
M src_moz/WrapperFactoryImpl.cpp
- pass the nativeWrapperFactory to the NativeBrowserControl's Init method.
M src_share/jni_util.cpp
M src_share/jni_util.h
- new constants: URI, headers
R test/automated/src/classes/org/mozilla/webclient/CurrentPageTest.java
- not yet time for this one
A test/automated/src/classes/org/mozilla/webclient/DocumentLoadListenerTest.java
- exercise bare minimum functionality of PageInfoListener
M test/manual/src/classes/org/mozilla/webclient/test/TestBrowser.java
- print out headers.
Currently, I'm trying to discover what is the best way to expose this
API in documents that include frames.
I think I'll need more than those two new methods on CurrentPage2. I'll
probably have some way to get a list of all URLs that comprise the
frameset, including nested framesets. It's true that you could use the
DOM to derive this, but that's very complicated. I need something more
lightweight. In the meantime, I'll check in what I have.
M build-tests.xml
- add commented out CurrentPageTest
M build.xml
- add clean.test target
M classes_spec/org/mozilla/webclient/CurrentPage2.java
M classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java
- new methods and no-op impls, so test-first test fails.
+ public Map getRequestHeaders();
+
+ public Map getResponseHeaders();
M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java
- swallow exceptions thrown by listeners.
M src_moz/EmbedProgress.cpp
- test for existence of httpChannel, so we can visit the headers
M test/automated/src/classes/org/mozilla/util/THTTPD.java
- return a "Server: " header that I can test in the testcase.
M test/automated/src/classes/org/mozilla/webclient/DocumentLoadListenerImpl.java
- add doStartCheck() method.
M test/automated/src/classes/org/mozilla/webclient/NavigationTest.java
M test/automated/src/classes/org/mozilla/webclient/WebclientTestCase.java
- push THTTPD stuff to superclass.
A test/automated/src/classes/org/mozilla/webclient/NavigationTest.java
- new testcase, fails.
M dom/jni/org_mozilla_dom_NodeImpl.cpp
- code around the absence of LowerCaseEqualsLiteral in nsTAString.h.
I'm surprised the unit tests worked for me all aloung though.
M webclient/build.xml
- make run.test.browser depend on "main"
M webclient/src_moz/EmbedProgress.cpp
- deal with null URL passed to ::OnStateChange
M webclient/src_moz/HistoryImpl.cpp
- Don't cast to PRBool* when you don't need to.
M webclient/test/manual/src/classes/org/mozilla/webclient/test/TestBrowser.java
- don't swallow the exception from setAppData().
- 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.
I now have the new architecture for pumping events from mozilla back
into java. I've added a sequence diagram to
<http://www.mozilla.org/projects/blackwood/webclient/design/20040306-webclient-2_0.zargo>
and updated the private API class diagram.
The next step will be to have the EmbedProgress::On* methods call back
to EventRegistration.nativeEventOccured.
M src_moz/EmbedProgress.cpp
M src_moz/EmbedProgress.h
- make this class maintain a reference to the java EventRegistration
instance for this BrowserControl
M src_moz/NativeBrowserControl.cpp
M src_moz/NativeBrowserControl.h
- make this class maintain a reference to the java BrowserControl instance.
M src_moz/WindowControlImpl.cpp
- push the java BrowserControl to the NativeBrowserControl on Realize().
M src_moz/WrapperFactoryImpl.cpp
M src_moz/ns_globals.h
- expose gImplementedInterfaces in ns_globals.h
again. It provides the native class that implements
nsIWebProgressListener, which I've copied form gtk_moz_embed, so it's
gotta be good. The next step will be to hook this up to the java side.
A src_moz/EmbedProgress.h
A src_moz/EmbedProgress.cpp
- mostly copied from GTKMOZEMBED
M classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java
- remove javadoc reference to non-existing method
M src_moz/EmbedWindow.cpp
M src_moz/EmbedWindow.h
- expose AddWebBrowserListener method.
M src_moz/InputStreamShim.cpp
- make FileInputStream testcase run
M src_moz/Makefile.in
M src_moz/NativeBrowserControl.cpp
M src_moz/NativeBrowserControl.h
- add EmbedProgress
M test/automated/src/classes/org/mozilla/webclient/NavigationTest.java
- Make this test run