case NEW_WINDOW_LISTENER: if (gCreatorCallback) gCreatorCallback->AddNewWindowListener(globalRef); break;
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NativeEventThread_nativeAddListener(JNIEnv *env, jobject obj, jint webShellPtr, jobject typedListener,  jstring listenerString){    WebShellInitContext *initContext = (WebShellInitContext *)webShellPtr;            if (initContext == nsnull) {        ::util_ThrowExceptionToJava(env, "Exception: null initContext passed tonativeAddListener");        return;    }    if (nsnull == initContext->nativeEventThread) {        // store the java EventRegistrationImpl class in the initContext        initContext->nativeEventThread =             ::util_NewGlobalRef(env, obj); // VERY IMPORTANT!!                // This enables the listener to call back into java    }        jclass clazz = nsnull;    int listenerType = 0;    const char *listenerStringChars = ::util_GetStringUTFChars(env,                                                                listenerString);    if (listenerStringChars == nsnull) {        ::util_ThrowExceptionToJava(env, "Exception: nativeAddListener: Can't get className for listener.");        return;    }            while (nsnull != gSupportedListenerInterfaces[listenerType]) {        if (0 == nsCRT::strcmp(gSupportedListenerInterfaces[listenerType],                                listenerStringChars)) {            // We've got a winner!            break;        }        listenerType++;    }    ::util_ReleaseStringUTFChars(env, listenerString, listenerStringChars);    listenerStringChars = nsnull;        if (LISTENER_NOT_FOUND == (LISTENER_CLASSES) listenerType) {        ::util_ThrowExceptionToJava(env, "Exception: NativeEventThread.nativeAddListener(): can't find listener \n\tclass for argument");        return;    }    jobject globalRef = nsnull;    // PENDING(edburns): make sure do DeleteGlobalRef on the removeListener    if (nsnull == (globalRef = ::util_NewGlobalRef(env, typedListener))) {        ::util_ThrowExceptionToJava(env, "Exception: NativeEventThread.nativeAddListener(): can't create NewGlobalRef\n\tfor argument");        return;    }    PR_ASSERT(initContext->browserContainer);    switch(listenerType) {    case DOCUMENT_LOAD_LISTENER:        initContext->browserContainer->AddDocumentLoadListener(globalRef);         break;    case MOUSE_LISTENER:        initContext->browserContainer->AddMouseListener(globalRef);         break;    }    return;}