ra=edburns
author=Nikolay Igotti
Minor update to prevent some crashes.
This commit is contained in:
edburns%acm.org 2001-07-12 20:32:09 +00:00
Родитель ad08dc59b9
Коммит 263d228e84
7 изменённых файлов: 37 добавлений и 27 удалений

Просмотреть файл

@ -16,7 +16,7 @@
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
# All Rights Reserved.
#
# $Id: set_env.sh,v 1.1 2001-05-10 18:12:39 edburns%acm.org Exp $
# $Id: set_env.sh,v 1.2 2001-07-12 20:32:06 edburns%acm.org Exp $
#
#
# Contributor(s):
@ -26,7 +26,7 @@
# Set those variables
# for me this var set in .bashrc so I don't need it here
#WFJDKHOME=/usr/java/jdk1.3.0_02
WFDIR=/usr/local/home/nike/mozilla/wf
WFDIR=/work/wf.ed
# end of customizable part
CURDIR=`pwd`

Просмотреть файл

@ -16,7 +16,7 @@
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: nsAppletHTMLObject.cpp,v 1.1 2001-05-10 18:12:41 edburns%acm.org Exp $
* $Id: nsAppletHTMLObject.cpp,v 1.2 2001-07-12 20:32:07 edburns%acm.org Exp $
*
*
* Contributor(s):
@ -78,7 +78,7 @@ nsAppletHTMLObject::Initialize(nsIPluginInstancePeer *peer)
m_peer = peer;
NS_ADDREF(m_peer);
peer->QueryInterface(kIPluginInstancePeer2IID,
(void **)&m_peer2);
(void **)&m_peer2);
m_jobject = new nsJavaHTMLObject(m_factory);
NS_ADDREF(m_jobject);
res = nsServiceManager::GetService(kPluginManagerCID,

Просмотреть файл

@ -16,7 +16,7 @@
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: nsJavaHTMLObjectFactory.cpp,v 1.1 2001-05-10 18:12:42 edburns%acm.org Exp $
* $Id: nsJavaHTMLObjectFactory.cpp,v 1.2 2001-07-12 20:32:08 edburns%acm.org Exp $
*
*
* Contributor(s):
@ -38,6 +38,7 @@
#include "nsWFSecurityContext.h"
#include "nsIThread.h"
#include "nsIJVMConsole.h"
#include "nsCRT.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIPluginIID, NS_IPLUGIN_IID);
@ -69,12 +70,12 @@ NS_IMPL_THREADSAFE_ISUPPORTS5(nsJavaHTMLObjectFactory, \
nsIFactory, \
nsIPlugin, \
nsIJVMPlugin, \
nsIJVMConsole, \
nsIJVMConsole, \
nsIBrowserJavaSupport)
static int GetProxyForURL(void* handle,
char* url,
char* *proxy)
char* url,
char* *proxy)
{
nsresult res;
nsIBrowserJavaSupport* obj = (nsIBrowserJavaSupport*)handle;
@ -100,19 +101,20 @@ nsJavaHTMLObjectFactory::nsJavaHTMLObjectFactory() {
mainIThread->GetPRThread(&m_mainThread);
instance = this;
m_jsjRecursion = 0;
m_wrapper = nsnull;
}
nsJavaHTMLObjectFactory::~nsJavaHTMLObjectFactory() {
OJI_LOG("nsJavaHTMLObjectFactory::~nsJavaHTMLObjectFactory");
NS_RELEASE(m_jvm);
free(m_wrapper);
if (m_wrapper) free(m_wrapper);
}
NS_METHOD
nsJavaHTMLObjectFactory::Create(nsISupports* outer,
const nsIID& aIID,
void* *aInstancePtr)
const nsIID& aIID,
void* *aInstancePtr)
{
//OJI_LOG2("nsJavaHTMLObjectFactory::Create with %p", outer);
//OJI_LOG2("it is %s", aIID.ToString());
@ -124,6 +126,8 @@ nsJavaHTMLObjectFactory::Create(nsISupports* outer,
if (!instance)
{
instance = new nsJavaHTMLObjectFactory();
// XXX: instance never will be freed, need to be rewritten
NS_ADDREF(instance);
rv = instance->Initialize();
if (NS_FAILED(rv)) return rv;
}
@ -136,8 +140,8 @@ nsJavaHTMLObjectFactory::Create(nsISupports* outer,
if (aIID.Equals(kIPluginInstanceIID) || aIID.Equals(kIJavaHTMLObjectIID))
{
return instance->CreateInstance(outer,
aIID,
aInstancePtr);
aIID,
aInstancePtr);
}
OJI_LOG2("nsJavaHTMLObjectFactory::Create: no matching ifaces for %s",
aIID.ToString());
@ -146,8 +150,8 @@ nsJavaHTMLObjectFactory::Create(nsISupports* outer,
NS_IMETHODIMP
nsJavaHTMLObjectFactory::CreateInstance(nsISupports *aOuter,
const nsIID & aIID,
void **result)
const nsIID & aIID,
void **result)
{
*result = NULL;
if (aOuter != NULL)
@ -155,7 +159,8 @@ nsJavaHTMLObjectFactory::CreateInstance(nsISupports *aOuter,
OJI_LOG("Aggregation of nsJavaHTMLObjectFactory failed");
return NS_ERROR_NO_AGGREGATION;
}
if (!m_jvm) return NS_ERROR_FAILURE;
// m_env is set if JVM is started up
if (!m_jvm || !m_env) return NS_ERROR_FAILURE;
// XXX: remove me when it'll be called by Mozilla
//if (NS_FAILED(Initialize())) return NS_ERROR_FAILURE;
if (aIID.Equals(kIJavaHTMLObjectIID))

Просмотреть файл

@ -16,7 +16,7 @@
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: nsJavaHTMLObjectFactory.h,v 1.1 2001-05-10 18:12:42 edburns%acm.org Exp $
* $Id: nsJavaHTMLObjectFactory.h,v 1.2 2001-07-12 20:32:09 edburns%acm.org Exp $
*
*
* Contributor(s):
@ -107,8 +107,9 @@ class nsJavaHTMLObjectFactory : public nsIPlugin,
BrowserSupportWrapper* m_wrapper;
JNIEnv* m_env;
NS_IMETHOD doGetProxyForURL(const char* url,
char* *target);
NS_IMETHOD doJSCall(jint jstid, struct JSObject_CallInfo** call);
char* *target);
NS_IMETHOD doJSCall(jint jstid,
struct JSObject_CallInfo** call);
NS_IMETHOD initLiveConnect();
PRThread* m_mainThread;
jint m_jsjRecursion;

Просмотреть файл

@ -16,7 +16,7 @@
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: nsJavaObjectInfo.cpp,v 1.1 2001-05-10 18:12:42 edburns%acm.org Exp $
* $Id: nsJavaObjectInfo.cpp,v 1.2 2001-07-12 20:32:09 edburns%acm.org Exp $
*
*
* Contributor(s):
@ -29,6 +29,7 @@
#include "nsIWFInstanceWrapper.h"
#include "nsIPluginInstance.h"
#include "wf_moz6_common.h"
#include <stdlib.h>
static NS_DEFINE_IID(kIPluginInstanceIID, NS_IPLUGININSTANCE_IID);
static NS_DEFINE_IID(kIWFInstanceWrapperIID, NS_IWFINSTANCEWRAPPER_IID);

Просмотреть файл

@ -16,7 +16,7 @@
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: nsPluggableJVM.cpp,v 1.1 2001-05-10 18:12:42 edburns%acm.org Exp $
* $Id: nsPluggableJVM.cpp,v 1.2 2001-07-12 20:32:09 edburns%acm.org Exp $
*
*
* Contributor(s):
@ -48,8 +48,8 @@ nsPluggableJVM::~nsPluggableJVM()
OJI_LOG("nsPluggableJVM::~nsPluggableJVM");
if (m_jvmp_context)
{
if (m_extID)
(m_jvmp_context->JVMP_UnregisterExtension)(m_ctx, m_extID);
if (m_ctx != nsnull && m_extID != 0)
(m_jvmp_context->JVMP_UnregisterExtension)(m_ctx, m_extID);
}
}
@ -168,6 +168,7 @@ nsPluggableJVM::GetJNIEnv(JNIEnv* *env)
JVMP_CallingContext* ctx;
int res;
if (!m_jvmp_context) return NS_ERROR_FAILURE;
res = (m_jvmp_context->JVMP_GetCallingContext)(&ctx);
if (res != JNI_TRUE) return NS_ERROR_FAILURE;
*env = ctx->env;
@ -176,7 +177,8 @@ nsPluggableJVM::GetJNIEnv(JNIEnv* *env)
static int newPrincipalsFromStrings(jbyte** *resprin,
jint* *reslen, jint num, ...)
jint* *reslen,
jint num, ...)
{
jint* prins_len;
jbyte* *prins;
@ -277,6 +279,7 @@ nsPluggableJVM::ShutdownJVM(PRBool fullShutdown, nsPluggableJVMStatus *status)
{
if ((m_jvmp_context->JVMP_UnregisterExtension(m_ctx, m_extID) != JNI_TRUE))
return NS_ERROR_FAILURE;
m_extID = 0;
if ((m_jvmp_context->JVMP_StopJVM(m_ctx) != JNI_TRUE))
return NS_ERROR_FAILURE;
m_jvmp_context = NULL;

Просмотреть файл

@ -16,7 +16,7 @@
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
* All Rights Reserved.
*
* $Id: nsWFSecureEnv.cpp,v 1.1 2001-05-10 18:12:44 edburns%acm.org Exp $
* $Id: nsWFSecureEnv.cpp,v 1.2 2001-07-12 20:32:09 edburns%acm.org Exp $
*
*
* Contributor(s):
@ -181,7 +181,7 @@ nsWFSecureEnv::CallMethod(/*[in]*/ jni_type ret_type,
{
// XXX: do smth meaningful with possible Java exception
if (call->jException) {
m_jvm->DeleteLocalRef(call->jException);
m_jvm->DeleteGlobalRef(call->jException);
rv = NS_ERROR_FAILURE;
} else {
*result = call->data.__callMethod.result;