Commit Graph

30 Commits

Author SHA1 Message Date
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
edburns%acm.org
fdbc87a6d5 Next step is to resume hunting down the DOM bug.
M dom/src/Makefile.in

- conditional builds to work properly XP

M webclient/build-tests.xml

- pass MOZ_SRC to test environment to enable absolute pathing to golden
  files

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

- Leverage MOZ_SRC to get absolute pathing to golden files
2005-08-09 04:43:00 +00:00
edburns%acm.org
f14f0787f1 Checkpoint for mac os x reactivation.
Having trouble with the implementation of getHandleToPeer.

Current problem is that JAWT_DrawingSurface->Lock() is failing.

Why would that be?
2005-05-13 06:40:12 +00:00
edburns%acm.org
d83753e0e6 This checkin re-enables
CurrentPage.copyCurrentSelectionToSystemClipboard() and provides a unit
test for it.

Next step is getCurrentURL.

A test/automated/src/classes/org/mozilla/webclient/CurrentPageTest.java

- new test suite for CurrentPage.  Currently only has
  testCopyCurrentSelectionToSystemClipboard().

M build-tests.xml

- add CurrentPage TestSuite with one test.

M src_moz/CurrentPageImpl.cpp

- re-implement nativeCopyCurrentSelectionToSystemClipboard()
2005-02-07 04:59:50 +00:00
edburns%acm.org
759319ad37 This checkin re-enables currentPage.getDOM(). Please see
<http://lxr.mozilla.org/mozilla/source/java/webclient/test/automated/src/classes/org/mozilla/webclient/DOMTest.java>
for a trivial usage example.

Next step is to continue to flesh out CurrentPage methods.

Ed

A test/automated/src/classes/org/mozilla/webclient/DOMTest.java

- show basic DOM functionality

M build-tests.xml

- Add new DOM test

M src_moz/CurrentPageImpl.cpp

- re-expose DOM functionality

M test/automated/src/test/HistoryTest0.html

- Add an ID to the anchor so we can do getElementById() on it.
2005-02-04 15:43:47 +00:00
edburns%acm.org
68b4ab9c50 This checkin has the basic functionality of NewWindowListener
re-implemented using the new event model.  It's a bit cleaner.

Next step is to uncomment the selection check at the end of
WindowCreatorTest.java.  This code currently causes the VM to crash.  I
also plan to do some testing on the chrome flags.

M classes_spec/org/mozilla/webclient/EventRegistration2.java

- deprecate {add,remove}NewWindowListener(), replace with
  setNewWindowListener().

M classes_spec/org/mozilla/webclient/NewWindowEvent.java

- added BrowserControl property, which the user sets into the event.

M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java

- change newWindowListeners List ivar to newWindowListener ivar.

- fix {add,remove}NewWindowListener() to leverage setNewWindowListener()

- change nativeEventOccurred() to return an int instead of void.

- add boolean property nativeSetNewWindowListenerAttached()

M classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java

- modify pushBlockingWCRunnable() to execute the runnable right away if
  we're already on the NativeEventThread.  This is necessary to allow
  re-entrancy.

M src_moz/EmbedEventListener.cpp
M src_moz/EmbedEventListener.h

- expose the mEventRegistration ivar via a getter.

M src_moz/EventRegistrationImpl.cpp
M src_moz/NativeBrowserControl.cpp
M src_moz/NativeBrowserControl.h

- add nativeSetNewWindowListenerAttached(), which calls through and sets
  it on the NativeBrowserControl.

M src_moz/WindowCreator.cpp

- implement CreateChromeWindow2, which is called when the browser needs
  a new window.

M src_share/jni_util.cpp
M src_share/jni_util.h

- change util_SendEventToJava() to return int.

M test/automated/src/classes/org/mozilla/webclient/WindowCreatorTest.java
2005-01-18 15:20:52 +00:00
edburns%acm.org
df785dc1ba This checkin provides a sketch of how I plan to re-implement the
NewWindowListener mechanism.  Next step will be to continue to try to
get it working.

A test/automated/src/classes/org/mozilla/webclient/WindowCreatorTest.java
A test/automated/src/test/WindowCreatorTest0.html
A test/automated/src/test/WindowCreatorTest1.html

- new test, currently fails.

M build-tests.xml

- add new test, non-running

M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java

- prep for NewWindowListener

M src_moz/WindowCreator.cpp

- sketch implementation plan.  In WindowCreator.CreateChromeWindow2:

+        /*
+          Block this thread.
+
+          Call back into java and ask the user to create a top level
+          window and hand it, or an added child of it, to us.  Call this
+          thing the userWindow.
+
+          Create a new BrowserControl, get its BrowserControlCanvas and
+          make it be a child of the userWindow.
+
+          Set the userWindow and the BrowserControlCanvas to visible ==
+          true.  This is necessary to get the cause the underlying
+          mozilla window to be created.
+
+          java returns the C++ nativeBrowserControl to us.  Cast it to a
+          native NativeBrowserControl C++ object instance.  If the
+          nsIURI is non-null, cause the new window to navigate to that
+          URI.  Return the NativeBrowserControl's EmbedWindow instance,
+          which is an impl of nsIWebBrowserChrome.
+
+          I'm not sure if it's safe to do all this on the same thread on
+          which mozilla calls us.  I hope so.
+        */
2005-01-11 07:02:12 +00:00
edburns%acm.org
a53c25ab6a This checkin enables the KeyListener feature.
A webclient/test/automated/src/classes/org/mozilla/webclient/KeyListenerTest.java
A webclient/test/automated/src/test/KeyListenerTest1.html
M webclient/build-tests.xml

- add new testcase

M webclient/classes_spec/org/mozilla/webclient/BrowserControlCanvas.java
M webclient/classes_spec/org/mozilla/webclient/EventRegistration2.java

- allow KeyListeners to be added and removed.

M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java

- Lazily create listener lists.

- Change the contract of queueEvent() to discard null events silently.

- Add createKeyEvent() method.

M webclient/src_moz/EmbedEventListener.cpp

- new mask names and values, DOMDOMKeyListener_maskNames,
  DOMKeyListener_maskValues.

- flesh out Key*() events.

- add addKeyEventDataToProperties.

- use eventType to discern how to populate the properties, with either key or
  mouse data.

M webclient/src_moz/EmbedEventListener.h

- key event includes and support methods.

M webclient/src_moz/EmbedProgress.cpp

- honor new last argument to util_InitializeEventMaskValuesFromClass().

M webclient/src_share/jni_util.cpp
M webclient/src_share/jni_util.h

- new constants

+jobject CHAR_CODE;
+jobject KEY_CODE;
+jstring KEY_LISTENER_CLASSNAME;
+char *DOMKeyListener_maskNames[] = {

M webclient/src_share/jni_util_export.cpp
M webclient/src_share/jni_util_export.h

- new last argument to

 util_InitializeEventMaskValuesFromClass(const char *className,
                                         char *maskNames[],
-                                        jlong maskValues[])
+                                        jlong maskValuesLong[],
+                                        jint maskValuesInt[])

  Used when the maskValues are ints, otherwise null.
