summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT Mozilla
diff options
context:
space:
mode:
authorGrant Gayed <grant_gayed@ca.ibm.com>2012-02-29 12:02:17 -0500
committerGrant Gayed <grant_gayed@ca.ibm.com>2012-03-06 16:45:36 -0500
commita44261ef7ad91b3d8ffc177d976044172a616213 (patch)
tree721cc2de7af5943c675cdab405841a4f4aaf6740 /bundles/org.eclipse.swt/Eclipse SWT Mozilla
parentc0e8b19693a09635ee2e2549501800c6e492284d (diff)
downloadeclipse.platform.swt-a44261ef7ad91b3d8ffc177d976044172a616213.tar.gz
eclipse.platform.swt-a44261ef7ad91b3d8ffc177d976044172a616213.tar.xz
eclipse.platform.swt-a44261ef7ad91b3d8ffc177d976044172a616213.zip
Bug 372138 - JS evaluating asynchronously with XULRunner 10
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Mozilla')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp65
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_custom.cpp59
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_custom.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java38
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java23
7 files changed, 165 insertions, 53 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp
index c5276bd3fa..498421cca1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -519,6 +519,31 @@ JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJIIIIIIIIIIIIISI)(JNIEnv *env,
}
#endif
+#if (!defined(NO__1VtblCall__IIIIIIIIIIIIIIISIFS) && !defined(JNI64)) || (!defined(NO__1VtblCall__IJIIIIIIIIIIIIISIFS) && defined(JNI64))
+#ifndef JNI64
+extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIIIIIIIIIIIIIISIFS)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jint arg3, jint arg4, jint arg5, jint arg6, jint arg7, jint arg8, jint arg9, jint arg10, jint arg11, jint arg12, jint arg13, jint arg14, jshort arg15, jint arg16, jfloat arg17, jshort arg18);
+JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIIIIIIIIIIIIIISIFS)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jint arg3, jint arg4, jint arg5, jint arg6, jint arg7, jint arg8, jint arg9, jint arg10, jint arg11, jint arg12, jint arg13, jint arg14, jshort arg15, jint arg16, jfloat arg17, jshort arg18)
+#else
+extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJIIIIIIIIIIIIISIFS)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jint arg3, jint arg4, jint arg5, jint arg6, jint arg7, jint arg8, jint arg9, jint arg10, jint arg11, jint arg12, jint arg13, jint arg14, jshort arg15, jint arg16, jfloat arg17, jshort arg18);
+JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJIIIIIIIIIIIIISIFS)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jint arg3, jint arg4, jint arg5, jint arg6, jint arg7, jint arg8, jint arg9, jint arg10, jint arg11, jint arg12, jint arg13, jint arg14, jshort arg15, jint arg16, jfloat arg17, jshort arg18)
+#endif
+{
+ jint rc = 0;
+#ifndef JNI64
+ XPCOM_NATIVE_ENTER(env, that, _1VtblCall__IIIIIIIIIIIIIIISIFS_FUNC);
+#else
+ XPCOM_NATIVE_ENTER(env, that, _1VtblCall__IJIIIIIIIIIIIIISIFS_FUNC);
+#endif
+ rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, jint, jint, jint, jint, jint, jint, jint, jint, jint, jint, jint, jint, jint, jshort, jint, jfloat, jshort))(*(jintLong **)arg1)[arg0])(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18);
+#ifndef JNI64
+ XPCOM_NATIVE_EXIT(env, that, _1VtblCall__IIIIIIIIIIIIIIISIFS_FUNC);
+#else
+ XPCOM_NATIVE_EXIT(env, that, _1VtblCall__IJIIIIIIIIIIIIISIFS_FUNC);
+#endif
+ return rc;
+}
+#endif
+
#if (!defined(NO__1VtblCall__IIIIIIIII_3I) && !defined(JNI64)) || (!defined(NO__1VtblCall__IJIIIIIII_3I) && defined(JNI64))
#ifndef JNI64
extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIIIIIIII_3I)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jint arg3, jint arg4, jint arg5, jint arg6, jint arg7, jint arg8, jintArray arg9);
@@ -2590,6 +2615,31 @@ JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJJIIJIIIIIIIIISJ)(JNIEnv *env,
}
#endif
+#if (!defined(NO__1VtblCall__IIJIIJIIIIIIIIISJFS) && !defined(JNI64)) || (!defined(NO__1VtblCall__IJJIIJIIIIIIIIISJFS) && defined(JNI64))
+#ifndef JNI64
+extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIJIIJIIIIIIIIISJFS)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jint arg3, jint arg4, jlong arg5, jint arg6, jint arg7, jint arg8, jint arg9, jint arg10, jint arg11, jint arg12, jint arg13, jint arg14, jshort arg15, jlong arg16, jfloat arg17, jshort arg18);
+JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIJIIJIIIIIIIIISJFS)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jint arg3, jint arg4, jlong arg5, jint arg6, jint arg7, jint arg8, jint arg9, jint arg10, jint arg11, jint arg12, jint arg13, jint arg14, jshort arg15, jlong arg16, jfloat arg17, jshort arg18)
+#else
+extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJJIIJIIIIIIIIISJFS)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jint arg3, jint arg4, jlong arg5, jint arg6, jint arg7, jint arg8, jint arg9, jint arg10, jint arg11, jint arg12, jint arg13, jint arg14, jshort arg15, jlong arg16, jfloat arg17, jshort arg18);
+JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJJIIJIIIIIIIIISJFS)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jint arg3, jint arg4, jlong arg5, jint arg6, jint arg7, jint arg8, jint arg9, jint arg10, jint arg11, jint arg12, jint arg13, jint arg14, jshort arg15, jlong arg16, jfloat arg17, jshort arg18)
+#endif
+{
+ jint rc = 0;
+#ifndef JNI64
+ XPCOM_NATIVE_ENTER(env, that, _1VtblCall__IIJIIJIIIIIIIIISJFS_FUNC);
+#else
+ XPCOM_NATIVE_ENTER(env, that, _1VtblCall__IJJIIJIIIIIIIIISJFS_FUNC);
+#endif
+ rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, jlong, jint, jint, jlong, jint, jint, jint, jint, jint, jint, jint, jint, jint, jshort, jlong, jfloat, jshort))(*(jintLong **)arg1)[arg0])(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18);
+#ifndef JNI64
+ XPCOM_NATIVE_EXIT(env, that, _1VtblCall__IIJIIJIIIIIIIIISJFS_FUNC);
+#else
+ XPCOM_NATIVE_EXIT(env, that, _1VtblCall__IJJIIJIIIIIIIIISJFS_FUNC);
+#endif
+ return rc;
+}
+#endif
+
#if (!defined(NO__1VtblCall__IIJIIJ_3I_3J) && !defined(JNI64)) || (!defined(NO__1VtblCall__IJJIIJ_3I_3J) && defined(JNI64))
#ifndef JNI64
extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIJIIJ_3I_3J)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jlong arg2, jint arg3, jint arg4, jlong arg5, jintArray arg6, jlongArray arg7);
@@ -7015,19 +7065,6 @@ JNIEXPORT jintLong JNICALL XPCOM_NATIVE(_1nsIScriptGlobalObject_1GetScriptContex
}
#endif
-#ifndef NO__1nsIScriptGlobalObject_1GetScriptGlobal
-extern "C" JNIEXPORT jintLong JNICALL XPCOM_NATIVE(_1nsIScriptGlobalObject_1GetScriptGlobal)(JNIEnv *env, jclass that, jintLong arg0, jint arg1);
-JNIEXPORT jintLong JNICALL XPCOM_NATIVE(_1nsIScriptGlobalObject_1GetScriptGlobal)
- (JNIEnv *env, jclass that, jintLong arg0, jint arg1)
-{
- jintLong rc = 0;
- XPCOM_NATIVE_ENTER(env, that, _1nsIScriptGlobalObject_1GetScriptGlobal_FUNC);
- rc = (jintLong)((nsIScriptGlobalObject *)arg0)->GetScriptGlobal(arg1);
- XPCOM_NATIVE_EXIT(env, that, _1nsIScriptGlobalObject_1GetScriptGlobal_FUNC);
- return rc;
-}
-#endif
-
#if (!defined(NO_memmove__ILorg_eclipse_swt_internal_mozilla_nsDynamicFunctionLoad_2I) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_mozilla_nsDynamicFunctionLoad_2J) && defined(JNI64))
#ifndef JNI64
extern "C" JNIEXPORT void JNICALL XPCOM_NATIVE(memmove__ILorg_eclipse_swt_internal_mozilla_nsDynamicFunctionLoad_2I)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_custom.cpp b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_custom.cpp
index f61d97b078..3141c37e1c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_custom.cpp
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_custom.cpp
@@ -55,7 +55,15 @@ JNIEXPORT jint JNICALL XPCOM_NATIVE(_1JS_1EvaluateUCScriptForPrincipals)
{
#ifdef _WIN32
- XPCOM_LOAD_FUNCTION(fp, JS_EvaluateUCScriptForPrincipals)
+ static int initialized = 0;
+ static FARPROC fp = NULL;
+ if (!initialized) {
+ HMODULE hm = LoadLibrary((const char *)lpmozillaPath);
+ if (hm) {
+ fp = GetProcAddress(hm, "JS_EvaluateUCScriptForPrincipals");
+ }
+ initialized = 1;
+ }
if (fp) {
rc = (jint)((jint (*)(jintLong, jintLong, jintLong, jchar *, jint, jbyte *, jint, jintLong *))fp)(arg0, arg1, arg2, lparg3, arg4, lparg5, arg6, lparg7);
}
@@ -85,6 +93,55 @@ fail:
}
#endif
+#ifndef NO__1JS_1GetGlobalObject
+JNIEXPORT jintLong JNICALL XPCOM_NATIVE(_1JS_1GetGlobalObject)
+ (JNIEnv *env, jclass that, jbyteArray mozillaPath, jintLong arg0)
+{
+ jbyte *lpmozillaPath=NULL;
+ jintLong rc = 0;
+ XPCOM_NATIVE_ENTER(env, that, _1JS_1GetGlobalObject_FUNC);
+ if (mozillaPath) if ((lpmozillaPath = env->GetByteArrayElements(mozillaPath, NULL)) == NULL) goto fail;
+/*
+ rc = (jint)JS_GetGlobalObject(arg0);
+*/
+ {
+
+#ifdef _WIN32
+ static int initialized = 0;
+ static FARPROC fp = NULL;
+ if (!initialized) {
+ HMODULE hm = LoadLibrary((const char *)lpmozillaPath);
+ if (hm) {
+ fp = GetProcAddress(hm, "JS_GetGlobalObject");
+ }
+ initialized = 1;
+ }
+ if (fp) {
+ rc = (jintLong)((jint (*)(jintLong))fp)(arg0);
+ }
+#else
+#define CALLING_CONVENTION
+ static int initialized = 0;
+ static void *fp = NULL;
+ if (!initialized) {
+ void* handle = dlopen((const char *)lpmozillaPath, RTLD_LAZY);
+ if (handle) {
+ fp = dlsym(handle, "JS_GetGlobalObject");
+ }
+ initialized = 1;
+ }
+ if (fp) {
+ rc = (jintLong)((jint (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+#endif /* _WIN32 */
+ }
+fail:
+ if (mozillaPath && lpmozillaPath) env->ReleaseByteArrayElements(mozillaPath, lpmozillaPath, 0);
+ XPCOM_NATIVE_EXIT(env, that, _1JS_1GetGlobalObject_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1NS_1Free
JNIEXPORT jint JNICALL XPCOM_NATIVE(_1NS_1Free)
(JNIEnv *env, jclass that, jbyteArray mozillaPath, jintLong arg0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_custom.h b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_custom.h
index 5bfb56eaeb..fe1578e76c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_custom.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_custom.h
@@ -11,7 +11,6 @@
#ifdef _WIN32
#include <windows.h>
-#define JS_EvaluateUCScriptForPrincipals_LIB "js3250.dll"
#define NS_Free_LIB "xpcom.dll"
#define XP_WIN
#else
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp
index c3d7709e76..168cf30906 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,8 +14,8 @@
#ifdef NATIVE_STATS
-int XPCOM_nativeFunctionCount = 245;
-int XPCOM_nativeFunctionCallCount[245];
+int XPCOM_nativeFunctionCount = 247;
+int XPCOM_nativeFunctionCallCount[247];
char * XPCOM_nativeFunctionNames[] = {
#ifndef JNI64
"_1Call__I",
@@ -38,6 +38,7 @@ char * XPCOM_nativeFunctionNames[] = {
"_1Call__JJJ_3BII_3I",
#endif
"_1JS_1EvaluateUCScriptForPrincipals",
+ "_1JS_1GetGlobalObject",
"_1NS_1Free",
"_1NS_1GetComponentManager",
"_1NS_1GetServiceManager",
@@ -109,6 +110,11 @@ char * XPCOM_nativeFunctionNames[] = {
"_1VtblCall__IJIIIIIIIIIIIIISI",
#endif
#ifndef JNI64
+ "_1VtblCall__IIIIIIIIIIIIIIISIFS",
+#else
+ "_1VtblCall__IJIIIIIIIIIIIIISIFS",
+#endif
+#ifndef JNI64
"_1VtblCall__IIIIIIIII_3I",
#else
"_1VtblCall__IJIIIIIII_3I",
@@ -439,6 +445,11 @@ char * XPCOM_nativeFunctionNames[] = {
"_1VtblCall__IJJIIJIIIIIIIIISJ",
#endif
#ifndef JNI64
+ "_1VtblCall__IIJIIJIIIIIIIIISJFS",
+#else
+ "_1VtblCall__IJJIIJIIIIIIIIISJFS",
+#endif
+#ifndef JNI64
"_1VtblCall__IIJIIJ_3I_3J",
#else
"_1VtblCall__IJJIIJ_3I_3J",
@@ -1104,7 +1115,6 @@ char * XPCOM_nativeFunctionNames[] = {
"_1nsIScriptContext_1GetNativeContext",
"_1nsIScriptGlobalObject_1EnsureScriptEnvironment",
"_1nsIScriptGlobalObject_1GetScriptContext",
- "_1nsIScriptGlobalObject_1GetScriptGlobal",
#ifndef JNI64
"memmove__ILorg_eclipse_swt_internal_mozilla_nsDynamicFunctionLoad_2I",
#else
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h
index 0b0b1e0cc5..f62ba6cf6d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -46,6 +46,7 @@ typedef enum {
_1Call__JJJ_3BII_3I_FUNC,
#endif
_1JS_1EvaluateUCScriptForPrincipals_FUNC,
+ _1JS_1GetGlobalObject_FUNC,
_1NS_1Free_FUNC,
_1NS_1GetComponentManager_FUNC,
_1NS_1GetServiceManager_FUNC,
@@ -117,6 +118,11 @@ typedef enum {
_1VtblCall__IJIIIIIIIIIIIIISI_FUNC,
#endif
#ifndef JNI64
+ _1VtblCall__IIIIIIIIIIIIIIISIFS_FUNC,
+#else
+ _1VtblCall__IJIIIIIIIIIIIIISIFS_FUNC,
+#endif
+#ifndef JNI64
_1VtblCall__IIIIIIIII_3I_FUNC,
#else
_1VtblCall__IJIIIIIII_3I_FUNC,
@@ -447,6 +453,11 @@ typedef enum {
_1VtblCall__IJJIIJIIIIIIIIISJ_FUNC,
#endif
#ifndef JNI64
+ _1VtblCall__IIJIIJIIIIIIIIISJFS_FUNC,
+#else
+ _1VtblCall__IJJIIJIIIIIIIIISJFS_FUNC,
+#endif
+#ifndef JNI64
_1VtblCall__IIJIIJ_3I_3J_FUNC,
#else
_1VtblCall__IJJIIJ_3I_3J_FUNC,
@@ -1112,7 +1123,6 @@ typedef enum {
_1nsIScriptContext_1GetNativeContext_FUNC,
_1nsIScriptGlobalObject_1EnsureScriptEnvironment_FUNC,
_1nsIScriptGlobalObject_1GetScriptContext_FUNC,
- _1nsIScriptGlobalObject_1GetScriptGlobal_FUNC,
#ifndef JNI64
memmove__ILorg_eclipse_swt_internal_mozilla_nsDynamicFunctionLoad_2I_FUNC,
#else
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java
index 1b66c52b82..acbbd8a21c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java
@@ -1326,10 +1326,9 @@ public boolean execute (String script) {
new nsISupports (scriptGlobalObject).Release ();
} else {
int /*long*/ scriptContext = XPCOM.nsIScriptGlobalObject_GetScriptContext (scriptGlobalObject, 2); /* nsIProgrammingLanguage.JAVASCRIPT */
- int /*long*/ globalJSObject = XPCOM.nsIScriptGlobalObject_GetScriptGlobal (scriptGlobalObject, 2); /* nsIProgrammingLanguage.JAVASCRIPT */
new nsISupports (scriptGlobalObject).Release ();
- if (scriptContext != 0 && globalJSObject != 0) {
+ if (scriptContext != 0) {
/* ensure that the received nsIScriptContext implements the expected interface */
nsISupports supports = new nsISupports (scriptContext);
nsID scriptContextNSID_10 = new nsID ("2e583bf4-3c1f-432d-8283-8dee7eccc88b"); /* nsIScriptContext */ //$NON-NLS-1$
@@ -1369,23 +1368,26 @@ public boolean execute (String script) {
}
}
- aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_CONTEXTSTACK_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID (aContractID, nsIJSContextStack.NS_IJSCONTEXTSTACK_IID, result);
- if (rc == XPCOM.NS_OK && result[0] != 0) {
- nsIJSContextStack stack = new nsIJSContextStack (result[0]);
- result[0] = 0;
- rc = stack.Push (nativeContext);
- if (rc != XPCOM.NS_OK) {
- stack.Release ();
- } else {
- boolean success = XPCOM.JS_EvaluateUCScriptForPrincipals (pathBytes_JSEvaluateUCScriptForPrincipals, nativeContext, globalJSObject, principals, scriptChars, length, urlbytes, 0, result) != 0;
+ int /*long*/ globalJSObject = XPCOM.JS_GetGlobalObject (pathBytes_JSEvaluateUCScriptForPrincipals, nativeContext);
+ if (globalJSObject != 0) {
+ aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_CONTEXTSTACK_CONTRACTID, true);
+ rc = serviceManager.GetServiceByContractID (aContractID, nsIJSContextStack.NS_IJSCONTEXTSTACK_IID, result);
+ if (rc == XPCOM.NS_OK && result[0] != 0) {
+ nsIJSContextStack stack = new nsIJSContextStack (result[0]);
result[0] = 0;
- rc = stack.Pop (result);
- stack.Release ();
- // should principals be Release()d too?
- principal.Release ();
- serviceManager.Release ();
- return success;
+ rc = stack.Push (nativeContext);
+ if (rc != XPCOM.NS_OK) {
+ stack.Release ();
+ } else {
+ boolean success = XPCOM.JS_EvaluateUCScriptForPrincipals (pathBytes_JSEvaluateUCScriptForPrincipals, nativeContext, globalJSObject, principals, scriptChars, length, urlbytes, 0, result) != 0;
+ result[0] = 0;
+ rc = stack.Pop (result);
+ stack.Release ();
+ // should principals be Release()d too?
+ principal.Release ();
+ serviceManager.Release ();
+ return success;
+ }
}
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java
index bba67f88a2..af4064b37d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java
@@ -201,6 +201,16 @@ public static final int JS_EvaluateUCScriptForPrincipals(byte[] mozillaPath, int
}
}
/** @method flags=no_gen */
+public static final native int /*long*/ _JS_GetGlobalObject(byte[] mozillaPath, int /*long*/ cx);
+public static final int /*long*/ JS_GetGlobalObject(byte[] mozillaPath, int /*long*/ cx) {
+ lock.lock();
+ try {
+ return _JS_GetGlobalObject(mozillaPath, cx);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @method flags=no_gen */
public static final native boolean _NS_Free(byte[] mozillaPath, int /*long*/ aPtr);
public static final boolean NS_Free(byte[] mozillaPath, int /*long*/ aPtr) {
lock.lock();
@@ -336,19 +346,6 @@ public static final int nsIScriptGlobalObject_EnsureScriptEnvironment(int /*long
* @method flags=cpp
* @param ptr cast=(nsIScriptGlobalObject *)
*/
-public static final native int /*long*/ _nsIScriptGlobalObject_GetScriptGlobal(int /*long*/ ptr, int lang);
-public static final int /*long*/ nsIScriptGlobalObject_GetScriptGlobal(int /*long*/ ptr, int lang) {
- lock.lock();
- try {
- return _nsIScriptGlobalObject_GetScriptGlobal(ptr, lang);
- } finally {
- lock.unlock();
- }
-}
-/**
- * @method flags=cpp
- * @param ptr cast=(nsIScriptGlobalObject *)
- */
public static final native int /*long*/ _nsIScriptGlobalObject_GetScriptContext(int /*long*/ ptr, int lang);
public static final int /*long*/ nsIScriptGlobalObject_GetScriptContext(int /*long*/ ptr, int lang) {
lock.lock();