From 676efc167af72d93b27f4f469fbb604f62165be4 Mon Sep 17 00:00:00 2001 From: "edburns%acm.org" Date: Mon, 14 Jun 2004 01:44:33 +0000 Subject: [PATCH] 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 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. git-svn-id: svn://10.0.0.236/trunk@157843 18797224-902f-48f8-a5cc-f745e15eee43 --- .../wrapper_native/EventRegistrationImpl.java | 95 ++++++- .../wrapper_native/NativeEventThread.java | 16 +- .../java/webclient/src_moz/EmbedProgress.cpp | 232 ++++++++---------- .../org/mozilla/webclient/NavigationTest.java | 106 +++++--- 4 files changed, 276 insertions(+), 173 deletions(-) diff --git a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java index a7250f60628..5ee88a17c14 100644 --- a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java +++ b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java @@ -66,6 +66,10 @@ public class EventRegistrationImpl extends ImplObjectNative implements EventRegi private List documentLoadListeners; + private BrowserToJavaEventPump eventPump = null; + + private static int instanceCount = 0; + // // Constructors and Initializers // @@ -84,11 +88,14 @@ public EventRegistrationImpl(WrapperFactory yourFactory, } documentLoadListeners = new ArrayList(); + eventPump = new BrowserToJavaEventPump(instanceCount++); + eventPump.start(); } public void delete() { super.delete(); + eventPump.stopRunning(); } // @@ -235,12 +242,9 @@ void nativeEventOccurred(String targetClassName, long eventType, ParameterCheck.nonNull(targetClassName); WebclientEvent event = null; - WebclientEventListener curListener = null; - List listeners = null; if (DocumentLoadListener.class.getName().equals(targetClassName)) { event = new DocumentLoadEvent(this, eventType, eventData); - listeners = documentLoadListeners; } else if (MouseListener.class.getName().equals(targetClassName)) { // We create a plain vanilla WebclientEvent, which the @@ -257,14 +261,87 @@ void nativeEventOccurred(String targetClassName, long eventType, } // else... - if (null != event && null != listeners) { - Iterator iter = listeners.iterator(); - while (iter.hasNext()) { - curListener = (WebclientEventListener) iter.next(); - curListener.eventDispatched(event); + eventPump.queueEvent(event); + eventPump.V(); +} + +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 diff --git a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java index 1f7b23e1ab5..4bb3a98d916 100644 --- a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java +++ b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java @@ -111,7 +111,7 @@ public class NativeEventThread extends Thread { wait(); } 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()); } } @@ -142,10 +142,10 @@ public void run() ((Runnable)runnables.pop()).run(); synchronized (wrapperFactory) { try { - wrapperFactory.notify(); + wrapperFactory.notifyAll(); } 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 (null == this.wrapperFactory) { try { - notify(); + notifyAll(); } 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; } @@ -187,7 +187,7 @@ public void run() } // notify the pushBlockingWCRunnable() method. try { - notify(); + notifyAll(); } catch (Exception e) { 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); } try { - notify(); + notifyAll(); } 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) { diff --git a/mozilla/java/webclient/src_moz/EmbedProgress.cpp b/mozilla/java/webclient/src_moz/EmbedProgress.cpp index 3f6a1844e15..03ba7c5fe66 100644 --- a/mozilla/java/webclient/src_moz/EmbedProgress.cpp +++ b/mozilla/java/webclient/src_moz/EmbedProgress.cpp @@ -40,7 +40,7 @@ EmbedProgress::EmbedProgress(void) } EmbedProgress::~EmbedProgress() -{ +{ if (nsnull != mEventRegistration) { JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION); ::util_DeleteGlobalRef(env, mEventRegistration); @@ -93,91 +93,58 @@ EmbedProgress::OnStateChange(nsIWebProgress *aWebProgress, nsXPIDLCString uriString; RequestToURIString(aRequest, getter_Copies(uriString)); jstring uriJstr = ::util_NewStringUTF(env, (const char *) uriString); - nsString tmpString; - tmpString.AssignWithConversion(uriString); PR_LOG(prLogModuleInfo, PR_LOG_DEBUG, ("EmbedProgress::OnStateChange: URI: %s\n", (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) { - 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; + return NS_OK; } NS_IMETHODIMP @@ -188,32 +155,48 @@ EmbedProgress::OnProgressChange(nsIWebProgress *aWebProgress, PRInt32 aCurTotalProgress, 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; - RequestToURIString(aRequest, getter_Copies(uriString)); + // PENDING(edburns): Allow per fetch progress reporting. Right now + // 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; - 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; + return NS_OK; } NS_IMETHODIMP @@ -244,27 +227,28 @@ EmbedProgress::OnStatusChange(nsIWebProgress *aWebProgress, nsresult aStatus, const PRUnichar *aMessage) { - // need to make a copy so we can safely cast to a void * - PRUnichar *tmpString = nsCRT::strdup(aMessage); + JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION); + + 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; - RequestToURIString(aRequest, getter_Copies(uriString)); - - PR_LOG(prLogModuleInfo, PR_LOG_DEBUG, - ("EmbedProgress::OnStatusChange: URI: %s\n", - (const char *) uriString)); - - /************** - gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget), - moz_embed_signals[STATUS_CHANGE], - NS_STATIC_CAST(void *, aRequest), - NS_STATIC_CAST(int, aStatus), - NS_STATIC_CAST(void *, tmpString)); - ***********/ - - nsMemory::Free(tmpString); - - return NS_OK; + util_SendEventToJava(nsnull, + mEventRegistration, + DOCUMENT_LOAD_LISTENER_CLASSNAME, + DocumentLoader_maskValues[STATUS_URL_LOAD_EVENT_MASK], + msgJstr); + + if (msgJstr) { + ::util_DeleteString(env, msgJstr); + } + + return NS_OK; } NS_IMETHODIMP diff --git a/mozilla/java/webclient/test/automated/src/classes/org/mozilla/webclient/NavigationTest.java b/mozilla/java/webclient/test/automated/src/classes/org/mozilla/webclient/NavigationTest.java index 67bac912447..f9e833cb968 100644 --- a/mozilla/java/webclient/test/automated/src/classes/org/mozilla/webclient/NavigationTest.java +++ b/mozilla/java/webclient/test/automated/src/classes/org/mozilla/webclient/NavigationTest.java @@ -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 -*- @@ -49,6 +49,10 @@ public class NavigationTest extends WebclientTestCase { return (new TestSuite(NavigationTest.class)); } + static EventRegistration2 eventRegistration; + + static boolean keepWaiting; + // // Constants // @@ -65,7 +69,7 @@ public class NavigationTest extends WebclientTestCase { assertNotNull(firstBrowserControl); BrowserControlCanvas canvas = (BrowserControlCanvas) firstBrowserControl.queryInterface(BrowserControl.BROWSER_CONTROL_CANVAS_NAME); - final EventRegistration2 eventRegistration = (EventRegistration2) + eventRegistration = (EventRegistration2) firstBrowserControl.queryInterface(BrowserControl.EVENT_REGISTRATION_NAME); assertNotNull(canvas); @@ -90,58 +94,96 @@ public class NavigationTest extends WebclientTestCase { // // try loading a file: url // + + NavigationTest.keepWaiting = true; + System.out.println("Loading url: " + testPage.toURL().toString()); - 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): - System.out.println("Start Document Load Event:" + - event.getEventData()); - break; - } - } + 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.loadURL(testPage.toURL().toString()); - Thread.currentThread().sleep(1000); - currentPage.selectAll(); - selection = currentPage.getSelection(); - assertTrue(-1 != selection.toString().indexOf("This test file is for the NavigationTest.")); - System.out.println("Selection is: " + selection.toString()); + // keep waiting until the previous load completes + while (NavigationTest.keepWaiting) { + Thread.currentThread().sleep(1000); + } + /******************* + + NavigationTest.keepWaiting = true; // // try loading from the dreaded RandomHTMLInputStream // RandomHTMLInputStream rhis = new RandomHTMLInputStream(10, false); - nav.loadFromStreamBlocking(rhis, "http://randomstream.com/", - "text/html", -1, null); - Thread.currentThread().sleep(15000); - - currentPage.selectAll(); - selection = currentPage.getSelection(); - System.out.println("Selection is: " + selection.toString()); - assertTrue(-1 != selection.toString().indexOf("START Random Data")); - assertTrue(-1 != selection.toString().indexOf("END Random Data")); + eventRegistration.addDocumentLoadListener(new EndDocumentSelectionVerifier() { + public void doEndCheck() { + currentPage.selectAll(); + Selection selection = currentPage.getSelection(); + assertTrue(-1 != selection.toString().indexOf("START Random Data")); + assertTrue(-1 != selection.toString().indexOf("END Random Data")); + System.out.println("Selection is: " + selection.toString()); + NavigationTest.keepWaiting = false; + } + }); + 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 // + NavigationTest.keepWaiting = true; + 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/", "text/html", -1, null); - Thread.currentThread().sleep(1000); - - currentPage.selectAll(); - selection = currentPage.getSelection(); - assertTrue(-1 != selection.toString().indexOf("This test file is for the NavigationTest.")); - System.out.println("Selection is: " + selection.toString()); + // keep waiting until the previous load completes + while (NavigationTest.keepWaiting) { + Thread.currentThread().sleep(1000); + } + *******************/ frame.setVisible(false); BrowserControlFactory.deleteBrowserControl(firstBrowserControl); 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(); + } + }