2004-12-01 03:21:23 +00:00
edburns%acm.org
e4fda6cb96 This checkin enables MouseListener functionality. You can add a
MouseListener to the EventRegistration or BrowserControlCanvas and be
notified of events on the browser canvas.  You can snoop for onMouseOver
information such as links.  Next step is to cvs remove unused classes
relating to mouse events, for example WCMouseListenerImpl and
WCEventListenerWrapper.

A webclient/test/automated/src/classes/org/mozilla/webclient/MouseListenerTest.java

- exercise mouseListener added to BrowserControlCanvas and to
  EventRegistration.

M webclient/build-tests.xml

- hook up new test

M webclient/classes_spec/org/mozilla/webclient/BrowserControlCanvas.java

- enable adding the MouseListener from here.

M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java

- absorb the functionality of WCMouseListenerImpl.  Also need to remove
  WCEventListenerWrapper.

- deal with MouseEvents.

- refactor BrowserToJavaEventPump.run() to handle mouse listeners

M webclient/src_moz/EmbedEventListener.cpp
M webclient/src_moz/EmbedEventListener.h

- absorb functionality from CBrowserContainer relating to mouse events.

M webclient/src_moz/NativeBrowserControl.cpp

- set the EventRegistration into the EmbedEventListener instance.

M webclient/test/manual/src/classes/org/mozilla/webclient/test/TestBrowser.java

- add mouseover url updating to status bar.
2004-10-27 01:33:57 +00:00
edburns%acm.org
8484d431af This checkin implements a response header listener feature.
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.
2004-09-09 20:17:18 +00:00
edburns%acm.org
87a9a4b53b This checkin is the start of work for the Http header access feature.
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.
2004-09-03 19:04:22 +00:00
edburns%acm.org
8539e82952 Ok after this checkin we now have all the functionality of Sun's JDIC
WebBrowser
<https://jdic.dev.java.net/nonav/documentation/javadoc/jdic/org/jdesktop/jdic/browser/WebBrowser.html>, with the following exceptions:

- we're based on mozilla 1.6

- it only works on windows

- we don't have mouse event support

- we only support mozilla, not IE

So, webclient still has a ways to go until we reach its former glory,
but reach it we will.

I'm going to assemble a 2.0 alpha 1 source code only release, including
build instructions, from what we have now.

I'd love it if someone could get the unit tests working on GNU/Linux
again.  I think the problem has to do with our old friend GDKSUPERWIN.

Next step is to assemble the 2.0 alpha 1 source code release!

Ed

M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/NavigationImpl.java
M webclient/src_moz/NavigationImpl.cpp

- re-enable POST

M webclient/src_moz/EmbedWindow.cpp
M webclient/src_moz/EmbedWindow.h

- expose DocShell post method.

M webclient/test/automated/src/classes/org/mozilla/util/THTTPD.java
M webclient/test/automated/src/classes/org/mozilla/webclient/NavigationTest.java

- test code for POST
2004-06-25 13:59:54 +00:00
edburns%acm.org
d4d419c667 Got "back()" working. Next will be to get forward(), and can{Back,Forward}.
A test/automated/src/classes/org/mozilla/webclient/DocumentLoadListenerImpl.java
A test/automated/src/classes/org/mozilla/webclient/HistoryTest.java
A test/automated/src/test/HistoryTest0.html
A test/automated/src/test/HistoryTest1.html
A test/automated/src/test/HistoryTest2.html
A test/automated/src/test/HistoryTest3.html

- new test content.

M classes_spec/org/mozilla/webclient/impl/wrapper_native/HistoryImpl.java
M src_moz/HistoryImpl.cpp

- expose back() method
M src_moz/Makefile.in

M test/automated/src/classes/org/mozilla/util/THTTPD.java

- added way for the server to return the content type of the document

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

- pulled out DocumentLoadListener into a separate class.
2004-06-23 19:21:07 +00:00
edburns%acm.org
8e77f639c1 Accidentally removed running testcases. 2004-06-18 14:17:28 +00:00
edburns%acm.org
7d04f13686 Implement a trivial HTTP server to test http file loads, and what do you
know, I find that selection doesn't work.  Hmm.  Well, let's hear it for
test first.

Naturally, the next step is to fix the new NavigationTest.testHttpLoad().

A test/automated/src/test/HttpNavigationTest.txt

- data file for testHttpLoad().

A test/automated/src/classes/org/mozilla/util/THTTPD.java

- trivial HTTP server that suits my needs.

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

- added commented out testHttpLoad().  It breaks.

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

- remove emacs mode line.
2004-06-18 13:53:14 +00:00
edburns%acm.org
680077cedd Remove ^M 2004-06-17 21:20:30 +00:00
edburns%acm.org
7573cd136f This checkin enables the StartDocumentLoadEvent. Now adding the rest of
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.
2004-06-12 05:46:48 +00:00
edburns%acm.org
b1f9171e41 This checkin is the next step for getting DocumentLoadListener to work.
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
2004-06-11 15:55:48 +00:00
edburns%acm.org
7c1f545442 This Change-bundle verifies that loadURL works as expected. Next will
be to verify that loadFromStream works as expected.

M build-tests.xml

- win32 gtk stuff.  I can't figure out why this file in particular gets
  messed up when I move from Unix to Windows and back.  Can anyone tell me
  why?

M classes_spec/org/mozilla/webclient/Navigation2.java
M classes_spec/org/mozilla/webclient/impl/wrapper_native/NavigationImpl.java

- added method loadURLBlocking().

M classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java
M src_moz/CurrentPageImpl.cpp

- activated selectAll() and getSelection()

M src_moz/EmbedWindow.cpp
M src_moz/EmbedWindow.h

- imbued this class with selection related methods selectAll and
  getSelection()

M src_moz/Makefile.in

- activated CurrentPageImpl.cpp

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

- new test content.
2004-04-28 14:39:54 +00:00
edburns%acm.org
3e625c2ad7 remove_^M 2004-04-23 13:10:44 +00:00
edburns%acm.org
f0b93c432c Woohoo! I have loadURL working. The next step will be to get enough of
CurrentPage working so that I can "selectAll" the page, and verify
that the contents are loaded correctly.

Ed

M build-tests.xml

- enable all tests

M build.xml

- added compile.test passthru target

M classes_spec/org/mozilla/webclient/impl/wrapper_native/WindowControlImpl.java

- unpack the Rectangle into final ints

M src_moz/WindowControlImpl.cpp

- this was causing the deadlock: the package name was wrong.  The
  UnsatisfiedLinkError was not caught, and vanished into nowhere.

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

- we must independently make the canvas visible.  Hmm.  Shouldn't it
  automatically receive setVisible() when its parent is made visible?

