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

- 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.
This commit is contained in:
edburns%acm.org 2004-06-14 01:44:33 +00:00
parent e4885e8f40
commit 52b83f9d98
4 changed files with 276 additions and 173 deletions

View File

@ -66,6 +66,10 @@ public class EventRegistrationImpl extends ImplObjectNative implements EventRegi
private List documentLoadListeners; private List documentLoadListeners;
private BrowserToJavaEventPump eventPump = null;
private static int instanceCount = 0;
// //
// Constructors and Initializers // Constructors and Initializers
// //
@ -84,11 +88,14 @@ public EventRegistrationImpl(WrapperFactory yourFactory,
} }
documentLoadListeners = new ArrayList(); documentLoadListeners = new ArrayList();
eventPump = new BrowserToJavaEventPump(instanceCount++);
eventPump.start();
} }
public void delete() public void delete()
{ {
super.delete(); super.delete();
eventPump.stopRunning();
} }
// //
@ -235,12 +242,9 @@ void nativeEventOccurred(String targetClassName, long eventType,
ParameterCheck.nonNull(targetClassName); ParameterCheck.nonNull(targetClassName);
WebclientEvent event = null; WebclientEvent event = null;
WebclientEventListener curListener = null;
List listeners = null;
if (DocumentLoadListener.class.getName().equals(targetClassName)) { if (DocumentLoadListener.class.getName().equals(targetClassName)) {
event = new DocumentLoadEvent(this, eventType, eventData); event = new DocumentLoadEvent(this, eventType, eventData);
listeners = documentLoadListeners;
} }
else if (MouseListener.class.getName().equals(targetClassName)) { else if (MouseListener.class.getName().equals(targetClassName)) {
// We create a plain vanilla WebclientEvent, which the // We create a plain vanilla WebclientEvent, which the
@ -257,14 +261,87 @@ void nativeEventOccurred(String targetClassName, long eventType,
} }
// else... // else...
if (null != event && null != listeners) { eventPump.queueEvent(event);
Iterator iter = listeners.iterator(); eventPump.V();
while (iter.hasNext()) { }
curListener = (WebclientEventListener) iter.next();
curListener.eventDispatched(event); public class BrowserToJavaEventPump extends Thread {
private boolean keepRunning = false;
private List eventsToJava = null;
private int count = 0;
public BrowserToJavaEventPump(int instanceCount) {
super("BrowserToJavaEventPump-" + instanceCount);
eventsToJava = new ArrayList();
keepRunning = true;
}
//
// semaphore methods
//
public synchronized void P() {
while (count <= 0) {
try { wait(); } catch (InterruptedException ex) {}
}
--count;
}
public synchronized void V() {
++count;
notifyAll();
}
public void queueEvent(WebclientEvent toQueue) {
synchronized (eventsToJava) {
eventsToJava.add(toQueue);
} }
} }
} public void stopRunning() {
keepRunning = false;
}
public void run() {
WebclientEvent curEvent = null;
WebclientEventListener curListener = null;
List listeners = null;
while (keepRunning) {
P();
synchronized(eventsToJava) {
if (!eventsToJava.isEmpty()) {
curEvent = (WebclientEvent) eventsToJava.remove(0);
}
}
if (null == curEvent) {
continue;
}
if (curEvent instanceof DocumentLoadEvent) {
listeners = EventRegistrationImpl.this.documentLoadListeners;
}
// else...
if (null != curEvent && null != listeners) {
synchronized (listeners) {
Iterator iter = listeners.iterator();
while (iter.hasNext()) {
curListener = (WebclientEventListener) iter.next();
curListener.eventDispatched(curEvent);
}
}
}
}
System.out.println(this.getName() + " exiting");
}
} // end of class BrowserToJavaEventPump
} // end of class EventRegistrationImpl } // end of class EventRegistrationImpl

View File

