I plan to write JUnit tests for the rest of the non-GUI based interfaces
in the following order.
Navigation and Navigation2
History and HistoryEntry
CurrentPage and CurrentPage2
DocumentLoadListener, EventRegistration and EventRegistration2
Then, I'll be forced to move into non-automatable tests and work on the
rest of the GUI functionality.
Ed
Making progress.
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
Ed
Ok, I started working on Navigation in earnest, and, of course, this
lead me to the question of how I want to handle per-window data, so it
was back to the UML drawing board.
I've checked in the Poseiden for UML 1.6.1 file at
<http://www.mozilla.org/projects/blackwood/webclient/design/20030809-analysis-of-mozilla-embedding-samples.zargo>.
It should be refreshed by the time you see this post. Look at the
"webclient" class diagram to see what I'm up to.
Ed
I've refactored the per-window data to closely follow the design of
GtkEmbed, by Christopher Blizzard. This required a fair amount of
shuffling around of the crufty old code in NativeEventThread.cpp and
WindowControlImpl.cpp.
I've created a new UML diagram from the old one, listed above. The new
one, which represents the latest thinking on the redesign, is at
<http://www.mozilla.org/projects/blackwood/webclient/design/20040306-webclient-2_0.zargo>.
I know the rest of the site is lame, but I need to get it working before
it's worthwhile to update the site.
Here's the change-bundle:
8<----------------------------------------------
- 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.
8<----------------------------------------------
Thanks for your continued patience.
Here's what I plan to do next:
1. fix PreferencesTest. There is a problem where pref.setPref(NAME,
null); doesn't clear the pref, which results in the Unit test failing
when run twice.
2. get Navigation.loadURL() working, headless.
Item 2 will require more fleshing out of the native object hierarchy, as
mentioned in the above diagram.
Ed
P.S. If you want to know why it's taking so long, check out my day job:
<http://java.sun.com/j2ee/javaserverfaces/>.
This is done, it was a matter of modifying nativeSetUnicharPref to accept a null
prefValue, and interpret that to mean nsIPref->ClearUserPref().
> 2. get Navigation.loadURL() working, headless.
Now on to this one.
Ed
> Here's what I plan to do next:
> 2. get Navigation.loadURL() working, headless.
>
> Item 2 will require more fleshing out of the native object hierarchy, as
> mentioned in the above diagram.
I have hooked up EmbedWindow to the NativeBrowserControl. Now we're ready
to try some navigation.
Ed
P.S. Please let me know if I should stop posting this fine level of detail.
I wired up NavigationTest and called loadURL() and was reminded of why
we had the native event queue in the first place: all mozilla API
calls
have to happen on the same thread. However, instead of maintaing the
complexity of the thread on the native side, I'm now doing it on the
Java side. It's much easier that way. This realization required me
to
revamp the entire startup story, but I'm happy with the result.
Things
make much more sense now. Please see the Cardinality diagram at
<http://www.mozilla.org/projects/blackwood/webclient/design/20040306-webclient-2_0.zargo>.
Next steps:
- bring the existing singleton tests back to running status
- get NavigationTest working.
Here's the checkin message.
Ed
8<-----------------------------------------
These changes are in concert with the checkin I just did to the
diagram
at
<http://www.mozilla.org/projects/blackwood/webclient/design/20040306-webclient-2_0.zargo>.
M classes_spec/org/mozilla/webclient/impl/WrapperFactory.java
M classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java
* <p>This class is the hub of the startup and shutdown sequence for
* Webclient. It is a singleton and owns references to other app
* singletons:</p>
*
* <ul>
* <li><p>{@link NativeEventThread}</p></li>
*
* <li><p>{@link Bookmarks}</p></li>
*
* <li><p>{@link Preferences}</p></li>
*
* <li><p>{@link ProfileManager}</p></li>
* <li><p>the native object singleton corresponding to this java
* object (if necessary)</p></li>
*
* </ul>
*
* <p>It maintains a set of {@link BrowserControlImpl} instances so
that
* we may return the native pointer for each one.</p>
*
* <p>This class is responsible for creating and initializing and
* deleting {@link BrowserControlImpl} instances, as well as ensuring
* that the native counterpart is proprely maintained in kind.</p>
*
* <p>This class has a tight contract with {@link
* NativeEventThread}.</p>
- make BrowserControl creation and deletion part of this classes
responsibilities.
- introduce NativeWrapperFactory concept.
- own the one and only NativeEventThread.
M classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java
- make this a singleton.
- remove dependencies on BrowserControl and nativeBrowserControl
* <p>This is a singleton class. All native events pass thru this
class
* by virtue of the {@link #pushRunnable} or {@link
pushNotifyRunnable}
* methods.</p>
- remove listener logic. This'll go into EventRegistration, where it
belongs.
A src_moz/NativeWrapperFactory.cpp
A src_moz/NativeWrapperFactory.h
- takes the place of the old WebclientContext
- is now a class
M classes_spec/org/mozilla/webclient/impl/BrowserControlImpl.java
- this no longer destroys the nativeBrowserControl. That is now done
by
WrapperFactoryImpl.
M classes_spec/org/mozilla/webclient/impl/WebclientFactoryImpl.java
- no longer maintain browserControlCount.
M classes_spec/org/mozilla/webclient/impl/wrapper_native/BookmarksImpl.java
M classes_spec/org/mozilla/webclient/impl/wrapper_native/NavigationImpl.java
M classes_spec/org/mozilla/webclient/impl/wrapper_native/PreferencesImpl.java
M classes_spec/org/mozilla/webclient/impl/wrapper_native/ProfileManagerImpl.java
- rename NativeContext to NativeWrapperFactory, to illustrate its
singletonness.
M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java
- comment out a bunch of stuff in anticipation of the new threading
model, currently being fleshed out.
M classes_spec/org/mozilla/webclient/impl/wrapper_native/ImplObjectNative.java
- NativeEventThread is singleton
M src_moz/BookmarksImpl.cpp
M src_moz/PreferencesImpl.cpp
M src_moz/ProfileManagerImpl.cpp
M src_moz/RDFEnumeration.cpp
M src_moz/RDFTreeNode.cpp
- rename WebclientContext to NativeWrapperFactory.
M src_moz/EmbedWindow.cpp
- mBaseWindow->Destroy();
+ if (mBaseWindow) {
+ mBaseWindow->Destroy();
+ }
M src_moz/Makefile.in
- Bring back NavigationImpl
- add NativeWrapperFactory.
M src_moz/NativeBrowserControl.cpp
M src_moz/NativeBrowserControl.h
- move event queue and java related stuff to NativeWrapperFactory.
This
class is now essentially a copy of EmbedPrivate in GtkEmbed.
M src_moz/NativeEventThread.cpp
- remove methods, most of it has moved to
WrapperFactoryImpl/NativeWrapperFactory.
M src_moz/NavigationImpl.cpp
- comment out all methods but LoadURI.
M src_moz/WrapperFactoryImpl.cpp
- take functionality over from NativeEventThread.
M src_moz/ns_util.cpp
M src_moz/ns_util.h
- the eventQueue is owned by NativeWrapperFactory now.
M src_moz/rdf_util.cpp
M src_share/jni_util.cpp
- make all exceptions RuntimeExceptions, so they can be thrown from a
Runnable.
M test/automated/src/classes/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImplTest.java
- comment out the meat of this test until I figure out how to test it.
M test/automated/src/test/BrowserControlFactoryTest_correct
- new content.
M classes_spec/org/mozilla/webclient/impl/WrapperFactory.java
M classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java
M classes_spec/org/mozilla/webclient/impl/wrapper_native/ImplObjectNative.java
- remove getNativeEventThread(). I've decided to expose the singleton
NativeEventThread instance via a package private class var.
M classes_spec/org/mozilla/webclient/impl/wrapper_native/BookmarksImpl.java
- run the necessary native methods on the event thread to avoid thread
safety assertions.
M classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java
- rename pushNotifyRunnable() to pushBlockingWCRunnable. Make it block
the caller until the argument WCRunnable has been run on the
NativeEventThread. Implement this by using wait/notify between
pushBlockingWCRunnable() and run().
- add package private NativeEventThread class variable.
- rename runnablesWithNotify ivar to blockingRunnables.
- remove the exception storage mechanism.
M classes_spec/org/mozilla/webclient/impl/wrapper_native/NavigationImpl.java
M classes_spec/org/mozilla/webclient/impl/wrapper_native/PreferencesImpl.java
M classes_spec/org/mozilla/webclient/impl/wrapper_native/ProfileManagerImpl.java
M classes_spec/org/mozilla/webclient/impl/wrapper_native/RDFEnumeration.java
M classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java
- levarage NativeEventThread.instance.pushBlockingWCRunnable().
A classes_spec/org/mozilla/webclient/impl/wrapper_native/WCRunnable.java
- Just like runnable, except return Object, not void.
M src_moz/PreferencesImpl.cpp
- remove unused automatic variable.
Next step: figure out why it's deadlocking and continue to push toward
getting Navigation.loadURL() working.
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
I couldn't sleep tonight, so I worked on webclient. Turns out the
deadlock was simple.
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
M build.xml
- rework exclusion patterns to prevent compilation of platform
specific
classes
A classes_spec/org/mozilla/webclient/impl/wrapper_native/GtkBrowserControlCanvas.java
R classes_spec/org/mozilla/webclient/impl/wrapper_native/gtk/GtkBrowserControlCanvas.java
- moved GtkBrowserControlCanvas.java up one level, for access to
package
private classes.
M src_moz/gtk/GtkBrowserControlCanvas.cpp
- package name changes
M test/automated/src/classes/org/mozilla/webclient/CompareFiles.java
- rework this logic to account for files that end in a different
number
of ignorable conditions.
A test/automated/src/classes/org/mozilla/webclient/impl/wrapper_native/TestGtkBrowserControlCanvas.java
R test/automated/src/classes/org/mozilla/webclient/impl/wrapper_native/gtk/TestGtkBrowserControlCanvas.java
- moved this test up one level.
Ed
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.
M classes_spec/org/mozilla/webclient/impl/wrapper_native/NavigationImpl.java
- remove loadFromStreamBlocking. No point in implementing this since
the loadFromStream() impl is inherently multi-threaded.
M src_moz/EmbedWindow.cpp
M src_moz/EmbedWindow.h
- expose LoadStream() method that wraps same on nsIDocShell.
M src_moz/InputStreamShim.cpp
- Do a lock around our buffer deletion in or dtor.
M src_moz/Makefile.in
- activate nsActions and NavigationActionEvents
M src_moz/NavigationActionEvents.cpp
M src_moz/NavigationActionEvents.h
- comment out everything but wsLoadFromStreamEvent.
- fix it to work with the NativeBrowserControl.
M src_moz/NavigationImpl.cpp
- activate nativeLoadFromStream. This is the first *new* version method
to use the old native event queue.
M src_moz/ns_util.cpp
M src_moz/ns_util.h
- remove unused first arg from Post*Event methods.
M test/automated/src/classes/org/mozilla/webclient/NavigationTest.java
- activate loadFromStream test.
M test/automated/src/classes/org/mozilla/webclient/RandomHTMLInputStream.java
- add a randomExceptions param to the ctor to enable or disable randomly
thrown exceptions.
Hello Bart,
I had been making good, regular, progress on webclient, until I got
stuck trying to re-implement Navigation.loadFromStream(). You can see
my progress at <http://purl.oclc.org/NET/edburns/webclientStatus/>.
I need someone to help me with the following problem.
Navigation.loadFromStream() is implemented using a pipe-like class
called InputStreamShim [1]. This class reads from Java into a buffer,
and that buffer is, in turn, read from mozilla. It acts as a shim
between java and mozilla.
I'm finding that this isn't working, even after converting
InputStreamShim to implement nsIAsyncInputStream. What's happening is
that somehow nsIInputStreamTransport is getting instantiated with a
really small mLimit ivar, which causes the stream to close prematurely,
before all the data has been read from Java. At least, I think that's
the cause. One thing I am sure of is that the InputStreamShim::Close()
is called prematurely.
Bart, can you please hook me up with someone who can help me get
unstuck?
Ed
[1] http://lxr.mozilla.org/mozilla/source/java/webclient/src_moz/InputStreamShim.cpp
Any ideas on this?
Ed
Hello Darin,
I'm hoping Bart talked to you about this. I made a slight bit of
progress on the issue described at the tail end of
<http://purl.oclc.org/NET/edburns/webclientStatus/>. Looking at the
comment at
<http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsInputStreamChannel.cpp#298>.
I made my Available() implementation return PR_UINT32_MAX
<http://lxr.mozilla.org/mozilla/source/java/webclient/src_moz/InputStreamShim.cpp#353>
instead of what was actually available. This got me a little further,
however, when the stream reaches a situation where
NS_BASE_STREAM_WOULD_BLOCK must be returned, I'm finding that
<http://lxr.mozilla.org/mozilla/source/xpcom/io/nsStreamUtils.cpp#322>
still doesn't do the right thing, because, even though my class
InputStreamShim.cpp implements nsIAsyncInputStream, I'm finding that
nsStreamUtils mAsyncSource is null. I think this is due to some
wrapping behavior. How do I make it so mAsyncSource is non-null?
Thanks,
Ed
M build-tests.xml
- comment in all tests
M classes_spec/org/mozilla/webclient/Navigation2.java
M classes_spec/org/mozilla/webclient/impl/wrapper_native/NavigationImpl.java
- add loadFromStreamBlocking, until we have DocumentLoadListener working
M src_moz/InputStreamShim.cpp
M src_moz/InputStreamShim.h
- rollback the nsIAsyncInputStream changes.
M test/automated/src/classes/org/mozilla/webclient/NavigationTest.java
- test from a FileInputStream
M test/automated/src/classes/org/mozilla/webclient/RandomHTMLInputStream.java
- Allow notification when read completes.
Ed
M src_moz/InputStreamShim.cpp
- remove debugging printfs
- change buffer increment
M test/automated/src/classes/org/mozilla/webclient/NavigationTest.java
- exercise random load from stream
M test/automated/src/classes/org/mozilla/webclient/RandomHTMLInputStream.java
- make the seed be constant.
- flush the output when sleeping
M src_moz/InputStreamShim.cpp
M src_moz/InputStreamShim.h
- made this correctly implement nsIAsyncInputStream.
M test/automated/src/classes/org/mozilla/webclient/NavigationTest.java
- comment out the FileInputStream case.
Ed
- modified ::doClose() to set the mCloseStatus to NS_BASE_STREAM_CLOSED
- modified ::Available() to be aware of mDoClose, and if we have bytes
for mozila, to return the actual avaialble bytes. Then, when we're
called again we return the mCloseStatus.
M test/automated/src/classes/org/mozilla/webclient/NavigationTest.java
- activate the rest of this test.
The next step will be to get the DocumentLoadListener working.
Ed
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
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
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.
The problem is that nsLoadGroup.mForegroundCount never goes to zero in
the Stream case. I've illustrated the incrementing and decrementing
of
mForegroundCount in the file:/// URL case (case 1) and the
LoadFromStream case (case 2). Can anyone give any clues about this?
Case 1: Load a file:/// URL
mForegroundCount == 0
mForegroundCount += 1 when
nsLoadGroup::AddRequest() line 607
nsFileChannel::AsyncOpen() line 506
nsDocumentOpenInfo::Open() line 221 + 18 bytes
nsURILoader::OpenURI() line 791 + 19 bytes
nsDocShell::DoChannelLoad() line 5662 + 39 bytes
nsDocShell::DoURILoad() line 5435 + 38 bytes
nsDocShell::InternalLoad() line 5225 + 55 bytes
nsDocShell::LoadURI() line 734 + 82 bytes
nsDocShell::LoadURI() line 2478 + 38 bytes
nsWebBrowser::LoadURI() line 668
Java_org_mozilla_webclient_impl_wrapper_1native_NavigationImpl_nativeLoadURL()
line 81 + 38 bytes
mForegroundCount == 1
mForegroundCount += 1 when
nsLoadGroup::AddRequest() line 607
HTMLContentSink::AddDummyParserRequest() line 4718 + 40 bytes
HTMLContentSink::WillBuildModel() line 2300 + 11 bytes
CNavDTD::WillBuildModel() line 398 + 12 bytes
nsParser::WillBuildModel() line 1227 + 62 bytes
nsParser::ResumeParse() line 1732 + 23 bytes
nsParser::OnDataAvailable() line 2426 + 21 bytes
nsDocumentOpenInfo::OnDataAvailable() line 308 + 46 bytes
nsFileChannel::OnDataAvailable() line 595
nsInputStreamPump::OnStateTransfer() line 433 + 65 bytes
nsInputStreamPump::OnInputStreamReady() line 336 + 11 bytes
nsInputStreamReadyEvent::EventHandler() line 117
PL_HandleEvent() line 671 + 10 bytes
PL_ProcessPendingEvents() line 606 + 9 bytes
_md_TimerProc() line 977 + 9 bytes
USER32! 77e11ef0()
USER32! 77e120d5()
USER32! 77e15f69()
Java_org_mozilla_webclient_impl_wrapper_1native_NativeEventThread_nativeProcessEvents()
line 133
mForegroundCount == 2
mForegroundCount += 1 when
nsLoadGroup::AddRequest() line 607
PresShell::AddDummyLayoutRequest() line 6704 + 40 bytes
PresShell::ReflowCommandAdded() line 6659
PresShell::AppendReflowCommand() line 3770
nsFrame::CreateAndPostReflowCommand() line 4590
nsBlockFrame::ReflowDirtyChild() line 5830 + 21 bytes
nsBlockFrame::AppendFrames() line 4506
FrameManager::AppendFrames() line 935
nsCSSFrameConstructor::AppendFrames() line 7565 + 22 bytes
nsCSSFrameConstructor::ContentAppended() line 8393
StyleSetImpl::ContentAppended() line 1629
PresShell::ContentAppended() line 5316 + 36 bytes
nsDocument::ContentAppended() line 1863
nsHTMLDocument::ContentAppended() line 1365
HTMLContentSink::NotifyAppend() line 4240
SinkContext::FlushTags() line 1870
SinkContext::DidAddContent() line 1257
SinkContext::FlushText() line 1966
SinkContext::FlushTags() line 1817
HTMLContentSink::WillInterrupt() line 2506 + 16 bytes
CNavDTD::WillInterruptParse() line 3929 + 18 bytes
nsParser::ResumeParse() line 1852
nsParser::OnDataAvailable() line 2426 + 21 bytes
nsDocumentOpenInfo::OnDataAvailable() line 308 + 46 bytes
nsFileChannel::OnDataAvailable() line 595
nsInputStreamPump::OnStateTransfer() line 433 + 65 bytes
nsInputStreamPump::OnInputStreamReady() line 336 + 11 bytes
nsInputStreamReadyEvent::EventHandler() line 117
PL_HandleEvent() line 671 + 10 bytes
PL_ProcessPendingEvents() line 606 + 9 bytes
_md_TimerProc() line 977 + 9 bytes
USER32! 77e11ef0()
USER32! 77e120d5()
USER32! 77e15f69()
Java_org_mozilla_webclient_impl_wrapper_1native_NativeEventThread_nativeProcessEvents()
line 133
mForegroundCount == 3
mForegroundCount -= 1 when
nsLoadGroup::RemoveRequest() line 687
HTMLContentSink::RemoveDummyParserRequest() line 4735 + 42 bytes
HTMLContentSink::DidBuildModel() line 2440
CNavDTD::DidBuildModel() line 705
nsParser::DidBuildModel() line 1245 + 46 bytes
nsParser::ResumeParse() line 1820
nsParser::OnStopRequest() line 2472 + 21 bytes
nsDocumentOpenInfo::OnStopRequest() line 326
nsFileChannel::OnStopRequest() line 578
nsInputStreamPump::OnStateStop() line 499
nsInputStreamPump::OnInputStreamReady() line 339 + 11 bytes
nsInputStreamReadyEvent::EventHandler() line 117
PL_HandleEvent() line 671 + 10 bytes
PL_ProcessPendingEvents() line 606 + 9 bytes
_md_TimerProc() line 977 + 9 bytes
USER32! 77e11ef0()
USER32! 77e120d5()
USER32! 77e15f69()
Java_org_mozilla_webclient_impl_wrapper_1native_NativeEventThread_nativeProcessEvents()
line 133
mForegroundCount == 2
mForegroundCount -= 1 when
nsLoadGroup::RemoveRequest() line 687
nsFileChannel::OnStopRequest() line 584
nsInputStreamPump::OnStateStop() line 499
nsInputStreamPump::OnInputStreamReady() line 339 + 11 bytes
nsInputStreamReadyEvent::EventHandler() line 117
PL_HandleEvent() line 671 + 10 bytes
PL_ProcessPendingEvents() line 606 + 9 bytes
_md_TimerProc() line 977 + 9 bytes
USER32! 77e11ef0()
USER32! 77e120d5()
USER32! 77e15f69()
Java_org_mozilla_webclient_impl_wrapper_1native_NativeEventThread_nativeProcessEvents()
line 133
mForegroundCount == 1
mForegroundCount -= 1 when
nsLoadGroup::RemoveRequest() line 687
PresShell::RemoveDummyLayoutRequest() line 6725 + 42 bytes
PresShell::DoneRemovingReflowCommands() line 6686
PresShell::ProcessReflowCommands() line 6546
ReflowEvent::HandleEvent() line 6321
HandlePLEvent() line 6335
PL_HandleEvent() line 671 + 10 bytes
PL_ProcessPendingEvents() line 606 + 9 bytes
_md_EventReceiverProc() line 1412 + 9 bytes
USER32! 77e11ef0()
USER32! 77e120d5()
USER32! 77e15f69()
Java_org_mozilla_webclient_impl_wrapper_1native_NativeEventThread_nativeProcessEvents()
line 133
NOW mForegroundCount == 0. This ultimately causes the
END_DOCUMENT_LOAD event to be sent to my nsIWebProgressListener.
Case 2: nsDocShell->LoadStream()
mForegroundCount == 0
mForegroundCount += 1 when
nsLoadGroup::AddRequest() line 607
nsDocShell::CreateContentViewer() line 4527
nsDSURIContentListener::DoContent() line 109 + 33 bytes
nsDocumentOpenInfo::TryContentListener() line 673 + 70 bytes
nsDocumentOpenInfo::DispatchContent() line 413 + 57 bytes
nsDocumentOpenInfo::OnStartRequest() line 287 + 16 bytes
nsInputStreamChannel::OnStartRequest() line 356
nsInputStreamPump::OnStateStart() line 377 + 42 bytes
nsInputStreamPump::OnInputStreamReady() line 333 + 11 bytes
nsInputStreamReadyEvent::EventHandler() line 117
PL_HandleEvent() line 671 + 10 bytes
NativeWrapperFactory::ProcessEventLoop() line 205 + 9 bytes
Java_org_mozilla_webclient_impl_wrapper_1native_NativeEventThread_nativeProcessEvent()
line 133
mForegroundCount == 1
mForegroundCount += 1 when
nsLoadGroup::AddRequest() line 607
HTMLContentSink::AddDummyParserRequest() line 4718 + 40 bytes
HTMLContentSink::WillBuildModel() line 2300 + 11 bytes
CNavDTD::WillBuildModel() line 398 + 12 bytes
nsParser::WillBuildModel() line 1227 + 62 bytes
nsParser::ResumeParse() line 1732 + 23 bytes
nsParser::OnDataAvailable() line 2426 + 21 bytes
nsDocumentOpenInfo::OnDataAvailable() line 308 + 46 bytes
nsInputStreamChannel::OnDataAvailable() line 383 + 57 bytes
nsInputStreamPump::OnStateTransfer() line 433 + 65 bytes
nsInputStreamPump::OnInputStreamReady() line 336 + 11 bytes
nsInputStreamReadyEvent::EventHandler() line 117
PL_HandleEvent() line 671 + 10 bytes
NativeWrapperFactory::ProcessEventLoop() line 205 + 9 bytes
Java_org_mozilla_webclient_impl_wrapper_1native_NativeEventThread_nativeProcessEvents()
line 133
NOW, we go into an infinite loop of adding the dummy request then
removing it.
mForegroundCount == 2
mForegroundCount += 1 when
nsLoadGroup::AddRequest() line 607
PresShell::AddDummyLayoutRequest() line 6704 + 40 bytes
PresShell::ReflowCommandAdded() line 6659
PresShell::AppendReflowCommand() line 3770
nsFrame::CreateAndPostReflowCommand() line 4590
nsBlockFrame::ReflowDirtyChild() line 5830 + 21 bytes
nsBlockFrame::AppendFrames() line 4506
FrameManager::AppendFrames() line 935
nsCSSFrameConstructor::AppendFrames() line 7565 + 22 bytes
nsCSSFrameConstructor::ContentAppended() line 8393
StyleSetImpl::ContentAppended() line 1629
PresShell::ContentAppended() line 5316 + 36 bytes
nsDocument::ContentAppended() line 1863
nsHTMLDocument::ContentAppended() line 1365
HTMLContentSink::NotifyAppend() line 4240
SinkContext::FlushTags() line 1870
SinkContext::DidAddContent() line 1257
SinkContext::FlushText() line 1966
SinkContext::FlushTags() line 1817
HTMLContentSink::Notify() line 2475
nsTimerImpl::Fire() line 386
handleTimerEvent() line 449
PL_HandleEvent() line 671 + 10 bytes
PL_ProcessPendingEvents() line 606 + 9 bytes
_md_TimerProc() line 977 + 9 bytes
USER32! 77e11ef0()
USER32! 77e120d5()
USER32! 77e15f69()
Java_org_mozilla_webclient_impl_wrapper_1native_NativeEventThread_nativeProcessEvents()
line 133
mForegroundCount == 3
mForegroundCount -= 1 when
nsLoadGroup::RemoveRequest() line 687
PresShell::RemoveDummyLayoutRequest() line 6725 + 42 bytes
PresShell::DoneRemovingReflowCommands() line 6686
PresShell::ProcessReflowCommands() line 6546
ReflowEvent::HandleEvent() line 6321
HandlePLEvent() line 6335
PL_HandleEvent() line 671 + 10 bytes
PL_ProcessPendingEvents() line 606 + 9 bytes
_md_EventReceiverProc() line 1412 + 9 bytes
USER32! 77e11ef0()
USER32! 77e1204c()
USER32! 77e15f69()
Java_org_mozilla_webclient_impl_wrapper_1native_NativeEventThread_nativeProcessEvents()
line 133
Also, the
nsLoadGroup::RemoveRequest() line 687
nsFileChannel::OnStopRequest() line 584
nsInputStreamPump::OnStateStop() line 499
nsInputStreamPump::OnInputStreamReady() line 339 + 11 bytes
scenario never happens for the LoadFromStream case, even though the
nsIInputStream does indeed close.
Thanks,
Ed
- 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.
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.
[...]
I figure it out, it was a problem with InputStreamShim.cpp
Ed
I'm working towards getting equivalent functionality to
<https://jdic.dev.java.net/nonav/documentation/javadoc/jdic/org/jdesktop/jdic/browser/WebBrowser.html>
working by JavaOne SF 2004. At this point, all that remains are
refresh(), back(), forward(), and post(). All but post() are trivial.
M classes_spec/org/mozilla/webclient/Navigation2.java
- remove "blocking" methods since we don't need them now that we have
DocumentLoadListener working again.
M classes_spec/org/mozilla/webclient/impl/wrapper_native/NavigationImpl.java
- remove "blocking" methods since we don't need them now that we have
DocumentLoadListener working again.
- implement stop().
M classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java
- throw IllegalStateException if you try to get a BrowserControl
instance after appTerminate() has been called.
- throw IllegalStateException if appTerminate() is called more than
once.
M src_moz/NavigationImpl.cpp
- call through to stop
M test/automated/src/classes/org/mozilla/webclient/NavigationTest.java
- test first test for stop.
--
Modify my email address before replying to remove spam block.
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.
Hello, I'm trying to use nsIWebNavigation to load an http URI:
nsresult rv =
nativeBrowserControl->mNavigation->LoadURI(urlStringChars,
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull, nsnull,
nsnull);
However, I find that when this command executes, the URL doesn't load.
file:/// urls load fine however. I investigated and found that
nsPromptService::Alert(nsIDOMWindow *parent,
const PRUnichar *dialogTitle, const PRUnichar
*text)
is getting called, and the "text" argument is:
"This document cannot be displayed while offline. To go online,
uncheck Work Offline from the File menu."
However, my embedding app has no such choice to work offline. Does
anyone know how to fix this?
Ed
[I don't know if this went through before -- sorry if you get this more
than once]
Ed Burns wrote:
> "This document cannot be displayed while offline. To go online,
> uncheck Work Offline from the File menu."
>
>
Hmm...Well, I don't really have an answer for you, but I have a couple
of observations.
It seems there is a network.online property if you look in
about:config. Perhaps somehow that was switched to "false". Maybe you
need to modify this config option to be "true" (either through executing
the browser, or programatically)?
What happens if you use the browser outside of Webclient? Does the
browser start up in "offline" mode? In my experience using Webclient,
the options I set using the browser that Webclient uses are carried over
into Webclient.
HTH
--Chris
Next step is to get POST to work.
M src_moz/Makefile.in
- added WindowWatcher to compilation
M src_moz/NativeBrowserControl.cpp
- turn on our WindowWatcher. Still need to flesh this out, but it
seemed to be necessary for http to work.
M src_moz/WindowCreator.cpp
M src_moz/WindowCreator.h
- return to compilation
M src_moz/WrapperFactoryImpl.cpp
- hack to workaround bug posted to n.p.m.e by me today regarding
nsIOService::SetOffline(TRUE) being called. The workaround is to
manually call nsIOService::SetOffline(FALSE) *after* the point in time
where the "TRUE" call is made.
M test/automated/src/classes/org/mozilla/util/THTTPD.java
- tweaks to make this suitable for JUnit testing.
M test/automated/src/classes/org/mozilla/webclient/NavigationTest.java
- all navigation tests work.
As a workaround, I manually obtain the nsIIOService and call
SetOffline(PR_FALSE). I'd like to not have to do this however.
> What happens if you use the browser outside of Webclient? Does the
> browser start up in "offline" mode? In my experience using Webclient,
> the options I set using the browser that Webclient uses are carried over
> into Webclient.
Thanks for your prompt reply Chris. I worked around the problem by
manually calling nsIIOService::SetOffline(PR_FALSE). I think this has
something to do with the way I initialize the profile manager.
Ed
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(newBrowser));
webNav->LoadURI(NS_ConvertASCIItoUCS2(mNewURL[mListURLIndex++]).get(),
nsIWebNavigation::LOAD_FLAGS_NONE,nsnull,nsnull,nsnull);
mNewURL[] is a list of urls stored.
Best regards.
--
Béatrice Philippe
--
Béatrice Philippe
beatrice....@wanadoo.fr
"Ed Burns" <edb...@REMOVETHISacm.org> a écrit dans le message de
news:pan.2004.06.22....@REMOVETHISacm.org...
M classes_spec/org/mozilla/webclient/impl/wrapper_native/NavigationImpl.java
M src_moz/NavigationImpl.cpp
- push thru "refresh" behavior.
M test/automated/src/classes/org/mozilla/webclient/NavigationTest.java
- move test HTTPD server out so it can be used by all tests in suite.
M test/automated/src/classes/org/mozilla/webclient/WebclientTestCase.java
- make getBrowserBinDir() static.
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.
A test/automated/src/classes/org/mozilla/webclient/DocumentLoadListenerImpl.java
- Forgot to add this.
M classes_spec/org/mozilla/webclient/impl/wrapper_native/HistoryImpl.java
M src_moz/HistoryImpl.cpp
- push through can{back,forward}(), forward().
M test/automated/src/classes/org/mozilla/webclient/HistoryTest.java
- exercise new methods.
- 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
Incidentally, here are the diffs. As you would expect, it's pretty
straightforward, since JDIC was inspired by webclient code.
Now I feel we have enough to call it an alpha.
--- /cygdrive/d/Projects/mozilla/jdic/src/jdic/demo/Browser/Browser.java 2004-05-24
05:09:46.000000000 -0400
+++ TestBrowser.java 2004-06-25 09:42:08.000000000 -0400
@@ -18,6 +18,8 @@
* USA.
*/
+package org.mozilla.webclient.test;
+
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
@@ -27,24 +29,32 @@
import java.net.URL;
import java.net.MalformedURLException;
-import org.jdesktop.jdic.browser.*;
-
+import org.mozilla.webclient.*;
/**
- * JDIC API demo main class.
- * <p>
- * <code>Browser</code> is a GUI application demonstrating the usage
of the JDIC API package
- * <code>org.jdesktop.jdic.browser</code> (Browser component).
+ * <p>webclient API demo main class.</p>
+
+ * <p><code>TestBrowser</code> is a GUI application demonstrating the
+ * usage of the package <code>org.mozilla.webclient</code> </p>
+
+ * <p>This is based on the TestBrowser class in the <a
+ * href="https://jdic.dev.java.net/">JDIC project</a>. </p>
*/
-public class Browser extends JPanel {
+public class TestBrowser extends JPanel {
+
+ public void addNotify() {
+ super.addNotify();
+ browserControlCanvas.setVisible(true);
+ }
+
public static ImageIcon browseIcon = new ImageIcon(
- Browser.class.getResource("images/Right.gif"));
+ TestBrowser.class.getResource("images/Right.gif"));
BorderLayout borderLayout1 = new BorderLayout();
JToolBar jBrowserToolBar = new JToolBar();
- JButton jStopButton = new JButton("Stopp",
+ JButton jStopButton = new JButton("Stop",
new ImageIcon(getClass().getResource("images/Stop.png")));
JButton jRefreshButton = new JButton("Refresh",
@@ -53,6 +63,7 @@
new ImageIcon(getClass().getResource("images/Forward.png")));
JButton jBackButton = new JButton("Back",
new ImageIcon(getClass().getResource("images/Back.png")));
+ JButton jCopyButton = new JButton("Copy");
JPanel jAddressPanel = new JPanel();
JLabel jAddressLabel = new JLabel();
@@ -62,10 +73,14 @@
MyStatusBar statusBar = new MyStatusBar();
JPanel jBrowserPanel = new JPanel();
- WebBrowser webBrowser;
- WebBrowser.Status myStatus;
+ BrowserControl webBrowser;
+ Navigation navigation;
+ History history;
+ EventRegistration eventRegistration;
+ CurrentPage currentPage;
+ Canvas browserControlCanvas;
- public Browser() {
+ public TestBrowser() {
try {
jbInit();
} catch (Exception e) {
@@ -76,6 +91,7 @@
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ BrowserControlFactory.setAppData(System.getProperty("BROWSER_BIN_DIR"));
} catch (Exception e) {}
JFrame frame = new JFrame("JDIC API Demo - Browser");
@@ -83,7 +99,7 @@
Container contentPane = frame.getContentPane();
contentPane.setLayout(new GridLayout(1, 1));
- contentPane.add(new Browser());
+ contentPane.add(new TestBrowser());
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
@@ -118,25 +134,32 @@
jGoButton.setToolTipText("Load the given URL");
jGoButton.setIcon(browseIcon);
jGoButton.setText("GO");
- jGoButton.addActionListener(new
Browser_jGoButton_actionAdapter(this));
+ jGoButton.addActionListener(new
TestBrowser_jGoButton_actionAdapter(this));
jAddressPanel.setLayout(new BorderLayout());
- jAddressTextField.addActionListener(new
Browser_jAddressTextField_actionAdapter(this));
+ jAddressTextField.addActionListener(new
TestBrowser_jAddressTextField_actionAdapter(this));
jBackButton.setToolTipText("Go back one page");
jBackButton.setHorizontalTextPosition(SwingConstants.TRAILING);
jBackButton.setEnabled(false);
jBackButton.setMaximumSize(new Dimension(75, 27));
jBackButton.setPreferredSize(new Dimension(75, 27));
- jBackButton.addActionListener(new
Browser_jBackButton_actionAdapter(this));
+ jBackButton.addActionListener(new
TestBrowser_jBackButton_actionAdapter(this));
+
+ jCopyButton.setToolTipText("Copy current selection");
+ jCopyButton.setHorizontalTextPosition(SwingConstants.TRAILING);
+ jCopyButton.setMaximumSize(new Dimension(75, 27));
+ jCopyButton.setPreferredSize(new Dimension(75, 27));
+ jCopyButton.addActionListener(new
TestBrowser_jCopyButton_actionAdapter(this));
+
jForwardButton.setToolTipText("Go forward one page");
jForwardButton.setEnabled(false);
- jForwardButton.addActionListener(new
Browser_jForwardButton_actionAdapter(this));
+ jForwardButton.addActionListener(new
TestBrowser_jForwardButton_actionAdapter(this));
jRefreshButton.setToolTipText("Reload current page");
jRefreshButton.setEnabled(true);
jRefreshButton.setMaximumSize(new Dimension(75, 27));
jRefreshButton.setMinimumSize(new Dimension(75, 27));
jRefreshButton.setPreferredSize(new Dimension(75, 27));
- jRefreshButton.addActionListener(new
Browser_jRefreshButton_actionAdapter(this));
+ jRefreshButton.addActionListener(new
TestBrowser_jRefreshButton_actionAdapter(this));
jStopButton.setToolTipText("Stop loading this page");
jStopButton.setVerifyInputWhenFocusTarget(true);
jStopButton.setText("Stop");
@@ -144,7 +167,7 @@
jStopButton.setMaximumSize(new Dimension(75, 27));
jStopButton.setMinimumSize(new Dimension(75, 27));
jStopButton.setPreferredSize(new Dimension(75, 27));
- jStopButton.addActionListener(new
Browser_jStopButton_actionAdapter(this));
+ jStopButton.addActionListener(new
TestBrowser_jStopButton_actionAdapter(this));
jAddressPanel.add(jAddressLabel, BorderLayout.WEST);
jAddressPanel.add(jAddressTextField, BorderLayout.CENTER);
jAddressPanel.add(jGoButton, BorderLayout.EAST);
@@ -158,6 +181,7 @@
jBrowserToolBar.addSeparator();
jBrowserToolBar.add(jRefreshButton, null);
jBrowserToolBar.add(jStopButton, null);
+ // jBrowserToolBar.add(jCopyButton, null);
jBrowserToolBar.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createEtchedBorder(),
BorderFactory.createEmptyBorder(2, 2, 2, 0)));
@@ -169,47 +193,56 @@
statusBar.setBorder(BorderFactory.createEmptyBorder(2, 0, 0,
0));
statusBar.lblDesc.setText("JDIC API Demo - Browser");
-
+
try {
- webBrowser = new WebBrowser(new URL("http://java.net"));
+ webBrowser = BrowserControlFactory.newBrowserControl();
+ navigation = (Navigation)
+ webBrowser.queryInterface(BrowserControl.NAVIGATION_NAME);
+ history = (History)
+ webBrowser.queryInterface(BrowserControl.HISTORY_NAME);
+ eventRegistration = (EventRegistration)
+ webBrowser.queryInterface(BrowserControl.EVENT_REGISTRATION_NAME);
+ currentPage = (CurrentPage)
+ webBrowser.queryInterface(BrowserControl.CURRENT_PAGE_NAME);
+ browserControlCanvas = (Canvas)
+ webBrowser.queryInterface(BrowserControl.BROWSER_CONTROL_CANVAS_NAME);
// Print out debug messages in the command line.
//myWebBrowser.setDebug(true);
- } catch (MalformedURLException e) {
+ } catch (Exception e) {
System.out.println(e.getMessage());
return;
}
-
- myStatus = webBrowser.getStatus();
- webBrowser.addWebBrowserListener(new WebBrowserListener() {
- public void downloadStarted(WebBrowserEvent event) {
- updateStatusInfo("Loading started.");
- }
-
- public void downloadCompleted(WebBrowserEvent event) {
- jBackButton.setEnabled(myStatus.isBackEnabled());
- jForwardButton.setEnabled(myStatus.isForwardEnabled());
-
- updateStatusInfo("Loading completed.");
-
- URL currentUrl = webBrowser.getURL();
-
- if (currentUrl != null) {
- jAddressTextField.setText(currentUrl.toString());
- }
- }
-
- public void downloadProgress(WebBrowserEvent event) {
- // updateStatusInfo("Loading in progress...");
- }
-
- public void downloadError(WebBrowserEvent event) {
- updateStatusInfo("Loading error.");
- }
- });
-
+
+ eventRegistration.addDocumentLoadListener(new
DocumentLoadListener() {
+ public void eventDispatched(WebclientEvent event) {
+ if (event instanceof DocumentLoadEvent) {
+ switch ((int) event.getType()) {
+ case ((int) DocumentLoadEvent.START_DOCUMENT_LOAD_EVENT_MASK):
+ updateStatusInfo("Loading started.");
+ break;
+ case ((int) DocumentLoadEvent.END_DOCUMENT_LOAD_EVENT_MASK):
+ jBackButton.setEnabled(history.canBack());
+ jForwardButton.setEnabled(history.canForward());
+ updateStatusInfo("Loading completed.");
+
+ if (event.getEventData() != null) {
+ jAddressTextField.setText(event.getEventData().toString());
+ }
+ break;
+ case ((int) DocumentLoadEvent.PROGRESS_URL_LOAD_EVENT_MASK):
+ // updateStatusInfo("Loading in progress...");
+ break;
+ case ((int) DocumentLoadEvent.FETCH_INTERRUPT_EVENT_MASK):
+ updateStatusInfo("Loading error.");
+ break;
+ }
+ }
+ }
+ });
+
jBrowserPanel.setLayout(new BorderLayout());
- jBrowserPanel.add(webBrowser, BorderLayout.CENTER);
-
+ jBrowserPanel.add(browserControlCanvas, BorderLayout.CENTER);
+
this.add(jAddrToolBarPanel, BorderLayout.NORTH);
this.add(statusBar, BorderLayout.SOUTH);
this.add(jBrowserPanel, BorderLayout.CENTER);
@@ -264,7 +297,7 @@
}
}
- webBrowser.setURL(curUrl);
+ navigation.loadURL(curUrl.toString());
// Update the address text field, statusbar, and
toolbar info.
updateStatusInfo("Loading " + curUrl.toString() + "
......");
@@ -285,27 +318,32 @@
}
void jBackButton_actionPerformed(ActionEvent e) {
- webBrowser.back();
+ history.back();
+ }
+
+ void jCopyButton_actionPerformed(ActionEvent e) {
+ currentPage.copyCurrentSelectionToSystemClipboard();
}
+
void jForwardButton_actionPerformed(ActionEvent e) {
- webBrowser.forward();
+ history.forward();
}
void jRefreshButton_actionPerformed(ActionEvent e) {
- webBrowser.refresh();
+ navigation.refresh(Navigation.LOAD_FORCE_RELOAD);
}
void jStopButton_actionPerformed(ActionEvent e) {
- webBrowser.stop();
+ navigation.stop();
}
}
-class Browser_jAddressTextField_actionAdapter implements
java.awt.event.ActionListener {
- Browser adaptee;
+class TestBrowser_jAddressTextField_actionAdapter implements
java.awt.event.ActionListener {
+ TestBrowser adaptee;
- Browser_jAddressTextField_actionAdapter(Browser adaptee) {
+ TestBrowser_jAddressTextField_actionAdapter(TestBrowser adaptee)
{
this.adaptee = adaptee;
}
@@ -315,10 +353,10 @@
}
-class Browser_jBackButton_actionAdapter implements
java.awt.event.ActionListener {
- Browser adaptee;
+class TestBrowser_jBackButton_actionAdapter implements
java.awt.event.ActionListener {
+ TestBrowser adaptee;
- Browser_jBackButton_actionAdapter(Browser adaptee) {
+ TestBrowser_jBackButton_actionAdapter(TestBrowser adaptee) {
this.adaptee = adaptee;
}
@@ -327,11 +365,23 @@
}
}
+class TestBrowser_jCopyButton_actionAdapter implements
java.awt.event.ActionListener {
+ TestBrowser adaptee;
+
+ TestBrowser_jCopyButton_actionAdapter(TestBrowser adaptee) {
+ this.adaptee = adaptee;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ adaptee.jCopyButton_actionPerformed(e);
+ }
+}
+
-class Browser_jForwardButton_actionAdapter implements
java.awt.event.ActionListener {
- Browser adaptee;
+class TestBrowser_jForwardButton_actionAdapter implements
java.awt.event.ActionListener {
+ TestBrowser adaptee;
- Browser_jForwardButton_actionAdapter(Browser adaptee) {
+ TestBrowser_jForwardButton_actionAdapter(TestBrowser adaptee) {
this.adaptee = adaptee;
}
@@ -341,10 +391,10 @@
}
-class Browser_jRefreshButton_actionAdapter implements
java.awt.event.ActionListener {
- Browser adaptee;
+class TestBrowser_jRefreshButton_actionAdapter implements
java.awt.event.ActionListener {
+ TestBrowser adaptee;
- Browser_jRefreshButton_actionAdapter(Browser adaptee) {
+ TestBrowser_jRefreshButton_actionAdapter(TestBrowser adaptee) {
this.adaptee = adaptee;
}
@@ -354,10 +404,10 @@
}
-class Browser_jStopButton_actionAdapter implements
java.awt.event.ActionListener {
- Browser adaptee;
+class TestBrowser_jStopButton_actionAdapter implements
java.awt.event.ActionListener {
+ TestBrowser adaptee;
- Browser_jStopButton_actionAdapter(Browser adaptee) {
+ TestBrowser_jStopButton_actionAdapter(TestBrowser adaptee) {
this.adaptee = adaptee;
}
@@ -367,10 +417,10 @@
}
-class Browser_jGoButton_actionAdapter implements
java.awt.event.ActionListener {
- Browser adaptee;
+class TestBrowser_jGoButton_actionAdapter implements
java.awt.event.ActionListener {
+ TestBrowser adaptee;
- Browser_jGoButton_actionAdapter(Browser adaptee) {
+ TestBrowser_jGoButton_actionAdapter(TestBrowser adaptee) {
this.adaptee = adaptee;
}
A test/manual/src/classes/org/mozilla/webclient/test/MyStatusBar.java
A test/manual/src/classes/org/mozilla/webclient/test/TestBrowser.java
A test/manual/src/classes/org/mozilla/webclient/test/images/Back.png
A test/manual/src/classes/org/mozilla/webclient/test/images/Forward.png
A test/manual/src/classes/org/mozilla/webclient/test/images/Reload.png
A test/manual/src/classes/org/mozilla/webclient/test/images/Right.gif
A test/manual/src/classes/org/mozilla/webclient/test/images/Stop.png
- copy the Browser test from the java.net JDIC project and modify it
to
run with webclient.
M build-tests.xml
M build.xml
- add run.test.browser target.
M classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java
M src_moz/CurrentPageImpl.cpp
M src_moz/EmbedWindow.cpp
M src_moz/EmbedWindow.h
- implement CopyCurrentSelectionToSystemClipboard(). It doesn't work
yet though. Have to investigate.
"Ed Burns" <edb...@yahoo.com> wrote in message
news:bbf0af98.04062...@posting.google.com...
Hi Jason, everyone,
Sorry for the delay. The day job has been very busy.
I'm working with the build meister on mozilla.org to freshen up the
Webclient CVS module so you can check it out directly from source, but
in the meantime, I've put a tarball up at
http://www.mozilla.org/projects/blackwood/webclient/src/20040801-webclient_2_0_a1_src.tar.gz
It should be available by 7pm EDT today,
I've also checked in the following patch from an eagle eyed observer
named Michael.
M webclient/src_moz/HistoryImpl.cpp
- Incorrectly passing jboolean to mozilla methods, pass PRBool
instead.
Next steps will be to do a real source release, complete with build
instructions!
Ed
I've tagged the current state of the code as WEBCLIENT_2_0_A_1_20040803.
I've updated the releasenotes and build instructions, please see
<http://www.mozilla.org/projects/blackwood/webclient/#Status>.
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().
If I may ask, what are the priorities for further resurrection of
Webclient functionality based on Mozilla 1.6? In particular, I am
interested in a URL load listener with a veto capability (it's
available in JDIC).
The next major feature I would be looking for is doing HTTP from Java
through the browser, preferably including threading support. This
means replacing the HTTP protocol handler in Java, as far as I
understand. The use case is SOAP requests from Java code to a site
that I also browse in the embedded browser -- I want to avoid double
authentication for the browser and for Java, and have the browser deal
with HTTPS for me. Is that planned at all? The Java side is more or
less straightforward, the browser side is what needs know-how.
I would also like to be able to dynamically add an element to the DOM
tree of all loaded pages (after the page loads, but before the onLoad
JS code starts executing), which the page's JS code may invoke like a
JS function, but it would actually end up invoking my Java code. I can
do that in C++ with Mozilla and IE, and I hacked JDIC to do it for
Mozilla, though on a very low level in C++, because JDIC has no DOM
access in Java. Will it be possible with Webclient?
I am looking into these specific features in order to determine
whether Webclient is a viable solution for our company's next
product's architecture. The release timeframe is about a year or so
from now.
Technology-wise, I prefer Webclient over JDIC, because WC does not
depend on Gnome and concentrates on the web browser only, and that's
an advantage when considering a port to HP-UX and the like. Webclient
also seems more powerful and flexible in the DOM area, though I
haven't tried the DOM APIs yet. OTOH, JDIC right now is a bit more
stable, and it has official backing from Sun -- it even had its own
booth at JavaOne. IMHO Webclient ideas look better, but if several
full time Sun developers work on JDIC with formal support from the
AWT/Swing team, vs. a couple of people on spare time on Webclient,
then in a year JDIC is likely to be in a much better shape and work
well on Tiger. So I'm still undecided, I guess I will keep hacking at
both and see what happens.
MK> Filed a few bugs on Bugzilla, all reproducible on TestBrowser app,
MK> sometimes with a slight modification.
Hello Michael. Thanks for filing those bugs. Your participation is
MK> much needed.
MK> If I may ask, what are the priorities for further resurrection of
MK> Webclient functionality based on Mozilla 1.6? In particular, I am
MK> interested in a URL load listener with a veto capability (it's
MK> available in JDIC).
Ok, now that the minimum features have been implemented, it's time to
move on to resurrecting the rest of the API. However, before doing so,
I want to add a feature that I've been wanting to add for a very long
time: HTTP Header access. I propose adding the following methods to the
CurrentPage2 interface:
public Map getRequestHeaders();
public Map getResponseHeaders();
In mozilla, this will be implemented via the nsIHttpHeaderVisitor
feature offered on nsIHttpChannel.
Once I have that done and working, I want to focus on stability. I'd
really like to get it working on GNU/Linux again, but I haven't had time
to do that. Can anyone help in that area? I would really appreciate
it.
MK> The next major feature I would be looking for is doing HTTP from
MK> Java through the browser, preferably including threading
MK> support. This means replacing the HTTP protocol handler in Java, as
MK> far as I understand. The use case is SOAP requests from Java code to
MK> a site that I also browse in the embedded browser -- I want to avoid
MK> double authentication for the browser and for Java, and have the
MK> browser deal with HTTPS for me. Is that planned at all? The Java
MK> side is more or less straightforward, the browser side is what needs
MK> know-how.
That's a good idea. I remember back a long time ago (1999!) talking to
Warren Harris about this idea, but I never followed up on it. I really
like the idea of webclient being attractive to web services
applications.
I've filed <http://bugzilla.mozilla.org/show_bug.cgi?id=257858> on this.
MK> I would also like to be able to dynamically add an element to the
MK> DOM tree of all loaded pages (after the page loads, but before the
MK> onLoad JS code starts executing), which the page's JS code may
MK> invoke like a JS function, but it would actually end up invoking my
MK> Java code. I can do that in C++ with Mozilla and IE, and I hacked
MK> JDIC to do it for Mozilla, though on a very low level in C++,
MK> because JDIC has no DOM access in Java. Will it be possible with
MK> Webclient?
It used to be possible to add elements to the DOM tree in Webclient 1.0.
The dome viewer UI allowed this behavior. I ultimately plan to
resurrect the entire set of old behavior.
MK> I am looking into these specific features in order to determine
MK> whether Webclient is a viable solution for our company's next
MK> product's architecture. The release timeframe is about a year or so
MK> from now.
MK> Technology-wise, I prefer Webclient over JDIC, because WC does not
MK> depend on Gnome and concentrates on the web browser only, and that's
MK> an advantage when considering a port to HP-UX and the
MK> like. Webclient also seems more powerful and flexible in the DOM
MK> area, though I haven't tried the DOM APIs yet. OTOH, JDIC right now
MK> is a bit more stable, and it has official backing from Sun -- it
MK> even had its own booth at JavaOne. IMHO Webclient ideas look better,
MK> but if several full time Sun developers work on JDIC with formal
MK> support from the AWT/Swing team, vs. a couple of people on spare
MK> time on Webclient, then in a year JDIC is likely to be in a much
MK> better shape and work well on Tiger. So I'm still undecided, I guess
MK> I will keep hacking at both and see what happens.
Yes, you'll have to make the call. I'm only able to work on Webclient
as a part time project.
Ed
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.
Next step: specify the API for header discovery, including the frames
usecase.
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.
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.
I just returned from vacation and will be continuing to implement this week.
Ed
Message-ID: <bbf0af98.0409...@posting.google.com>
I've kicked off a 1.7 build and now it's time for bed.
Ed
Next step is to get mozilla 1.7 building on my machine, then get
webclient to compile with it, then do a 2.0a2 release.
M build.xml
- incorporate re-added dist directory
A dist/build.xml
- create a binary distribution
A dist/webclient-dist.xml
- build.xml file for the test browser in the distribution
M dom/jni/javaDOMEventsGlobals.cpp
- use nsString.get() instead of nsString.GetBufferHandle()
M webclient/src_moz/NavigationActionEvents.cpp
- don't use ctor initializer for nsString
M webclient/src_moz/ns_util.cpp
- nsString2.h is gone.
M webclient/src_moz/PreferencesImpl.cpp
- Looks like in mozilla 1.7, the nsDataHashtable class no longer takes
pointers to garbage. This is good practice anyway and helped me find
a bug. Thanks to whomever fixed it.
Please visit <http://www.mozilla.org/projects/blackwood/webclient/> to
download and try it.
Next step will be to implement the request header sniffer feature.
Ed
Actually, customers have reported that this dist doesn't work. Upon
investigation I agree. The problem stems from the layout of files on
disk in the mozilla suite installer and my build script not taking that
into account. Some things end up in
%HOMEDRIVE%\PROGRA~\COMMON~1\mozilla.org\Mozilla, some things end up in
the place you choose in the installer.
So, the next step will be to get this working with a stock 1.7 download
install, rather than the one I built myself.
Ed
1. When you get a random rv failure, such as this:
gBookmarks = do_GetService(NS_BOOKMARKS_SERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
printf("debug: edburns: can't get bookmarks service: rv: 0x%08X\n",
rv);
fflush(stdout);
it helps to print it out in hex, as I've done above (thanks to
dbaron). Once you do that, and run it, you see:
debug: edburns: can't get bookmarks service: rv: 0x80040154
Then, you can look at the source of
<http://viper.haque.net/~timeless/nsError.js> and discover that this is:
const NS_ERROR_FACTORY_NOT_REGISTERED = ( 0x80040154);
Which makes sense, since this appears to be a problem with the
bookmarks service, and we know that bookmarks isn't a part of the GRE.
2. Even on an optimized build, you can still see what libraries are
loaded. Delete all occurrences of compreg.dat in your system.
You'll probably have two, one in your mozilla install dir, and one in
your GRE install dir. For me, that's
D:\Files_2k\mozilla.org\Mozilla\components\compreg.dat
E:\PROGRA~1\COMMON~1\mozilla.org\GRE\1.7_2004061609\components\compreg.dat
Set logging like this:
NSPR_LOG_FILE=logfile.txt
NSPR_LOG_MODULES=all:5
Then cd to your mozilla install dir and run .\mozilla.exe. This will
re-generate compreg.dat, and print out useful information on what
libraries are loaded.
Save logfile.txt aside, then run your embedding app. This will tell
you what libs are loaded by your embedding app.
My next step will be to gracefully remove bookmarks from being loaded by
webclient and then generate another binary so people can at least get
started. In parallel, I'll ask the embedding people what I can do to
use bookmarks from an embedding app.
Thanks for your patience,
Ed
I have done a new release and called it 2.0 alpha 2 b. This one does
indeed run with the mozilla suite installation, but still has some
problems.
1. no bookmarks
2. scrollbars disappear
3. I observed it freezing up after a while.
I'm going to address these problems with the mozilla embedding people.
Please see <http://www.mozilla.org/projects/blackwood/webclient/#Status>
for links and details.
Ed
SECTION: Changes
M dist/build.xml
- rename release to 2_0_a2b
- made the test run from the mozilla suite installation directory
- clean out the generated batch file or sh file.
M dist/webclient-dist.xml
- made the build.xml generate a batch file, that sets the proper env
vars, then calls back to this build.xml and executes the
run.test.browser target.
M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java
- don't pull in Bookmarks, since it's not in the GRE.
SECTION: Diffs
Index: dist/build.xml
===================================================================
RCS file: /cvsroot/mozilla/java/dist/build.xml,v
retrieving revision 1.4
diff -u -r1.4 build.xml
--- dist/build.xml 15 Oct 2004 16:39:07 -0000 1.4
+++ dist/build.xml 18 Oct 2004 14:03:36 -0000
@@ -30,7 +30,7 @@
<property name="Name" value="webclient"/>
<property name="name" value="webclient"/>
- <property name="version" value="2_0_a2"/>
+ <property name="version" value="2_0_a2b"/>
<!-- ************ Per user local properties
******************************* -->
@@ -136,9 +136,13 @@
</zip>
</target>
- <target name="test.dist" depends="prepare,clean.dev.build">
-
+ <target name="unzip.dist" depends="prepare">
<unzip dest="${moz.install.dir}"
src="${dist.home}/${name}_${version}_${platform}.zip" />
+ </target>
+
+ <target name="test.dist" depends="prepare">
+
+ <antcall target="unzip.dist" />
<ant inheritAll="false" dir="${moz.install.dir}"/>
@@ -149,6 +153,8 @@
<target name="clean.test.dist" depends="props">
<delete file="${moz.install.dir}/build.xml" />
+ <delete file="${moz.install.dir}/runwc.bat" />
+ <delete file="${moz.install.dir}/runwc.sh" />
<delete file="${moz.install.dir}/components/${so.prefix}javadom.${so.extension}"
/>
<delete file="${moz.install.dir}/${so.prefix}javadomjni.${so.extension}"
/>
<delete file="${moz.install.dir}/${so.prefix}${name}.${so.extension}"
/>
Index: dist/webclient-dist.xml
===================================================================
RCS file: /cvsroot/mozilla/java/dist/webclient-dist.xml,v
retrieving revision 1.2
diff -u -r1.2 webclient-dist.xml
--- dist/webclient-dist.xml 15 Oct 2004 16:39:07 -0000 1.2
+++ dist/webclient-dist.xml 18 Oct 2004 14:03:36 -0000
@@ -3,6 +3,20 @@
<property environment="myenv" />
<target name="props">
+ <condition property="is.win32" value="true">
+ <and>
+ <os family="windows" />
+ </and>
+ </condition>
+
+ <condition property="is.unix" value="true">
+ <and>
+ <os family="unix" />
+ </and>
+ </condition>
+
+
+
<condition property="PATH_SEP" value=";">
<and>
<os family="windows" />
@@ -55,7 +69,31 @@
</target>
- <target name="main" depends="props">
+ <target name="main" depends="main.win32,main.unix"/>
+
+ <target name="main.win32" depends="props" if="is.win32">
+
+ <delete file="${basedir}/runwc.bat" />
+ <echo file="${basedir}/runwc.bat">
+SET PATH=${java.libpath};%PATH%
+SET NSPR_LOG_MODULES=webclient:4,webclientstub:4
+SET NSPR_LOG_FILE=webclient.log
+ant run.test.browser
+ </echo>
+ <exec command=".\runwc.bat" newenvironment="true" />
+
+ </target>
+
+ <target name="main.unix" depends="props" if="is.unix">
+
+ <delete file="${basedir}/runwc.sh" />
+ <echo file="${basedir}/runwc.sh">
+ </echo>
+
+ </target>
+
+
+ <target name="run.test.browser" depends="props">
<java newenvironment="true"
classname="org.mozilla.webclient.test.TestBrowser"
Index: webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java
===================================================================
RCS file: /cvsroot/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java,v
retrieving revision 1.8
diff -u -r1.8 WrapperFactoryImpl.java
--- webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java 17
Jun 2004 21:27:55 -0000 1.8
+++ webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java 18
Oct 2004 14:03:37 -0000
@@ -316,7 +316,8 @@
((Service)WrapperFactoryImpl.this.profileManager).startup();
((Service)WrapperFactoryImpl.this.prefs).startup();
- ((Service)WrapperFactoryImpl.this.bookmarks).startup();
+ // PENDING(edburns): see Message-ID:
<bbf0af98.04101...@posting.google.com> on n.p.m.java
+ // ((Service)WrapperFactoryImpl.this.bookmarks).startup();
WrapperFactoryImpl.this.nativeAppSetup(nativeWrapperFactory);
return null;
Now I can go back to where I was on 20041009, when my next step was to
implement the request header sniffer feature.
M dist/build.xml
M dist/webclient-dist.xml
M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java
- rollback 2.0 alpha b changes. Thanks to Annie Lau.
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.
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.
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.
M webclient/test/automated/src/classes/org/mozilla/webclient/MouseListenerTest.java
- at least make sure that all the events do occcur
BrowserControlFactory.setProfile(startupProfile);
BrowserControlFactory.setAppData(getBrowserBinDir());
This will cause the startupProfile to be created (if necessary) and
used
as webclient's mozilla profile. If not specified, a "webclient"
profile
is created and used. This profile sticks around on your system.
SECTION: CHANGES
M classes_spec/org/mozilla/webclient/BrowserControlFactory.java
M classes_spec/org/mozilla/webclient/WebclientFactory.java
M classes_spec/org/mozilla/webclient/impl/WebclientFactoryImpl.java
- add setProfile().
M classes_spec/org/mozilla/webclient/impl/WrapperFactory.java
M classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java
- add setProfile() and getProfile().
M classes_spec/org/mozilla/webclient/impl/wrapper_native/ProfileManagerImpl.java
- pass the wrapperFactory's profile property to the nativeStartup().
M src_moz/ProfileManagerImpl.cpp
- logic to implement above changes
M test/automated/src/classes/org/mozilla/webclient/ProfileManagerTest.java
- test that the startupProfile feature works.
SECTION: Diffs
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.10
diff -u -r1.10 BrowserControlFactory.java
--- classes_spec/org/mozilla/webclient/BrowserControlFactory.java 1
Apr 2004 14:54:56 -0000 1.10
+++ classes_spec/org/mozilla/webclient/BrowserControlFactory.java 5
Nov 2004 06:27:37 -0000
@@ -74,6 +74,11 @@
// Class methods
//
+public static void setProfile(String profileName)
+{
+ getInstance().setProfile(profileName);
+}
+
/**
*
* <p>Initialize the webclient API passing in the path to the browser
Index: classes_spec/org/mozilla/webclient/WebclientFactory.java
===================================================================
RCS file: /cvsroot/mozilla/java/webclient/classes_spec/org/mozilla/webclient/WebclientFactory.java,v
retrieving revision 1.3
diff -u -r1.3 WebclientFactory.java
--- classes_spec/org/mozilla/webclient/WebclientFactory.java 15 Apr
2004 22:58:06 -0000 1.3
+++ classes_spec/org/mozilla/webclient/WebclientFactory.java 5 Nov
2004 06:27:39 -0000
@@ -55,6 +55,14 @@
public void setAppData(String absolutePathToNativeBrowserBinDir)
throws FileNotFoundException, ClassNotFoundException;
+ /**
+ * <p>if called before {@link setAppData}, this will cause the
+ * profile used for starting up the underlying browser to be set.
+ * If not called, the default will be "webclient"</p>
+ */
+
+ public void setProfile(String profileName);
+
public void appTerminate() throws Exception;
public BrowserControl newBrowserControl()
Index: classes_spec/org/mozilla/webclient/impl/WebclientFactoryImpl.java
===================================================================
RCS file: /cvsroot/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/WebclientFactoryImpl.java,v
retrieving revision 1.2
diff -u -r1.2 WebclientFactoryImpl.java
--- classes_spec/org/mozilla/webclient/impl/WebclientFactoryImpl.java 15
Apr 2004 22:58:06 -0000 1.2
+++ classes_spec/org/mozilla/webclient/impl/WebclientFactoryImpl.java 5
Nov 2004 06:27:39 -0000
@@ -84,6 +84,11 @@
// Public methods
//
+
+public void setProfile(String profileName)
+{
+ getWrapperFactory().setProfile(profileName);
+}
public void setAppData(String absolutePathToNativeBrowserBinDir)
throws FileNotFoundException, ClassNotFoundException
{
Index: classes_spec/org/mozilla/webclient/impl/WrapperFactory.java
===================================================================
RCS file: /cvsroot/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/WrapperFactory.java,v
retrieving revision 1.5
diff -u -r1.5 WrapperFactory.java
--- classes_spec/org/mozilla/webclient/impl/WrapperFactory.java 17 Apr
2004 21:25:11 -0000 1.5
+++ classes_spec/org/mozilla/webclient/impl/WrapperFactory.java 5 Nov
2004 06:27:39 -0000
@@ -47,6 +47,9 @@
public Object newImpl(String interfaceName,
BrowserControl browserControl) throws
ClassNotFoundException;
+
+ public String getProfile();
+ public void setProfile(String profileName);
/**
*
Index: classes_spec/org/mozilla/webclient/impl/wrapper_native/ProfileManagerImpl.java
===================================================================
RCS file: /cvsroot/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/ProfileManagerImpl.java,v
retrieving revision 1.3
diff -u -r1.3 ProfileManagerImpl.java
--- classes_spec/org/mozilla/webclient/impl/wrapper_native/ProfileManagerImpl.java 17
Apr 2004 21:25:11 -0000 1.3
+++ classes_spec/org/mozilla/webclient/impl/wrapper_native/ProfileManagerImpl.java 5
Nov 2004 06:27:41 -0000
@@ -47,7 +47,8 @@
public void startup() {
Assert.assert_it(isNativeEventThread());
- nativeStartup(getWrapperFactory().getNativeWrapperFactory(),
null, null);
+ nativeStartup(getWrapperFactory().getNativeWrapperFactory(),
null,
+ getWrapperFactory().getProfile());
}
public void shutdown() {
Index: classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java
===================================================================
RCS file: /cvsroot/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java,v
retrieving revision 1.10
diff -u -r1.10 WrapperFactoryImpl.java
--- classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java 20
Oct 2004 02:16:16 -0000 1.10
+++ classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java 5
Nov 2004 06:27:43 -0000
@@ -85,6 +85,7 @@
// Attribute Instance Variables
protected String platformCanvasClassName = null;
+ protected String profileName = "webclient";
protected boolean initialized = false;
protected boolean terminated = false;
@@ -259,6 +260,14 @@
}
return result;
}
+
+ public void setProfile(String profileName) {
+ this.profileName = profileName;
+ }
+
+ public String getProfile() {
+ return profileName;
+ }
public void initialize(String verifiedBinDirAbsolutePath) throws
SecurityException, UnsatisfiedLinkError {
if (initialized) {
@@ -327,6 +336,8 @@
initialized = false;
System.out.println("WrapperFactoryImpl.initialize: Can't start
up singleton services: " + e + " " + e.getMessage());
}
+
+
}
public void verifyInitialized() throws IllegalStateException
Index: src_moz/ProfileManagerImpl.cpp
===================================================================
RCS file: /cvsroot/mozilla/java/webclient/src_moz/ProfileManagerImpl.cpp,v
retrieving revision 1.6
diff -u -r1.6 ProfileManagerImpl.cpp
--- src_moz/ProfileManagerImpl.cpp 15 Apr 2004 22:58:07 -0000 1.6
+++ src_moz/ProfileManagerImpl.cpp 5 Nov 2004 06:27:56 -0000
@@ -50,7 +50,7 @@
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_impl_wrapper_1native_ProfileManagerImpl_nativeStartup
(JNIEnv *env, jobject obj, jint nativeContext,
- jstring profileDir , jstring profileName)
+ jstring profileDir , jstring profileNameJstr)
{
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG,
("ProfileManagerImpl_nativeStartup: entering\n"));
@@ -71,43 +71,67 @@
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG,
("ProfileManagerImpl_nativeStartup: GetProfileCount rv:
%d\n",
rv));
-
+
+ PRUnichar *webclientProfile = nsnull;
+ char *webclientProfileCstr = nsnull;
+
+ if (nsnull == profileNameJstr) {
+ NS_NAMED_LITERAL_STRING(webclientStr, "webclient");
+ webclientProfile = (PRUnichar *) webclientStr.get();
+ webclientProfileCstr = "webclient";
+ }
+ else {
+ webclientProfile = (PRUnichar *)
+ ::util_GetStringChars(env, profileNameJstr);
+ webclientProfileCstr = (char *)
+ ::util_GetStringUTFChars(env, profileNameJstr);
+ }
+
char *argv[3];
- int i, argc = 0;
+ int i,j;
+ PRBool hasWebclientProfile = PR_FALSE;
argv[0] = PL_strdup(nsnull);
- if (numProfiles > 1) {
+ argv[1] = PL_strdup("-p");
+
+ if (0 < numProfiles) {
PRUnichar **Names;
PRUint32 NamesLen = 0;
rv = profile->GetProfileList(&NamesLen, &Names);
- argv[1] = PL_strdup("-p");
if (NS_SUCCEEDED(rv)) {
PR_ASSERT(NamesLen >= 1);
- // PENDING(edburns): fix for 70656. Really we should
have a way
- // for the embedding app to specify which profile to use.
- // For now we just get the name of the first profile.
- char * temp = new char[100]; // de-allocated in following
for loop
- for (i = 0; Names[0][i] != '\0'; i++) {
- temp[i] = (char) Names[0][i];
+
+ char * temp = new char[100]; // de-allocated following
for loop
+ for (i = 0; i < NamesLen; i++) {
+ for (j = 0; Names[i][j] != '\0'; j++) {
+ temp[j] = (char) Names[i][j];
+ }
+ temp[j] = '\0';
+ if (0 == strcmp(webclientProfileCstr, temp)) {
+ hasWebclientProfile = PR_TRUE;
+ break;
+ }
}
nsMemory::Free(Names);
- temp[i] = '\0';
- argv[2] = temp;
- argc = 3;
}
- else {
- argv[2] = PL_strdup("default");
- }
+ argv[2] = PL_strdup(webclientProfileCstr);
}
- else {
- argc = 1;
+
+ if (!hasWebclientProfile) {
+ rv = profile->CreateNewProfile(webclientProfile, nsnull,
nsnull,
+ PR_FALSE);
+ if (NS_FAILED(rv)) {
+ ::util_ThrowExceptionToJava(env, "Can't statrup
nsIProfile service.");
+ return;
+ }
}
- rv = cmdLine->Initialize(argc, argv);
+
+ rv = cmdLine->Initialize(3, argv);
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG,
("ProfileManagerImpl_nativeStartup: commandLineService
initialize rv: %d\n",
rv));
- for (i = 0; i < argc; i++) {
+ for (i = 0; i < 3; i++) {
nsCRT::free(argv[i]);
}
if (NS_FAILED(rv)) {
@@ -130,7 +154,14 @@
::util_ThrowExceptionToJava(env, "Can't statrup nsIProfile
service.");
return;
}
-
+
+ // only release if we allocated
+ if (nsnull != profileNameJstr) {
+ ::util_ReleaseStringChars(env, profileNameJstr,
webclientProfile);
+ ::util_ReleaseStringUTFChars(env, profileNameJstr,
+ webclientProfileCstr);
+ }
+
wcContext->sProfile = profile.get();
NS_ADDREF(wcContext->sProfile);
wcContext->sProfileInternal = profileInt.get();
Index: test/automated/src/classes/org/mozilla/webclient/ProfileManagerTest.java
===================================================================
RCS file: /cvsroot/mozilla/java/webclient/test/automated/src/classes/org/mozilla/webclient/ProfileManagerTest.java,v
retrieving revision 1.2
diff -u -r1.2 ProfileManagerTest.java
--- test/automated/src/classes/org/mozilla/webclient/ProfileManagerTest.java 26
Feb 2004 04:21:24 -0000 1.2
+++ test/automated/src/classes/org/mozilla/webclient/ProfileManagerTest.java 5
Nov 2004 06:28:08 -0000
@@ -50,9 +50,11 @@
i = 0,
len = 0;
final String
+ startupProfile = "testStartupProfile",
name = "testProfile",
newName = "testProfile2";
BrowserControl firstBrowserControl = null;
+ BrowserControlFactory.setProfile(startupProfile);
BrowserControlFactory.setAppData(getBrowserBinDir());
firstBrowserControl = BrowserControlFactory.newBrowserControl();
assertNotNull(firstBrowserControl);
@@ -61,6 +63,8 @@
ProfileManager profileManager = (ProfileManager)
firstBrowserControl.queryInterface(BrowserControl.PROFILE_MANAGER_NAME);
assertNotNull(profileManager);
+
+ assertEquals(startupProfile, profileManager.getCurrentProfile());
// create a new profile
profileManager.createNewProfile(name, null, null, false);
@@ -75,6 +79,9 @@
// test that we can set the current profile to the new profile
profileManager.setCurrentProfile(name);
+ // delete the startupProfile
+ profileManager.deleteProfile(startupProfile, true);
+
// test that the current profile is the new profile
String currentProfile = profileManager.getCurrentProfile();
assertTrue(currentProfile.equals(name));
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.8
diff -u -r1.8 WebclientTestCase.java
--- test/automated/src/classes/org/mozilla/webclient/WebclientTestCase.java 3
Sep 2004 19:04:22 -0000 1.8
+++ test/automated/src/classes/org/mozilla/webclient/WebclientTestCase.java 5
Nov 2004 06:28:09 -0000
@@ -108,6 +108,11 @@
verifyPreconditions();
}
+public void tearDown()
+{
+
+}
+
//
// General Methods
//
This check-in fixes a long standing problem of not being able to use any
keyboard controls on the embedded browser. Next step is to re-activate
the keyboard listener features.
M webclient/src_moz/EmbedProgress.cpp
- call TopLevelFocusIn to make sure we get the input focus
M webclient/src_moz/NativeBrowserControl.cpp
M webclient/src_moz/NativeBrowserControl.h
- copy TopLevelFocus{In,Out}() from EmbedPrivate.
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.
This correctly implements the keyListener logic. I had the mapping
between mozilla concepts and java concepts wrong before. The correct
mapping is:
Mozilla concept Java concept
KeyDown keyPressed
KeyUp keyReleased
KeyPress keyTyped
KeyCode keyCode
CharCode keyChar
M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java
- Force the keyCode to be VK_UNDEFINED if this is a KEY_TYPED event.
- For security, log any exceptions thrown during ctor of KeyEvent.
M webclient/src_moz/EmbedEventListener.cpp
- remove unused automatic vars.
M webclient/src_moz/NavigationImpl.cpp
- roll back change done by Brian Ryner, since it doesn't make sense
under mozilla 1.7.
M webclient/src_share/jni_util.cpp
- reverse mapping of CHAR_CODE and KEY_CODE to their java
counterparts.
M webclient/test/automated/src/classes/org/mozilla/webclient/KeyListenerTest.java
- Add in some code to make it easier to run this testcase in a manual
fashion.
>M webclient/src_share/jni_util.cpp
>
>- reverse mapping of CHAR_CODE and KEY_CODE to their java counterparts.
>
>
Out of interest which codes need to be mapped?
--
Warning: May contain traces of nuts.
Neil wrote:
N> Ed Burns wrote:
EB> M webclient/src_share/jni_util.cpp
EB>
EB> - reverse mapping of CHAR_CODE and KEY_CODE to their java
counterparts.
N> Out of interest which codes need to be mapped?
The correct mapping is:
nsIDOMKeyEvent->GetCharCode() maps to java.KeyEvent.getKeyChar()
nsIDOMKeyEvent->GetKeyCode() maps to java.KeyEvent.getKeyCode()
I had these reversed before.
Ed
Neil wrote:
N> Ed Burns wrote:
EB> M webclient/src_share/jni_util.cpp
EB>
EB> - reverse mapping of CHAR_CODE and KEY_CODE to their java
counterparts.
N> Out of interest which codes need to be mapped?
Ed
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.
+ */
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
- verify that the window opened via the NewWindowListener interface
contains the expected content. Next step is to work on a cookie bug
reported by a user.
I have released 2.0 alpha 3 of webclient. One can download it from
<http://www.mozilla.org/projects/blackwood/webclient/>.
New Features for this Release
Request header sniffing. See
http://lxr.mozilla.org/mozilla/source/java/webclient/test/manual/src/classes/org/mozilla/webclient/test/TestBrowser.java
for an example.
Support for java.awt.MouseListener. See
http://lxr.mozilla.org/mozilla/source/java/webclient/test/automated/src/classes/org/mozilla/webclient/MouseListenerTest.java
for an example.
Make webclient use its own prefs file. This enables one to run
webclient and mozilla at the same time.
Fix focus problem where you couldn't type in text fields.
Support for java.awt.KeyListener. See
http://lxr.mozilla.org/mozilla/source/java/webclient/test/automated/src/classes/org/mozilla/webclient/KeyListenerTest.java
for an example.
Support for NewWindowListener. This makes it possible to
correctly
handle cases where the browser requests a new window. See
http://lxr.mozilla.org/mozilla/source/java/webclient/test/automated/src/classes/org/mozilla/webclient/WindowCreatorTest.java
for an example.
Ed
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.
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()
M src_moz/CurrentPageImpl.cpp
M test/automated/src/classes/org/mozilla/webclient/CurrentPageTest.java
A test/automated/src/test/FindTest0.html
- fodder for find
M src_moz/CurrentPageImpl.cpp
- copy content from CurrentPageActionEvents
M test/automated/src/classes/org/mozilla/webclient/CurrentPageTest.java
- basic test. Needs more robustness.
Next step will be to add more tests.
M classes_spec/org/mozilla/webclient/CurrentPage2.java
- add find and findNext methods which return boolean.
M
classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java
- implement these methods
M src_moz/CurrentPageImpl.cpp
- change native methods to accomodate
M test/automated/src/classes/org/mozilla/webclient/CurrentPageTest.java
- minimal test of new content.
test/automated/src/classes/org/mozilla/webclient/CurrentPageTest.java
- flesh out this test.
Next step is to try to re-enable the printing APIs. Not sure if this
will work.
A test/automated/src/test/DOMSelectionTest.html
- test CurrentPage.highlightSelection and clearAllSelections().
M
classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java
- send all native methods through the event thread
M
classes_spec/org/mozilla/webclient/impl/wrapper_native/SelectionImpl.java
- never return null from toString(). Return "" instead.
M src_moz/CurrentPageImpl.cpp
- copy from CurrentPageActionEvents.cpp
M test/automated/src/classes/org/mozilla/webclient/CurrentPageTest.java
M test/automated/src/classes/org/mozilla/webclient/DOMTest.java
- new test conent
Next step is to take a step back and see what's best to do next!
M
classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java
- call through to print related methods
M src_moz/CurrentPageImpl.cpp
- Copy from CurrentPageActionEvents.cpp
M test/automated/src/classes/org/mozilla/webclient/CurrentPageTest.java
- add test stub for print preview.
Please see
<http://lxr.mozilla.org/mozilla/source/java/webclient/test/automated/src/classes/org/mozilla/webclient/DocumentLoadListenerTest.java>
for a usage example.
A
classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeInputStream.java
A src_moz/NativeInputStreamImpl.cpp
- Class to enable reading the post body from the request.
M build.xml
- add NativeInputStream to JNI generation
M classes_spec/org/mozilla/webclient/PageInfoListener.java
* <p>This {@link DocumentLoadListener} subclass adds the ability to
get
* detailed information on each event. </p>
*
* <p>The <code>eventData</code> property of the
* <code>DocumentLoadEvent</code> instance will be a
* <code>java.util.Map</code>. The following entries may be present in
* this map for the following <code>*_EVENT_MASK</code> types in
* <code>DocumentLoadEvent</code>.</p>
*
* <dl>
*
* <dt>For all <code>*_EVENT_MASK</code> types</dt>
*
* <dd><p>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></dd>
*
* <dt>For <code>START_URL_LOAD</code> type</dt>
*
* <dd><p>The map will contain an entry under the key
* "<code>method</code>" without the quotes. This will be the request
* method for this event. The map will also contain an entry under the
* key "<code>headers</code>". This entry will be a
* <code>java.util.Map</code> of all the request headers.</p></dd>
*
* <dt>For <code>END_URL_LOAD</code> type</dt>
*
* <dd><p>The map will contain an entry under the key
* "<code>method</code>" without the quotes. This will be the request
* method for this event. The map will contain an entry under the key
* "<code>status</code>" without the quotes. This will be the response
* status string from the server, such as "<code>200 OK</code>". The
* map will also contain an entry under the key "<code>headers</code>".
* This entry will be a <code>java.util.Map</code> of all the response
* headers.</p></dd>
*
* </dl>
M src_moz/EmbedProgress.cpp
- leverage nsIHttpChannel methods to get request method, response
status, and post body.
M src_moz/Makefile.in
- add NativeInputStream
M src_share/jni_util.cpp
M src_share/jni_util.h
- new constants
- add variant of ThrowExceptionToJava that takes the exception class
name.
M
test/automated/src/classes/org/mozilla/webclient/DocumentLoadListenerTest.java
- new test content. Post related content commented out.
Ed
Next step is to clean up the javadocs.
A webclient/test/automated/src/test/DocumentLoadListenerTest0.html
M webclient/src_moz/EmbedProgress.cpp
M webclient/test/automated/src/classes/org/mozilla/util/THTTPD.java
M
webclient/test/automated/src/classes/org/mozilla/webclient/DocumentLoadListenerTest.java
Next step is to continue the refresh of the javadocs.
A dom/classes/org/mozilla/dom/package.html
A dom/classes/org/mozilla/dom/util/package.html
A util/classes/org/mozilla/util/package.html
A webclient/classes_spec/org/mozilla/webclient/overview.html
A webclient/classes_spec/org/mozilla/webclient/package.html
M dist/build.xml
M util/classes/org/mozilla/util/Debug.java
M util/classes/org/mozilla/util/Log.java
M util/classes/org/mozilla/util/Range.java
M util/classes/org/mozilla/util/Utilities.java
M webclient/classes_spec/org/mozilla/webclient/BrowserControl.java
M
webclient/classes_spec/org/mozilla/webclient/BrowserControlFactory.java
M webclient/classes_spec/org/mozilla/webclient/ImplObject.java
M webclient/classes_spec/org/mozilla/webclient/Navigation2.java
M webclient/classes_spec/org/mozilla/webclient/WebclientFactory.java
M dom/classes/org/mozilla/dom/events/MouseEventImpl.java
- Changes to allow generation of javadocs from full tree.
M webclient/classes_spec/org/mozilla/webclient/BookmarkEntry.java
M webclient/classes_spec/org/mozilla/webclient/Bookmarks.java
M
webclient/classes_spec/org/mozilla/webclient/BrowserControlFactory.java
M webclient/classes_spec/org/mozilla/webclient/CurrentPage.java
M webclient/classes_spec/org/mozilla/webclient/CurrentPage2.java
M webclient/classes_spec/org/mozilla/webclient/DocumentLoadEvent.java
M
webclient/classes_spec/org/mozilla/webclient/DocumentLoadListener.java
M webclient/classes_spec/org/mozilla/webclient/NewWindowListener.java
M webclient/classes_spec/org/mozilla/webclient/WebclientEvent.java
M
webclient/classes_spec/org/mozilla/webclient/WebclientEventListener.java
M webclient/classes_spec/org/mozilla/webclient/WebclientFactory.java
M webclient/classes_spec/org/mozilla/webclient/overview.html
M webclient/classes_spec/org/mozilla/webclient/package.html
At first, I tried to see if the nsIHttpChannel instance I get handed in
my EmbedProgress class can be QI'd to an nsIViewSourceChannel. No luck
there. Then I searched n.p.m.embedding and found people there had some
success with the DOM approach, where you get the DOM, massage it to get
an nsIDOMNSHTMLElement instance, then access its innerHTML property.
Look at mozilla\dist\include\dom\nsIDOMNSHTMLElement.h
NS_IMETHOD GetInnerHTML(nsAString & aInnerHTML) = 0;
this is the approach I think I'll try.
Ed
>Instead of doing the javadoc tonight, I wanted to do some code and decided to fix the CurrentPage.getSource() to actually show the source shown by the browser, instead of using java.net classes to re-fetch the top-level URL.
>
>
Does the Webclient not have a cache?
This checkin re-implements CurrentPage.getSource(). It doesn't
preserve
the whitespace formatting of the current page, which is a big problem.
Next step is to get the DOMViewer working with the TestBrowser.
M build.xml
- exclude test from the default build
A classes_spec/org/mozilla/webclient/impl/DOMTreeDumper.java
- Copy this over from test.
M
classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java
- leverage DOMTreeDumper to print the current source.
M test/automated/src/classes/org/mozilla/webclient/CurrentPageTest.java
A test/automated/src/test/ViewSourceTest.html
- exercise new methods.
>No, it doesn't have a cache of its own. It relies on the underlying browser's cache.
>
>
OK, so I've not been following this project properly. In Mozilla, you
have objects called page loaders (don't ask me how the c++ guts work
here) and you can ask one to load the source of a page that another one
is displaying.
Ed
Ed
M
classes_spec/org/mozilla/webclient/impl/wrapper_native/CurrentPageImpl.java
- rewrite getSource() to call native code, instead of using the DOM.
M src_moz/CurrentPageImpl.cpp
- re-enable nativeGetSource().
M src_moz/EmbedWindow.cpp
M src_moz/EmbedWindow.h
- fill out dtor
- add InitNoChrome.
M test/automated/src/classes/org/mozilla/webclient/CurrentPageTest.java
- comment out test
Thank you
Next step is to fix up the TestBrowser to show off this feature.
A src_moz/LoadCompleteProgressListener.cpp
A src_moz/LoadCompleteProgressListener.h
* Simple nsIWebProgressListener that offers a "loadComplete" property
* that can be queried to determine if the load has completed.
A
test/manual/src/classes/org/mozilla/webclient/test/DOMAccessPanel.java
A
test/manual/src/classes/org/mozilla/webclient/test/DOMCellRenderer.java
A test/manual/src/classes/org/mozilla/webclient/test/DOMTreeDumper.java
A test/manual/src/classes/org/mozilla/webclient/test/DOMTreeModel.java
A
test/manual/src/classes/org/mozilla/webclient/test/DOMTreeNotifier.java
A
test/manual/src/classes/org/mozilla/webclient/test/DOMViewerFrame.java
- move over from Old test browser. Produces some thread issues.
M src_moz/CurrentPageImpl.cpp
- Leverage LoadCompleteProgressListener to discover when it's safe to
call "selectAll" on the window.
M src_moz/Makefile.in
- add LoadCompleteProgressListener
M test/automated/src/classes/org/mozilla/webclient/CurrentPageTest.java
- re-enable GetSource test
M test/automated/src/test/ViewSourceTest.html
- re-edit for ease of comparison in CurrentPageTest
M test/manual/src/classes/org/mozilla/webclient/test/TestBrowser.java
- Hack: viewSource button. A menu would be better.
dyld:
/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home/bin/java
can't open library: @executable_path/libxpcom.dylib (No such file or
directory, errno = 2)
I read something somewhere that Java has trouble loading dependent
libraries under MacOSX so how can I fix this?
Any help would be greatly appreciated.
Ed
but I'm posting it here for the record. Any Mac experts out there,
I'd love to hear from you!
Ed
I have a problem with the implementation of
BrowserControlCanvas.getWindow():
I can't lock the JAWT_DrawingSurface.
lock = ds->Lock(ds);
returns null.
The Canvas is not visible at this time, this method is getting called
via a paint() method call.
Any ideas why lock would return null?
Ed