- do cleanup
2004-04-22 06:41:02 +00:00
edburns%acm.org
273dee2dd2 M build-tests.xml
- make NavigationTest not run

M build.xml

- Move Win32BrowserControlCanvas up to parent package

M classes_spec/org/mozilla/webclient/BrowserControlCanvas.java

- You can't resize until you're initialized

- pass visibility through to native layer

M classes_spec/org/mozilla/webclient/impl/BrowserControlImpl.java

- Use WrapperFactory to create the BrowserControlCanvas impl.

A classes_spec/org/mozilla/webclient/impl/wrapper_native/Win32BrowserControlCanvas.java

- moved up from child package

M classes_spec/org/mozilla/webclient/impl/wrapper_native/WindowControlImpl.java

- use the new thread model for nativeSetBounds(), nativeRealize(),
  nativeSetVisible().

M classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java

- make this create the BrowserControlCanvas instance.

- honor the new package name for Win32BrowserControlCanvas.

R classes_spec/org/mozilla/webclient/impl/wrapper_native/win32/Win32BrowserControlCanvas.java

- moved up one level.

M src_moz/EmbedWindow.cpp
M src_moz/EmbedWindow.h

- Take size parameters to CreateWindow_

M src_moz/Makefile.in

- add WindowControlImpl.cpp

M src_moz/NativeBrowserControl.cpp
M src_moz/NativeBrowserControl.h

- add size parameters to Realize().

M src_moz/WindowControlImpl.cpp

- reactivate nativeRealize(), nativeSetVisible(), nativesetBounds(),

M src_moz/win32/Win32BrowserControlCanvas.cpp

- new package name

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

- we have to create a Canvas to load a URL.  Mozilla limitation.

M test/automated/src/classes/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImplTest.java

- remove unneeded test metdod
2004-04-20 16:17:43 +00:00
edburns%acm.org
eda24f9718 M webclient/build-tests.xml
- re-activate some tests

M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/PreferencesImpl.java

- Make null an acceptable argument for prefValue.  Make it mean, remove
  the pref.

M webclient/src_moz/PreferencesImpl.cpp

- make a null prefValue argument to nativeSetUnicharPref mean, ClearPref().
2004-04-11 01:09:03 +00:00
edburns%acm.org
0995c89706 - rename initContext to NativeBrowserControl, at both the native and
java layers.

- Rework NativeEventThread to be usable without having the
  browserControl window realized.

- change who owns the NativEventThread to be the BrowserControl, by
  proxy through WrapperFactoryImpl.  Again, this is with a view toward
  using webclient without the browserControl window realized.

A webclient/src_moz/NativeBrowserControl.h
A webclient/src_moz/NativeBrowserControl.cpp

- Centerpiece of native Object hierarchy.  Owned by NativeEventThread.

M webclient/build-tests.xml

- reformat

- add new test, currently failing, for Navigation.

M webclient/classes_spec/org/mozilla/webclient/impl/BrowserControlImpl.java

- destroy our nativeBrowserControl.

M webclient/classes_spec/org/mozilla/webclient/impl/WrapperFactory.java

- Added API for obtaining the NativeEventThread for a BrowserControl.

M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/BookmarksImpl.java
M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java
M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java
M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/HistoryImpl.java
M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/NavigationImpl.java

- rename nativeWebShell to nativeBrowserControl

M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ImplObjectNative.java

- rename nativeWebShell to nativeBrowserControl

- add method to get the NativeEventThread for this instance.

M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java

- remove dependency on WindowControl

- make this class be the owner of the nativeBrowserControl instance.

- rename nativeWebShell to nativeBrowserControl

- renamed nativeInitialize to nativeStartup

- added nativeShutdown

M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WindowControlImpl.java

- remove delete() method.

- no longer owns NativeEventThread

- no longer owns nativeBrowserControl

M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java

- Take over NativeEventThread ownership responsibilities from
  WindowControlImpl (by proxy for BrowserControl).

M webclient/src_moz/CBrowserContainer.cpp
M webclient/src_moz/CBrowserContainer.h
M webclient/src_moz/CurrentPageActionEvents.cpp
M webclient/src_moz/CurrentPageActionEvents.h
M webclient/src_moz/CurrentPageImpl.cpp
M webclient/src_moz/HistoryActionEvents.cpp
M webclient/src_moz/HistoryActionEvents.h
M webclient/src_moz/HistoryImpl.cpp
M webclient/src_moz/NativeEventThreadActionEvents.cpp
M webclient/src_moz/NativeEventThreadActionEvents.h
M webclient/src_moz/NavigationActionEvents.cpp
M webclient/src_moz/NavigationActionEvents.h
M webclient/src_moz/NavigationImpl.cpp
M webclient/src_moz/PromptActionEvents.cpp
M webclient/src_moz/PromptActionEvents.h
M webclient/src_moz/WindowControlActionEvents.cpp
M webclient/src_moz/WindowControlActionEvents.h
M webclient/src_moz/WindowCreator.cpp
M webclient/src_moz/WindowCreator.h

- rename nativeWebShell to nativeBrowserControl

M webclient/src_moz/Makefile.in

- comment out not yet fixed per-window sources

- add NativeBrowserControl.cpp

M webclient/src_moz/NativeEventThread.cpp

- major refactoring.  Much of the work is now being done in
  NativeBrowserControl.cpp

M webclient/src_moz/WindowControlImpl.cpp

- remove functionality now located in NativeEventThread and
  NativeBrowserControl.

M webclient/src_moz/WrapperFactoryImpl.cpp

- flesh out native{Create,Destroy}BrowserControl.

M webclient/src_moz/ns_globals.h

- remove gActionQueue and gEmbeddedThread.  Moved into class
  NativeBrowserControl.

M webclient/src_moz/ns_util.cpp

- rename initContext to NativeBrowserControl

- get action queue from NativeBrowserControl

M webclient/src_moz/ns_util.h

- remove WebShellInitContext!  It's finally a class now, called
  NativeBrowserControl.

M webclient/test/automated/src/classes/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImplTest.java

- added new testcase to show create/deleteBrowserControl works.
2004-04-10 21:50:39 +00:00
edburns%acm.org
1e41ffb99f This checkin refactors who owns the nativeWebShell pointer. It used to
be WindowControl, and now it's BrowserControl.  I'm hoping this allows
  us to operate Webclient in a "headless" fashion.  For example, you can
  imagine a web-crawler app that leverages DOM.

A test/automated/src/test/NavigationTest.txt

- fodder for testcase

M build-tests.xml

- reformat

- add NavigationTest (fails)

M classes_spec/org/mozilla/webclient/ImplObject.java

- Refactoring: remove public ivars.  Make them private, provide
  accessor.

M classes_spec/org/mozilla/webclient/impl/wrapper_native/ImplObjectNative.java

- Refactoring: remove public ivars.  Make them private, provide
  accessor.

- Remove dependence on WindowControl

- leverage new method on WrapperFactory: getNativeBrowserControl().