@ -111,7 +111,7 @@ public class NativeEventThread extends Thread {
wait(); wait();
} }
catch (Exception e) { catch (Exception e) {
System.out.println("NativeEventThread.delete: interrupted while waiting\n\t for NativeEventThread to notify() after destruction of initContext: " + e + System.out.println("NativeEventThread.delete: interrupted while waiting\n\t for NativeEventThread to notifyAll() after destruction of initContext: " + e +
" " + e.getMessage()); " " + e.getMessage());
} }
} }
@ -142,10 +142,10 @@ public void run()
((Runnable)runnables.pop()).run(); ((Runnable)runnables.pop()).run();
synchronized (wrapperFactory) { synchronized (wrapperFactory) {
try { try {
wrapperFactory.notify(); wrapperFactory.notifyAll();
} }
catch (Exception e) { catch (Exception e) {
System.out.println("NativeEventThread.run: exception trying to send notify() to WrapperFactoryImpl on startup:" + e + " " + e.getMessage()); System.out.println("NativeEventThread.run: exception trying to send notifyAll() to WrapperFactoryImpl on startup:" + e + " " + e.getMessage());
} }
} }
@ -165,10 +165,10 @@ public void run()
// if we are have been told to delete ourselves // if we are have been told to delete ourselves
if (null == this.wrapperFactory) { if (null == this.wrapperFactory) {
try { try {
notify(); notifyAll();
} }
catch (Exception e) { catch (Exception e) {
System.out.println("NativeEventThread.run: Exception: trying to send notify() to this during delete: " + e + " " + e.getMessage()); System.out.println("NativeEventThread.run: Exception: trying to send notifyAll() to this during delete: " + e + " " + e.getMessage());
} }
return; return;
} }
@ -187,7 +187,7 @@ public void run()
} }
// notify the pushBlockingWCRunnable() method. // notify the pushBlockingWCRunnable() method.
try { try {
notify(); notifyAll();
} }
catch (Exception e) { catch (Exception e) {
System.out.println("NativeEventThread.run: Exception: trying to notify for blocking result:" + e + " " + e.getMessage()); System.out.println("NativeEventThread.run: Exception: trying to notify for blocking result:" + e + " " + e.getMessage());
@ -238,10 +238,10 @@ public void run()
e = new RuntimeException(blockingException); e = new RuntimeException(blockingException);
} }
try { try {
notify(); notifyAll();
} }
catch (Exception se) { catch (Exception se) {
System.out.println("NativeEventThread.pushBlockingWCRunnable: Exception: trying to send notify() to NativeEventThread: " + se + " " + se.getMessage()); System.out.println("NativeEventThread.pushBlockingWCRunnable: Exception: trying to send notifyAll() to NativeEventThread: " + se + " " + se.getMessage());
} }
} }
if (null != e) { if (null != e) {

View File

@ -40,7 +40,7 @@ EmbedProgress::EmbedProgress(void)
} }
EmbedProgress::~EmbedProgress() EmbedProgress::~EmbedProgress()
{ {
if (nsnull != mEventRegistration) { if (nsnull != mEventRegistration) {
JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION); JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION);
::util_DeleteGlobalRef(env, mEventRegistration); ::util_DeleteGlobalRef(env, mEventRegistration);
@ -93,91 +93,58 @@ EmbedProgress::OnStateChange(nsIWebProgress *aWebProgress,
nsXPIDLCString uriString; nsXPIDLCString uriString;
RequestToURIString(aRequest, getter_Copies(uriString)); RequestToURIString(aRequest, getter_Copies(uriString));
jstring uriJstr = ::util_NewStringUTF(env, (const char *) uriString); jstring uriJstr = ::util_NewStringUTF(env, (const char *) uriString);
nsString tmpString;
tmpString.AssignWithConversion(uriString);
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG, PR_LOG(prLogModuleInfo, PR_LOG_DEBUG,
("EmbedProgress::OnStateChange: URI: %s\n", ("EmbedProgress::OnStateChange: URI: %s\n",
(const char *) uriString)); (const char *) uriString));
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG, ("debug: edburns: EmbedProgress::OnStateChange: interpreting flags\n")); //
// document states
//
// if we've got the start flag, emit the signal
if ((aStateFlags & STATE_IS_NETWORK) &&
(aStateFlags & STATE_START)) {
util_SendEventToJava(nsnull,
mEventRegistration,
DOCUMENT_LOAD_LISTENER_CLASSNAME,
DocumentLoader_maskValues[START_DOCUMENT_LOAD_EVENT_MASK],
uriJstr);
}
// and for stop, too
if ((aStateFlags & STATE_IS_NETWORK) &&
(aStateFlags & STATE_STOP)) {
util_SendEventToJava(nsnull,
mEventRegistration,
DOCUMENT_LOAD_LISTENER_CLASSNAME,
DocumentLoader_maskValues[END_DOCUMENT_LOAD_EVENT_MASK],
uriJstr);
}
//
// request states
//
if ((aStateFlags & STATE_START) && (aStateFlags & STATE_IS_REQUEST)) {
util_SendEventToJava(nsnull,
mEventRegistration,
DOCUMENT_LOAD_LISTENER_CLASSNAME,
DocumentLoader_maskValues[START_URL_LOAD_EVENT_MASK],
uriJstr);
}
if ((aStateFlags & STATE_STOP) && (aStateFlags & STATE_IS_REQUEST)) {
util_SendEventToJava(nsnull,
mEventRegistration,
DOCUMENT_LOAD_LISTENER_CLASSNAME,
DocumentLoader_maskValues[END_URL_LOAD_EVENT_MASK],
uriJstr);
}
::util_DeleteStringUTF(env, uriJstr);
if (aStateFlags & STATE_IS_REQUEST) { return NS_OK;
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG, ("debug: edburns: EmbedProgress::OnStateChange: STATE_IS_REQUEST\n"));
}
if (aStateFlags & STATE_IS_DOCUMENT) {
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG, ("debug: edburns: EmbedProgress::OnStateChange: STATE_IS_DOCUMENT\n"));
}
if (aStateFlags & STATE_IS_NETWORK) {
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG, ("debug: edburns: EmbedProgress::OnStateChange: STATE_IS_NETWORK\n"));
}
if (aStateFlags & STATE_IS_WINDOW) {
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG, ("debug: edburns: EmbedProgress::OnStateChange: STATE_IS_WINDOW\n"));
}
if (aStateFlags & STATE_START) {
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG, ("debug: edburns: EmbedProgress::OnStateChange: STATE_START\n"));
}
if (aStateFlags & STATE_REDIRECTING) {
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG, ("debug: edburns: EmbedProgress::OnStateChange: STATE_REDIRECTING\n"));
}
if (aStateFlags & STATE_TRANSFERRING) {
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG, ("debug: edburns: EmbedProgress::OnStateChange: STATE_TRANSFERRING\n"));
}
if (aStateFlags & STATE_NEGOTIATING) {
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG, ("debug: edburns: EmbedProgress::OnStateChange: STATE_NEGOTIATING\n"));
}
if (aStateFlags & STATE_STOP) {
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG, ("debug: edburns: EmbedProgress::OnStateChange: STATE_STOP\n"));
}
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG, ("debug: edburns: EmbedProgress::OnStateChange: done interpreting flags\n"));
// give the widget a chance to attach any listeners
// mOwner->ContentStateChange();
// if we've got the start flag, emit the signal
if ((aStateFlags & STATE_IS_NETWORK) &&
(aStateFlags & STATE_START))
{
util_SendEventToJava(nsnull,
mEventRegistration,
DOCUMENT_LOAD_LISTENER_CLASSNAME,
DocumentLoader_maskValues[START_DOCUMENT_LOAD_EVENT_MASK],
uriJstr);
// gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
// moz_embed_signals[NET_START]);
}
/************
// is it the same as the current URI?
if (mOwner->mURI.Equals(tmpString))
{
// for people who know what they are doing
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[NET_STATE],
aStateFlags, aStatus);
}
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[NET_STATE_ALL],
(gpointer)(const char *)uriString,
(gint)aStateFlags, (gint)aStatus);
*************/
// and for stop, too
if ((aStateFlags & STATE_IS_NETWORK) &&
(aStateFlags & STATE_STOP))
{
/************
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[NET_STOP]);
// let our owner know that the load finished
mOwner->ContentFinishedLoading();
*********/
}
::util_DeleteStringUTF(env, uriJstr);
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
@ -188,32 +155,48 @@ EmbedProgress::OnProgressChange(nsIWebProgress *aWebProgress,
PRInt32 aCurTotalProgress, PRInt32 aCurTotalProgress,
PRInt32 aMaxTotalProgress) PRInt32 aMaxTotalProgress)
{ {
nsXPIDLCString uriString;
RequestToURIString(aRequest, getter_Copies(uriString));
PRInt32 percentComplete = 0;
nsCAutoString name;
nsAutoString autoName;
nsresult rv = NS_OK;
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG,
("EmbedProgress::OnProgressChange: URI: %s\n\taCurSelfProgress: %d\n\taMaxSelfProgress: %d\n\taCurTotalProgress: %d\n\taMaxTotalProgress: %d\n",
(const char *) uriString, aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress));
nsXPIDLCString uriString; // PENDING(edburns): Allow per fetch progress reporting. Right now
RequestToURIString(aRequest, getter_Copies(uriString)); // we only have coarse grained support.
if (0 < aMaxTotalProgress) {
percentComplete = aCurTotalProgress / aMaxTotalProgress;
}
if (NS_FAILED(rv = aRequest->GetName(name))) {
return rv;
}
autoName.AssignWithConversion(name.get());
// build up the string to be sent
autoName.AppendWithConversion(" ");
autoName.AppendInt(percentComplete);
autoName.AppendWithConversion("%");
JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION);
jstring msgJStr = ::util_NewString(env, autoName.get(), autoName.Length());
util_SendEventToJava(nsnull,
mEventRegistration,
DOCUMENT_LOAD_LISTENER_CLASSNAME,
DocumentLoader_maskValues[PROGRESS_URL_LOAD_EVENT_MASK],
msgJStr);
if (msgJStr) {
::util_DeleteString(env, msgJStr);
}
nsString tmpString; return NS_OK;
tmpString.AssignWithConversion(uriString);
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG,
("EmbedProgress::OnProgressChange: URI: %s\n\taCurSelfProgress: %d\n\taMaxSelfProgress: %d\n\taCurTotalProgress: %d\n\taMaxTotalProgress: %d\n",
(const char *) uriString, aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress));
// is it the same as the current uri?
/***********
if (mOwner->mURI.Equals(tmpString)) {
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[PROGRESS],
aCurTotalProgress, aMaxTotalProgress);
}
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[PROGRESS_ALL],
(const char *)uriString,
aCurTotalProgress, aMaxTotalProgress);
*******************/
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
@ -244,27 +227,28 @@ EmbedProgress::OnStatusChange(nsIWebProgress *aWebProgress,
nsresult aStatus, nsresult aStatus,
const PRUnichar *aMessage) const PRUnichar *aMessage)
{ {
// need to make a copy so we can safely cast to a void * JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION);
PRUnichar *tmpString = nsCRT::strdup(aMessage);
nsXPIDLCString uriString;
RequestToURIString(aRequest, getter_Copies(uriString));
jstring msgJstr = ::util_NewString(env, aMessage,
nsCRT::strlen(aMessage));
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG,
("EmbedProgress::OnStatusChange: URI: %s\n",
(const char *) uriString));
nsXPIDLCString uriString; util_SendEventToJava(nsnull,
RequestToURIString(aRequest, getter_Copies(uriString)); mEventRegistration,
DOCUMENT_LOAD_LISTENER_CLASSNAME,
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG, DocumentLoader_maskValues[STATUS_URL_LOAD_EVENT_MASK],
("EmbedProgress::OnStatusChange: URI: %s\n", msgJstr);
(const char *) uriString));
if (msgJstr) {
/************** ::util_DeleteString(env, msgJstr);
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget), }
moz_embed_signals[STATUS_CHANGE],
NS_STATIC_CAST(void *, aRequest), return NS_OK;
NS_STATIC_CAST(int, aStatus),
NS_STATIC_CAST(void *, tmpString));
***********/
nsMemory::Free(tmpString);
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP

View File

@ -1,5 +1,5 @@
/* /*
* $Id: NavigationTest.java,v 1.10 2004/06/12 05:46:48 edburns%acm.org Exp $ * $Id: NavigationTest.java,v 1.11 2004/06/14 01:44:33 edburns%acm.org Exp $
*/ */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
@ -49,6 +49,10 @@ public class NavigationTest extends WebclientTestCase {
return (new TestSuite(NavigationTest.class)); return (new TestSuite(NavigationTest.class));
} }
static EventRegistration2 eventRegistration;
static boolean keepWaiting;
// //
// Constants // Constants
// //
@ -65,7 +69,7 @@ public class NavigationTest extends WebclientTestCase {
assertNotNull(firstBrowserControl); assertNotNull(firstBrowserControl);
BrowserControlCanvas canvas = (BrowserControlCanvas) BrowserControlCanvas canvas = (BrowserControlCanvas)
firstBrowserControl.queryInterface(BrowserControl.BROWSER_CONTROL_CANVAS_NAME); firstBrowserControl.queryInterface(BrowserControl.BROWSER_CONTROL_CANVAS_NAME);
final EventRegistration2 eventRegistration = (EventRegistration2) eventRegistration = (EventRegistration2)
firstBrowserControl.queryInterface(BrowserControl.EVENT_REGISTRATION_NAME); firstBrowserControl.queryInterface(BrowserControl.EVENT_REGISTRATION_NAME);
assertNotNull(canvas); assertNotNull(canvas);
@ -90,58 +94,96 @@ public class NavigationTest extends WebclientTestCase {
// //
// try loading a file: url // try loading a file: url
// //
NavigationTest.keepWaiting = true;
System.out.println("Loading url: " + testPage.toURL().toString()); System.out.println("Loading url: " + testPage.toURL().toString());
eventRegistration.addDocumentLoadListener(new DocumentLoadListener() { eventRegistration.addDocumentLoadListener(new EndDocumentSelectionVerifier() {
public void eventDispatched(WebclientEvent event) { public void doEndCheck() {
if (event instanceof DocumentLoadEvent) { currentPage.selectAll();
switch ((int) event.getType()) { Selection selection = currentPage.getSelection();
case ((int) DocumentLoadEvent.START_DOCUMENT_LOAD_EVENT_MASK): assertTrue(-1 != selection.toString().indexOf("This test file is for the NavigationTest."));
System.out.println("Start Document Load Event:" + System.out.println("Selection is: " +
event.getEventData()); selection.toString());
break; NavigationTest.keepWaiting = false;
}
}
} }
}); });
nav.loadURL(testPage.toURL().toString()); nav.loadURL(testPage.toURL().toString());
Thread.currentThread().sleep(1000);
currentPage.selectAll(); // keep waiting until the previous load completes
selection = currentPage.getSelection(); while (NavigationTest.keepWaiting) {
assertTrue(-1 != selection.toString().indexOf("This test file is for the NavigationTest.")); Thread.currentThread().sleep(1000);
System.out.println("Selection is: " + selection.toString()); }
/*******************
NavigationTest.keepWaiting = true;
// //
// try loading from the dreaded RandomHTMLInputStream // try loading from the dreaded RandomHTMLInputStream
// //
RandomHTMLInputStream rhis = new RandomHTMLInputStream(10, false); RandomHTMLInputStream rhis = new RandomHTMLInputStream(10, false);
nav.loadFromStreamBlocking(rhis, "http://randomstream.com/", eventRegistration.addDocumentLoadListener(new EndDocumentSelectionVerifier() {
"text/html", -1, null); public void doEndCheck() {
Thread.currentThread().sleep(15000); currentPage.selectAll();
Selection selection = currentPage.getSelection();
currentPage.selectAll(); assertTrue(-1 != selection.toString().indexOf("START Random Data"));
selection = currentPage.getSelection(); assertTrue(-1 != selection.toString().indexOf("END Random Data"));
System.out.println("Selection is: " + selection.toString()); System.out.println("Selection is: " + selection.toString());
assertTrue(-1 != selection.toString().indexOf("START Random Data")); NavigationTest.keepWaiting = false;
assertTrue(-1 != selection.toString().indexOf("END Random Data")); }
});
nav.loadFromStream(rhis, "http://randomstream.com/",
"text/html", -1, null);
// keep waiting until the previous load completes
while (NavigationTest.keepWaiting) {
Thread.currentThread().sleep(1000);
}
// //
// try loading from a FileInputStream // try loading from a FileInputStream
// //
NavigationTest.keepWaiting = true;
FileInputStream fis = new FileInputStream(testPage); FileInputStream fis = new FileInputStream(testPage);
eventRegistration.addDocumentLoadListener(new EndDocumentSelectionVerifier() {
public void doEndCheck() {
currentPage.selectAll();
Selection selection = currentPage.getSelection();
assertTrue(-1 != selection.toString().indexOf("This test file is for the NavigationTest."));
System.out.println("Selection is: " +
selection.toString());
NavigationTest.keepWaiting = false;
}
});
nav.loadFromStream(fis, "http://somefile.com/", nav.loadFromStream(fis, "http://somefile.com/",
"text/html", -1, null); "text/html", -1, null);
Thread.currentThread().sleep(1000); // keep waiting until the previous load completes
while (NavigationTest.keepWaiting) {
currentPage.selectAll(); Thread.currentThread().sleep(1000);
selection = currentPage.getSelection(); }
assertTrue(-1 != selection.toString().indexOf("This test file is for the NavigationTest.")); *******************/
System.out.println("Selection is: " + selection.toString());
frame.setVisible(false); frame.setVisible(false);
BrowserControlFactory.deleteBrowserControl(firstBrowserControl); BrowserControlFactory.deleteBrowserControl(firstBrowserControl);
BrowserControlFactory.appTerminate(); BrowserControlFactory.appTerminate();
} }
public static abstract class EndDocumentSelectionVerifier implements DocumentLoadListener {
public void eventDispatched(WebclientEvent event) {
if (event instanceof DocumentLoadEvent) {
switch ((int) event.getType()) {
case ((int) DocumentLoadEvent.END_DOCUMENT_LOAD_EVENT_MASK):
NavigationTest.eventRegistration.removeDocumentLoadListener(this);
doEndCheck();
break;
}
}
}
public abstract void doEndCheck();
}
} }