M classes_spec/org/mozilla/webclient/impl/BrowserControlImpl.java

- Make BrowserControlImpl the owner of the nativeWebShell pointer.  I'd
  like to see if it's possible for webclient to operate "headless" for
  certain applications, therefore, you may not have a WindowControl
  instance, which used to own the nativeWebShell pointer.

M classes_spec/org/mozilla/webclient/impl/WrapperFactory.java

- reformatting

- Software Practice: avoid downcasting to implementation class.  Since BrowserControlImpl is the owner of the nativeWebShell, but there
  is no mention of that in the public API, we modify the WrapperFactory
  contract to maintain a data structure of BrowserControl to
  nativeWebShell mappings.

- add native{Create,Destroy}BrowserControl(), which is called from
  ImplObjectNative.

M classes_spec/org/mozilla/webclient/impl/wrapper_native/BookmarksImpl.java
M classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java
M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java
M classes_spec/org/mozilla/webclient/impl/wrapper_native/HistoryImpl.java
M classes_spec/org/mozilla/webclient/impl/wrapper_native/NavigationImpl.java

- refactoring for removing public ivars.

M classes_spec/org/mozilla/webclient/impl/wrapper_native/WindowControlImpl.java

- refactoring for removing public ivars.

- comment out nativeCreateInitContext temporarily

M classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java

- implement new methods:

- add native{Create,Destroy}BrowserControl(), which is called from
  ImplObjectNative.

M classes_spec/org/mozilla/webclient/wrapper_nonnative/WrapperFactoryImpl.java

- remove vertigo test

M src_moz/ProfileManagerImpl.cpp

- shutdown the current profile

M src_moz/WrapperFactoryImpl.cpp

- Spinup and Spindown the Appshell

A test/automated/src/classes/org/mozilla/webclient/NavigationTest.java

- new test

M test/automated/src/test/BrowserControlFactoryTest_correct

- new test content
2004-03-05 15:34:25 +00:00
edburns%acm.org
9cfd63e744 This checkin makes all the existing webclient unit tests run
successfully.  We are now ready to continue with webclient 2.0
development.

M build-tests.xml

- formatting

M build.xml

- added target that skips the "main" dependency.

M src_moz/ProfileManagerImpl.cpp

- correct error messages

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

- reset the system to the original profile before deleting the new one.
2004-02-26 04:21:24 +00:00
edburns%acm.org
1dd9f8444d Make webclient compile with Mozilla 1.6. Unit tests still don't run.
M README

- update instructions for building and running source and unit tests

M build.properties.sample

- you need junit.jar

M webclient/build-tests.xml

- reformat

M webclient/build.xml

- add "prepare" target to set the PATH_SEP

M webclient/src_ie/BookmarksImpl.cpp
M webclient/src_ie/CurrentPageImpl.cpp
M webclient/src_ie/HistoryImpl.cpp

- Account for new javah header names

M webclient/src_moz/Makefile.in

- account for new location of jawt.lib in J2SDK 1.4.2

M webclient/src_moz/NativeEventThread.cpp

+#include "nsEmbedAPI.h" // for NS_HandleEmbeddingEvent

M webclient/src_moz/NavigationActionEvents.cpp

- result is an nsIInputStream

M webclient/src_moz/WrapperFactoryImpl.cpp

+#include <nsDependentString.h> // for nsDependentCString

 and the compile is more strict now.

M webclient/src_moz/dom_util.cpp

- signature change
2004-02-23 06:26:54 +00:00
edburns%acm.org
d65fae9315 This is a checkpoint milestone for webclient 2.0. Webclient currently
doesn't run, but several unit tests for webclient do.

I'll be proceeding through the rest of the webclient interfaces,
building junit tests as I go, in the coming months.  I hope to flesh out
the basic framework, then publish build instructions, and hopefully I
can get some contributions from the community.

M util/classes/org/mozilla/util/Utilities.java

new method: getImplFromServices:

+     *
+     * <p>This method tries to load the resource
+     * <code>META-INF/services/&gt;interfaceClassName&gt;</code>, where
+     * <code>&gt;interfaceClassName&lt;</code> is the argument to this
+     * method.  If the resource is found, interpret it as a
+     * <code>Properties</code> file and read out its first line.
+     * Interpret the first line as the fully qualified class name of a
+     * class that implements <code></code>.  The named class must have a
+     * public no-arg constructor.</p>

M webclient/build-tests.xml

- junit testcases for Webclient APIs, developed using test-first.

M webclient/build.xml

- changes for new package name structure:

  packages org.mozilla.webclient.{wrapper_native, wrapper_non_native} have gone away.  Replaced with org.mozilla.webclient.impl.{wrapper_native, wrapper_non_native}

- changes to accomodate "Services" based approach for pluggable
  webclient implementation.

- don't bother re-naming the javah generated files, just let javah pick
  the names.

- pass debugging args from build.properties

- changed name of junit test target to "test".

M webclient/classes_spec/org/mozilla/webclient/BrowserControl.java

- got rid of BROWSER_TYPE.  No longer necessary due to the new
  pluggability mechanism.

M webclient/classes_spec/org/mozilla/webclient/BrowserControlFactory.java

- Leverage the org.mozilla.util.Utilities.getImplFromServices()
  mechanism to allow a vendor-pluggable webclient implementation of the
  new "WebclientFactory" interface, which is method for method
  compatible with BrowserControlFactory.  Make all BrowserControlFactory
  methods call through to methods on the vendor provided
  WebclientFactory implementation.

R webclient/classes_spec/org/mozilla/webclient/BrowserControlFactoryInterface.java
A webclient/classes_spec/org/mozilla/webclient/BrowserControlICE.java
R webclient/classes_spec/org/mozilla/webclient/BrowserControlImpl.java
R webclient/classes_spec/org/mozilla/webclient/BrowserType.java

- move all implementation specific classe to the impl package.

M webclient/classes_spec/org/mozilla/webclient/ImplObject.java

- ImplObject shouldn't depend on vendor private classes.

M webclient/classes_spec/org/mozilla/webclient/Preferences.java

- new method

+  public void unregisterPrefChangedCallback(PrefChangedCallback cb,
+                                            String prefName, Object closure);

M webclient/classes_spec/org/mozilla/webclient/ProfileManager.java

- properly specify this interface.

A webclient/classes_spec/org/mozilla/webclient/WebclientFactory.java

 * <p>This interface allows a pluggable webclient API implementation.
 * The static methods in {@link BrowserControlFactory} call through to
 * methods on this interface.  Please see {@link BrowserControlFactory}
 * for information on how to hook up your <code>WebclientFactory</code>
 * implementation to the <code>BrowserControlFactory</code></p>

R webclient/classes_spec/org/mozilla/webclient/WrapperFactory.java
R webclient/classes_spec/org/mozilla/webclient/impl/BrowserControlFactoryImpl.java

- moved these to the impl class

A webclient/classes_spec/org/mozilla/webclient/impl/BrowserControlImpl.java
A webclient/classes_spec/org/mozilla/webclient/impl/Service.java
A webclient/classes_spec/org/mozilla/webclient/impl/WebclientFactoryImpl.java
A webclient/classes_spec/org/mozilla/webclient/impl/WrapperFactory.java
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/BookmarkEntryImpl.java
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/BookmarksImpl.java
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/HistoryImpl.java
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ISupportsPeer.java
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ImplObjectNative.java
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/NavigationImpl.java
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/PreferencesImpl.java
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ProfileManagerImpl.java
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/RDFEnumeration.java
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/RDFTreeNode.java
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/SelectionImpl.java
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WCEventListenerWrapper.java
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WCMouseListenerImpl.java
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WindowControlImpl.java
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/gtk/GtkBrowserControlCanvas.java
A webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/win32/Win32BrowserControlCanvas.java

- copied from old package naming scheme.

- lots and lots of cleanup.

R webclient/classes_spec/org/mozilla/webclient/wrapper_native/BookmarkEntryImpl.java
R webclient/classes_spec/org/mozilla/webclient/wrapper_native/BookmarksImpl.java
R webclient/classes_spec/org/mozilla/webclient/wrapper_native/CurrentPageImpl.java
R webclient/classes_spec/org/mozilla/webclient/wrapper_native/EventRegistrationImpl.java
R webclient/classes_spec/org/mozilla/webclient/wrapper_native/HistoryImpl.java
R webclient/classes_spec/org/mozilla/webclient/wrapper_native/ISupportsPeer.java
R webclient/classes_spec/org/mozilla/webclient/wrapper_native/ImplObjectNative.java
R webclient/classes_spec/org/mozilla/webclient/wrapper_native/NativeEventThread.java
R webclient/classes_spec/org/mozilla/webclient/wrapper_native/NavigationImpl.java
R webclient/classes_spec/org/mozilla/webclient/wrapper_native/PreferencesImpl.java
R webclient/classes_spec/org/mozilla/webclient/wrapper_native/ProfileManagerImpl.java
R webclient/classes_spec/org/mozilla/webclient/wrapper_native/RDFEnumeration.java
R webclient/classes_spec/org/mozilla/webclient/wrapper_native/RDFTreeNode.java
A webclient/classes_spec/org/mozilla/webclient/wrapper_native/README
R webclient/classes_spec/org/mozilla/webclient/wrapper_native/SelectionImpl.java
R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WCEventListenerWrapper.java
R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WCMouseListenerImpl.java
R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WindowControlImpl.java
R webclient/classes_spec/org/mozilla/webclient/wrapper_native/WrapperFactoryImpl.java
R webclient/classes_spec/org/mozilla/webclient/wrapper_native/gtk/GtkBrowserControlCanvas.java
R webclient/classes_spec/org/mozilla/webclient/wrapper_native/win32/Win32BrowserControlCanvas.java

- removed from old package naming scheme

M webclient/src_moz/BookmarksImpl.cpp

- remove dependency on RDFActionEvents by inlining all the code that
  formerly was in the events.

- package name change

- JNI include file name change

M webclient/src_moz/CurrentPageImpl.cpp
M webclient/src_moz/HistoryImpl.cpp
M webclient/src_moz/ISupportsPeer.cpp

- package name change

- JNI include file name change

M webclient/src_moz/Makefile.in

- get rid of PreferencesActionEvents.cpp and RDFActionEvents.cpp

- add ProfileManagerImpl.cpp

M webclient/src_moz/NativeEventThread.cpp

- this file is not done yet.  I've been pulling misplaced initialization
  stuff out of here and putting it into WrapperFactoryImpl.cpp.

- got rid of gComponentManager, since we can use do_CreateInstance
  instead.

- package name change

- JNI include file name change

M webclient/src_moz/NativeEventThreadActionEvents.h

- JNI include file name change

M webclient/src_moz/NavigationImpl.cpp

- package name change

- JNI include file name change

R webclient/src_moz/PreferencesActionEvents.cpp
R webclient/src_moz/PreferencesActionEvents.h

- don't need these anymore!  woohoo!

M webclient/src_moz/PreferencesImpl.cpp

- remove dependency on PreferencesActionEvents by inlining code into the
  methods that used to use the events.

A webclient/src_moz/ProfileManagerImpl.cpp

- new class, implementation of the ProfileManager interface.

M webclient/src_moz/PromptActionEvents.cpp

- change erroneous comment so my grep performed correctly.

R webclient/src_moz/RDFActionEvents.cpp
R webclient/src_moz/RDFActionEvents.h

- don't need these anymore!  woohoo!

M webclient/src_moz/RDFEnumeration.cpp
M webclient/src_moz/RDFTreeNode.cpp

- remove dependency on RDFActionEvents by inlining code into the
  methods that used to use the events.

M webclient/src_moz/WindowControlActionEvents.cpp

- deallocate shareInitiContext.

M webclient/src_moz/WindowControlImpl.cpp

- package name change

- JNI include file name change

- remove the "sleep so I can attach gdb" code.  Moved to
  WrapperFactoryImpl.cpp.

M webclient/src_moz/WrapperFactoryImpl.cpp

- lots of changes.  This is now where the app initialization and
  shutdown happens,

M webclient/src_moz/dom_util.cpp

- comment change

M webclient/src_moz/ns_globals.h

- get rid of inappropriate global usage.

M webclient/src_moz/ns_util.h

- new struct WebclientContext for singletons.

M webclient/src_moz/rdf_util.cpp

- new methods, rdf_startup and rdf_shutdown.

- replace calls to nsComponentManager::CreateInstance() with
  do_CreateInstance().

M webclient/src_moz/rdf_util.h

- new methods, rdf_startup and rdf_shutdown.

M webclient/src_moz/gtk/GtkBrowserControlCanvas.cpp

- package name change

- JNI include file name change

M webclient/src_moz/gtk/GtkBrowserControlCanvasStub.cpp

- package name change

- JNI include file name change

- this file isn't needed anymore, thankfully!  I'll remove it soon.

M webclient/src_moz/gtk/StubFunctions.h

- package name change

- JNI include file name change

- this file isn't needed anymore, thankfully!  I'll remove it soon.

M webclient/src_moz/motif/BrowserControlNativeShimStub.cpp
M webclient/src_moz/motif/MotifBrowserControlCanvas.cpp
M webclient/src_moz/motif/MotifBrowserControlCanvasStub.cpp
M webclient/src_moz/motif/NativeLoaderStub.cpp
M webclient/src_moz/win32/Win32BrowserControlCanvas.cpp

- package name change

- JNI include file name change

M webclient/src_share/jni_util.cpp
M webclient/src_share/jni_util.h

- util_InitializeShareInitContext() takes a JNIEnv *.

- new methods

+void util_DeleteGlobalRef(JNIEnv *env, jobject toDeleteRef);
+void util_DeleteLocalRef(JNIEnv *env, jobject toDeleteRef);
+void util_getSystemProperty(JNIEnv *env,
+                            const char *propName,
+                            char *propValue,
+                            jint propValueLen);


M webclient/src_share/jni_util_export.cpp
M webclient/src_share/jni_util_export.h

+JNIEXPORT jobjectArray util_GetJstringArrayFromJcharArray(JNIEnv *env,
+                                                          jint len,
+                                                          jchar **strings,
+                                                          jint *stringLengths)

A webclient/test/automated/src/classes/org/mozilla/webclient/BookmarksTest.java
R webclient/test/automated/src/classes/org/mozilla/webclient/BrowserControlFactoryTest.java
A webclient/test/automated/src/classes/org/mozilla/webclient/PreferencesTest.java
A webclient/test/automated/src/classes/org/mozilla/webclient/ProfileManagerTest.java
A webclient/test/automated/src/classes/org/mozilla/webclient/impl/WebclientFactoryImplTest.java
A webclient/test/automated/src/classes/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImplTest.java
A webclient/test/automated/src/classes/org/mozilla/webclient/impl/wrapper_native/gtk/TestGtkBrowserControlCanvas.java
R webclient/test/automated/src/classes/org/mozilla/webclient/wrapper_native/gtk/TestGtkBrowserControlCanvas.java
A webclient/test/automated/src/test/BrowserControlFactoryTest_correct

- junit tests!  TEST FIRST!
2003-09-28 06:29:22 +00:00
edburns%acm.org
113476328b SECTION: Changes
M build-tests.xml

- changes to make unit tests run again.

M build.xml

- updated version

- create the services definition for the webclient implementation

M classes_spec/org/mozilla/webclient/BrowserControlCanvas.java
M classes_spec/org/mozilla/webclient/BrowserControlImpl.java

- temporary hacks until we have everything migrated to the new package
  structure.

M classes_spec/org/mozilla/webclient/BrowserControlFactory.java

- Make this class be a shim to the implementation specific instance.

A classes_spec/org/mozilla/webclient/BrowserControlFactoryInterface.java

- Interface to be implemented by the webclient implementor

A classes_spec/org/mozilla/webclient/impl/BrowserControlFactoryImpl.java

- concrete implementation of BrowserControlFactoryInterface

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

- test that the factory can be instantiated.

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

- Make sure we have our bin dir set.


Index: build-tests.xml
===================================================================
RCS file: /cvsroot/mozilla/java/webclient/build-tests.xml,v
retrieving revision 1.1
diff -u -r1.1 build-tests.xml
--- build-tests.xml	1 Oct 2002 00:39:18 -0000	1.1
+++ build-tests.xml	6 Sep 2003 06:22:05 -0000
@@ -3,7 +3,7 @@
  SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 -->
 
-<project name="Webclient Unit Tests" default="test.local" basedir=".">
+<project name="Webclient Unit Tests" default="run.test" basedir=".">
 
 <!--
         This is a generic build.xml file for Ant that is used to run the
@@ -75,7 +75,7 @@
 
     <path id="test.classpath">
       <pathelement location="${junit.jar}"/>
-      <pathelement location="${build.home}/classes"/>
+      <pathelement location="${build.home}"/>
       <pathelement location="${out.test.dir}/classes"/>
     </path>
 
@@ -87,6 +87,8 @@
 -->
     <target name="compile.test">
 
+        <echo message="${build.home}"/>
+
         <mkdir  dir="${out.test.dir}/classes"/>
 
         <javac srcdir="${src.test.dir}"
@@ -125,6 +127,7 @@
             <jvmarg value="-Djava.library.path=${myenv.MOZILLA_FIVE_HOME}:${myenv.MOZILLA_FIVE_HOME}/components"/>
             <jvmarg value="-DNSPR_LOG_MODULES=${myenv.NSPR_LOG_MODULES}"/>
             <jvmarg value="-DNSPR_LOG_FILE=${myenv.NSPR_LOG_FILE}"/>
+            <jvmarg value="-DBROWSER_BIN_DIR=${myenv.MOZILLA_FIVE_HOME}"/>
             <jvmarg line="${debug.jvm.args}"/>
 
 
@@ -132,7 +135,11 @@
 
             <formatter type="plain" usefile="false"/>
 
+            <test name="org.mozilla.webclient.BrowserControlFactoryTest"/>
+<!-- non-running tests 
+
             <test name="org.mozilla.webclient.wrapper_native.gtk.TestGtkBrowserControlCanvas"/>
+-->
 
         </junit>
 
Index: build.xml
===================================================================
RCS file: /cvsroot/mozilla/java/webclient/build.xml,v
retrieving revision 1.15
diff -u -r1.15 build.xml
--- build.xml	9 Jun 2003 20:05:33 -0000	1.15
+++ build.xml	6 Sep 2003 06:22:06 -0000
@@ -30,7 +30,7 @@

   <property name="Name" value="webclient"/>
   <property name="name" value="webclient"/>
-  <property name="version" value="20020916"/>
+  <property name="version" value="20030906"/>

 <!-- ************ Per user local properties ******************************* -->

@@ -85,8 +85,12 @@

       <include name="org/mozilla/webclient/*"/>
       <include name="org/mozilla/webclient/wrapper_native/*"/>
+      <include name="org/mozilla/webclient/impl/**"/>
       <include name="org/mozilla/webclient/test/*"/>
     </javac>
+
+    <mkdir dir="${build.home}/META-INF/services"/>
+    <echo file="${build.home}/META-INF/services/org.mozilla.webclient.BrowserControlFactoryInterface">org.mozilla.webclient.impl.BrowserControlFactoryImpl</echo>

   </target>

Index: classes_spec/org/mozilla/webclient/BrowserControlCanvas.java
===================================================================
RCS file: /cvsroot/mozilla/java/webclient/classes_spec/org/mozilla/webclient/BrowserControlCanvas.java,v
retrieving revision 1.5
diff -u -r1.5 BrowserControlCanvas.java
--- classes_spec/org/mozilla/webclient/BrowserControlCanvas.java	9 Apr 2003 17:42:30 -0000	1.5
+++ classes_spec/org/mozilla/webclient/BrowserControlCanvas.java	6 Sep 2003 06:22:06 -0000
@@ -114,7 +114,8 @@

 } // BrowserControlCanvas() ctor

-protected void initialize(BrowserControl controlImpl)
+// PENDING(edburns): make this protected again
+public void initialize(BrowserControl controlImpl)
 {
     ParameterCheck.nonNull(controlImpl);
     webShell = controlImpl;
Index: classes_spec/org/mozilla/webclient/BrowserControlFactory.java
===================================================================
RCS file: /cvsroot/mozilla/java/webclient/classes_spec/org/mozilla/webclient/BrowserControlFactory.java,v
retrieving revision 1.7
diff -u -r1.7 BrowserControlFactory.java
--- classes_spec/org/mozilla/webclient/BrowserControlFactory.java	1 Oct 2002 00:39:20 -0000	1.7
+++ classes_spec/org/mozilla/webclient/BrowserControlFactory.java	6 Sep 2003 06:22:06 -0000
@@ -35,22 +35,38 @@
 import java.io.File;
 import java.io.FileNotFoundException;

-/**
- *
- *  <B>BrowserControlFactory</B> creates concrete instances of BrowserControl
-
- * <B>Lifetime And Scope</B> <P>
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.Properties;

- * This is a static class, it is neven instantiated.

+/**
+ *
+ *  <p><B>BrowserControlFactory</B> uses a discovery algorithm to find
+ *  an implementation of {@link BrowserControlFactoryInterface}.  All of
+ *  the public static methods in this class simply call through to this
+ *  implemenatation instance.</p>
+ *
+ * <p>The discovery mechanism used is to look try to load a resource
+ * called
+ * <code>META-INF/services/org.mozilla.webclient.BrowserControlFactoryInterface</code>.
+ * If the resource is found, interpret it as a <code>Properties</code>
+ * file and read out its first line.  Interpret the first line as the
+ * fully qualified class name of a class that implements {@link
+ * BrowserControlFactoryInterface}.  The named class must have a public
+ * no-arg constructor.</p>
+ *
  *
  * @version $Id: BrowserControlFactory.java,v 1.7 2002/10/01 00:39:20 edburns%acm.org Exp $
  *
- * @see	org.mozilla.webclient.test.EmbeddedMozilla
-
+ *
  */

-public class BrowserControlFactory extends Object
+public class BrowserControlFactory extends Object
 {
 //
 // Protected Constants
@@ -60,24 +76,13 @@
 // Class Variables
 //

-    private static boolean appDataHasBeenSet = false;
-    private static Class browserControlCanvasClass = null;
-    private static String platformCanvasClassName = null;
-    private static String browserType = null;
-
-//
-// Instance Variables
-//
-
-// Attribute Instance Variables
-
-// Relationship Instance Variables
+private static BrowserControlFactoryInterface instance = null;

 //
 // Constructors and Initializers
 //

-public BrowserControlFactory()
+private BrowserControlFactory()
 {
     Assert.assert_it(false, "This class shouldn't be constructed.");
 }
@@ -88,179 +93,97 @@

 public static void setAppData(String absolutePathToNativeBrowserBinDir) throws FileNotFoundException, ClassNotFoundException
 {
-    BrowserControlFactory.setAppData(BrowserControl.BROWSER_TYPE_NATIVE, absolutePathToNativeBrowserBinDir);
+    getInstance().setAppData(BrowserControl.BROWSER_TYPE_NATIVE, absolutePathToNativeBrowserBinDir);
 }

-
-    /**
-
-     * This method is used to set per-application instance data, such as
-     * the location of the browser binary.
-
-     * @param myBrowserType.  Either "native" or "nonnative"
-
-     * @param absolutePathToNativeBrowserBinDir the path to the bin dir
-     * of the native browser, including the bin.  ie:
-     * "D:\Projects\mozilla\dist\win32_d.obj\bin"
-
-     */
-
 public static void setAppData(String myBrowserType, String absolutePathToNativeBrowserBinDir) throws FileNotFoundException, ClassNotFoundException
 {
-    browserType = myBrowserType;
-    if (!appDataHasBeenSet) {
-        // figure out the correct value for platformCanvasClassName
-        if (browserType.equals(BrowserControl.BROWSER_TYPE_NON_NATIVE)) {
-            platformCanvasClassName = "org.mozilla.webclient.wrapper_nonnative.JavaBrowserControlCanvas";
-        }
-        else {
-            ParameterCheck.nonNull(absolutePathToNativeBrowserBinDir);
-
-            // verify that the directory exists:
-            File binDir = new File(absolutePathToNativeBrowserBinDir);
-            if (!binDir.exists()) {
-                throw new FileNotFoundException("Directory " + absolutePathToNativeBrowserBinDir + " is not found.");
-            }
-
-            // This hack is necessary for Sun Bug #4303996
-            java.awt.Canvas c = new java.awt.Canvas();
-            platformCanvasClassName = determinePlatformCanvasClassName();
-        }
-        // end of figuring out the correct value for platformCanvasClassName
-        if (platformCanvasClassName != null) {
-            browserControlCanvasClass = Class.forName(platformCanvasClassName);
-        }
-        else {
-            throw new ClassNotFoundException("Could not determine BrowserControlCanvas class to load\n");
-        }
-
-        try {
-            BrowserControlImpl.appInitialize(browserType, absolutePathToNativeBrowserBinDir);
-        }
-        catch (Exception e) {
-            throw new ClassNotFoundException("Can't initialize native browser: " +
-                                             e.getMessage());
-        }
-        appDataHasBeenSet = true;
-    }
+    getInstance().setAppData(myBrowserType, absolutePathToNativeBrowserBinDir);
 }

 public static void appTerminate() throws Exception
 {
-    BrowserControlImpl.appTerminate();
+    getInstance().appTerminate();
 }

 public static BrowserControl newBrowserControl() throws InstantiationException, IllegalAccessException, IllegalStateException
 {
-    if (!appDataHasBeenSet) {
-        throw new IllegalStateException("Can't create BrowserControl instance: setAppData() has not been called.");
-    }
-    Assert.assert_it(null != browserControlCanvasClass);
-
-    BrowserControlCanvas newCanvas = null;
-    BrowserControl result = null;
-    newCanvas = (BrowserControlCanvas) browserControlCanvasClass.newInstance();
-    if (null != newCanvas &&
-        null != (result = new BrowserControlImpl(browserType, newCanvas))) {
-        newCanvas.initialize(result);
-    }
-
+    BrowserControl result = null;
+    result = getInstance().newBrowserControl();
     return result;
 }

-/**
-
- * BrowserControlFactory.deleteBrowserControl is called with a
- * BrowserControl instance obtained from
- * BrowserControlFactory.newBrowserControl.  This method renders the
- * argument instance completely un-usable.  It should be called when the
- * BrowserControl instance is no longer needed.  This method simply
- * calls through to the non-public BrowserControlImpl.delete() method.
-
- * @see org.mozilla.webclient.ImplObject#delete
-
- */
-
 public static void deleteBrowserControl(BrowserControl toDelete)
 {
-    ParameterCheck.nonNull(toDelete);
-    ((BrowserControlImpl)toDelete).delete();
+    getInstance().deleteBrowserControl(toDelete);
 }

 //
-// General Methods
-//
-
-/**
+// helper methods
+//

- * Called from setAppData() in the native case.  This method simply
- * figures out the proper name for the class that is the
- * BrowserControlCanvas.
-
- * @return  "org.mozilla.webclient.wrapper_native.win32.Win32BrowserControlCanvas" or "org.mozilla.webclient.wrapper_native.gtk.GtkBrowserControlCanvas"
-
- */
-
-private static String determinePlatformCanvasClassName()
+protected static BrowserControlFactoryInterface getInstance()
 {
-    String result = null;
-    // cause the native library to be loaded
-    // PENDING(edburns): do some magic to determine the right kind of
-    // MozWebShellCanvas to instantiate
-
-    // How about this:
-    // I try loading sun.awt.windows.WDrawingSurfaceInfo. If it doesn't
-    // load, then I try loading sun.awt.motif.MDrawingSufaceInfo. If
-    // none loads, then I return a error message.
-    // If you think up of a better way, let me know.
-    // -- Mark
-    // Here is what I think is a better way: query the os.name property.
-    // This works in JDK1.4, as well.
-    // -- edburns
+    if (null != instance) {
+        return instance;
+    }

-    String osName = System.getProperty("os.name");
-
-    if (null != osName) {
-       if (-1 != osName.indexOf("indows")) {
-           result = "org.mozilla.webclient.wrapper_native.win32.Win32BrowserControlCanvas";
-       }
-       else {
-           result = "org.mozilla.webclient.wrapper_native.gtk.GtkBrowserControlCanvas";
-       }
+    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+    if (classLoader == null) {
+        throw new RuntimeException("Context ClassLoader");
     }

-    return result;
-}
-
-// ----UNIT_TEST_START
-
-//
-// Test methods
-//
-
-public static void main(String [] args)
-{
-    System.out.println("doing asserts");
-    Assert.setEnabled(true);
-    Log.setApplicationName("BrowserControlFactory");
-    Log.setApplicationVersion("0.0");
-    Log.setApplicationVersionDate("$Id: BrowserControlFactory.java,v 1.7 2002/10/01 00:39:20 edburns%acm.org Exp $");
-
-    BrowserControlCanvas canvas = null;
-    BrowserControl control = null;
+    BufferedReader reader = null;
+    InputStream stream = null;
+    String
+        className = null,
+        resourceName = "META-INF/services/org.mozilla.webclient.BrowserControlFactoryInterface";
     try {
-        BrowserControlFactory.setAppData("nonnative", args[0]);
-        control = BrowserControlFactory.newBrowserControl();
-        Assert.assert_it(control != null);
-        canvas = (BrowserControlCanvas) control.queryInterface("webclient.BrowserControlCanvas");
-        Assert.assert_it(canvas != null);
+        stream = classLoader.getResourceAsStream(resourceName);
+        if (stream != null) {
+            // Deal with systems whose native encoding is possibly
+            // different from the way that the services entry was created
+            try {
+                reader =
+                    new BufferedReader(new InputStreamReader(stream,
+                                                             "UTF-8"));
+            } catch (UnsupportedEncodingException e) {
+                reader = new BufferedReader(new InputStreamReader(stream));
+            }
+            className = reader.readLine();
+            reader.close();
+            reader = null;
+            stream = null;
+        }
+    } catch (IOException e) {
+    } catch (SecurityException e) {
+    } finally {
+        if (reader != null) {
+            try {
+                reader.close();
+            } catch (Throwable t) {
+                ;
+            }
+            reader = null;
+            stream = null;
+        }
+        if (stream != null) {
+            try {
+                stream.close();
+            } catch (Throwable t) {
+                ;
+            }
+            stream = null;
+        }
     }
-    catch (Exception e) {
-        System.out.println("\n BrowserControl not getting created \n");
-        System.out.println(e.getMessage());
+    if (null != className) {
+        try {
+            Class clazz = classLoader.loadClass(className);
+            instance = (BrowserControlFactoryInterface) (clazz.newInstance());
+        } catch (Exception e) {
+        }
     }
+    return instance;
 }
-
-// ----UNIT_TEST_END

 } // end of class BrowserControlFactory
Index: classes_spec/org/mozilla/webclient/BrowserControlImpl.java
===================================================================
RCS file: /cvsroot/mozilla/java/webclient/classes_spec/org/mozilla/webclient/BrowserControlImpl.java,v
retrieving revision 1.7
diff -u -r1.7 BrowserControlImpl.java
--- classes_spec/org/mozilla/webclient/BrowserControlImpl.java	27 Jul 2001 20:57:52 -0000	1.7
+++ classes_spec/org/mozilla/webclient/BrowserControlImpl.java	6 Sep 2003 06:22:07 -0000
@@ -30,8 +30,8 @@
 import org.mozilla.util.Utilities;


-
-class BrowserControlImpl extends Object implements BrowserControl
+// PENDING(edburns); move this inside impl package
+public class BrowserControlImpl extends Object implements BrowserControl
 {
 //
 // Protected Constants
@@ -145,8 +145,8 @@
 //
 // Class methods
 //
-
-static void appInitialize(String myBrowserType, String verifiedBinDirAbsolutePath) throws Exception
+// PENDING(edburns): make this package private again
+public static void appInitialize(String myBrowserType, String verifiedBinDirAbsolutePath) throws Exception
 {
     browserType = myBrowserType;
     if (null == wrapperFactory) {
@@ -157,7 +157,8 @@
     wrapperFactory.initialize(verifiedBinDirAbsolutePath);
 }

-static void appTerminate() throws Exception
+// PENDING(edburns): make this package private again
+public static void appTerminate() throws Exception
 {
     Assert.assert_it(null != wrapperFactory);

Index: test/automated/src/classes/org/mozilla/webclient/WebclientTestCase.java
===================================================================
RCS file: /cvsroot/mozilla/java/webclient/test/automated/src/classes/org/mozilla/webclient/WebclientTestCase.java,v
retrieving revision 1.1
diff -u -r1.1 WebclientTestCase.java
--- test/automated/src/classes/org/mozilla/webclient/WebclientTestCase.java	1 Oct 2002 00:39:28 -0000	1.1
+++ test/automated/src/classes/org/mozilla/webclient/WebclientTestCase.java	6 Sep 2003 06:22:08 -0000
@@ -133,6 +133,16 @@
 	
 }
 
+protected void verifyBinDirSet()
+{
+    assertTrue("BROWSER_BIN_DIR is not set",
+	       null != System.getProperty("BROWSER_BIN_DIR"));
+}
+
+protected String getBrowserBinDir() {
+    return System.getProperty("BROWSER_BIN_DIR");
+}
+
 /**
 
 * assertTrue that NSPR_LOG_FILE is set.
@@ -162,6 +172,7 @@
     // make sure we have at least PR_LOG_DEBUG set
     verifyLogModuleValueIsAtLeastN(WEBCLIENTSTUB_LOG_MODULE, 4);
     verifyLogModuleValueIsAtLeastN(WEBCLIENT_LOG_MODULE, 4);
+    verifyBinDirSet();
     if (sendOutputToFile()) {
 	verifyOutputFileIsSet();
     }
2003-09-06 06:26:50 +00:00
edburns%acm.org
2b845fdeaf Make Webclient compile and run on GNU/Linux with Mozilla 1.0.1.
Continue migration to ant.

Start out some JUnit tests.
2002-10-01 00:39:31 +00:00