diff options
author | Lakshmi Shanmugam | 2015-05-13 19:07:28 +0000 |
---|---|---|
committer | Lakshmi Shanmugam | 2015-05-13 19:34:02 +0000 |
commit | 6a69a1fd95a7e88062f2270d5c638a035c824208 (patch) | |
tree | 103893342385cc135716cbe80c5b072504b59771 | |
parent | 6b28578ec575cf9b9bc42578b2cd2a249f83e1ad (diff) | |
download | eclipse.platform.swt-6a69a1fd95a7e88062f2270d5c638a035c824208.tar.gz eclipse.platform.swt-6a69a1fd95a7e88062f2270d5c638a035c824208.tar.xz eclipse.platform.swt-6a69a1fd95a7e88062f2270d5c638a035c824208.zip |
Bug 465757 - [Browser][Xulrunner] When browser is using XULRunner, the
browser.evaluate function is always returning null
Patch to put back the code required for BrowserFunction to work on
versions < 24. This code was removed as part of fix for 429739.
The new approach in that fix is used for XULR versions >= 24. For XULR versions < 24, we still need the old code.
5 files changed, 421 insertions, 7 deletions
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 520826cbce..6c3c09a99e 100755 --- 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 @@ -37,9 +37,14 @@ char * XPCOM_nativeFunctionNames[] = { #else "_1Call__JJJ_3BII_3I", #endif + "_1JS_1DefineFunction", + "_1JS_1DefineFunction24", "_1JS_1EvaluateUCScriptForPrincipals", "_1JS_1EvaluateUCScriptForPrincipals191", + "_1JS_1EvaluateUCScriptForPrincipals24", + "_1JS_1GetGlobalForScopeChain24", "_1JS_1GetGlobalObject", + "_1JS_1NewObject", "_1NS_1Free", "_1NS_1GetComponentManager", "_1NS_1GetServiceManager", @@ -1123,7 +1128,11 @@ char * XPCOM_nativeFunctionNames[] = { "_1nsID_1new", "_1nsIMemory_1Alloc", "_1nsIMemory_1Realloc", + "_1nsIScriptContext24_1GetNativeContext", "_1nsIScriptContext_1GetNativeContext", + "_1nsIScriptGlobalObject24_1EnsureScriptEnvironment", + "_1nsIScriptGlobalObject24_1GetGlobalJSObject", + "_1nsIScriptGlobalObject24_1GetScriptContext", "_1nsIScriptGlobalObject_1EnsureScriptEnvironment", "_1nsIScriptGlobalObject_1GetScriptContext", #ifndef JNI64 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 07690abd33..4c5c706076 100755 --- 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 @@ -47,9 +47,14 @@ typedef enum { #else _1Call__JJJ_3BII_3I_FUNC, #endif + _1JS_1DefineFunction_FUNC, + _1JS_1DefineFunction24_FUNC, _1JS_1EvaluateUCScriptForPrincipals_FUNC, _1JS_1EvaluateUCScriptForPrincipals191_FUNC, + _1JS_1EvaluateUCScriptForPrincipals24_FUNC, + _1JS_1GetGlobalForScopeChain24_FUNC, _1JS_1GetGlobalObject_FUNC, + _1JS_1NewObject_FUNC, _1NS_1Free_FUNC, _1NS_1GetComponentManager_FUNC, _1NS_1GetServiceManager_FUNC, @@ -1133,7 +1138,11 @@ typedef enum { _1nsID_1new_FUNC, _1nsIMemory_1Alloc_FUNC, _1nsIMemory_1Realloc_FUNC, + _1nsIScriptContext24_1GetNativeContext_FUNC, _1nsIScriptContext_1GetNativeContext_FUNC, + _1nsIScriptGlobalObject24_1EnsureScriptEnvironment_FUNC, + _1nsIScriptGlobalObject24_1GetGlobalJSObject_FUNC, + _1nsIScriptGlobalObject24_1GetScriptContext_FUNC, _1nsIScriptGlobalObject_1EnsureScriptEnvironment_FUNC, _1nsIScriptGlobalObject_1GetScriptContext_FUNC, #ifndef JNI64 diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/External.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/External.java index b28288c6b5..872f4853e7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/External.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/External.java @@ -28,7 +28,17 @@ class External { XPCOMObject supports; XPCOMObject external; XPCOMObject classInfo; + XPCOMObject securityCheckedComponent; + XPCOMObject scriptObjectOwner; int refCount = 0; + + static final String CALLJAVA = "callJava"; //$NON-NLS-1$ + + static Callback CallJavaProc; + static { + CallJavaProc = new Callback (External.class, CALLJAVA, 3); + if (CallJavaProc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); + } External () { createCOMInterfaces (); @@ -36,6 +46,109 @@ External () { /* external */ +/* + * This is the BrowserFunction entry point for XULRunner releases >= 4 because + * QueryInterface answers an nsIScriptObjectOwner implementation (which points + * at this function) iff the detected XULRunner version is >= 4. + */ +static long /*int*/ callJava (long /*int*/ cx, long /*int*/ argc, long /*int*/ vp) { + int jsval_sizeof = 8; + long /*int*/ argsPtr = vp + 2 * jsval_sizeof; + nsIVariant resultVariant = null; + + long /*int*/[] result = new long /*int*/[1]; + int rc = XPCOM.NS_GetServiceManager (result); + if (rc != XPCOM.NS_OK) Mozilla.error (rc); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + + nsIServiceManager serviceManager = new nsIServiceManager (result[0]); + result[0] = 0; + rc = serviceManager.GetService (XPCOM.NS_IXPCONNECT_CID, IIDStore.GetIID (nsIXPConnect.class), result); + if (rc != XPCOM.NS_OK) Mozilla.error (rc); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + + nsIXPConnect connect = new nsIXPConnect (result[0]); + result[0] = 0; + + /* extract the first argument value (the function id) */ + rc = connect.JSValToVariant (cx, argsPtr, result); + if (rc == XPCOM.NS_OK && result[0] != 0) { + nsIVariant idVariant = new nsIVariant (result[0]); + result[0] = 0; + short[] dataType = new short[1]; + rc = idVariant.GetDataType (dataType); + if (rc == XPCOM.NS_OK && dataType[0] == nsIDataType.VTYPE_INT32) { + int[] intResult = new int[1]; + rc = idVariant.GetAsInt32 (intResult); /* PRInt32 */ + if (rc == XPCOM.NS_OK) { + int functionId = intResult[0]; + + /* get the second argument variant (the token string) */ + argsPtr += jsval_sizeof; + rc = connect.JSValToVariant (cx, argsPtr, result); + if (rc == XPCOM.NS_OK && result[0] != 0) { + long /*int*/ tokenVariant = result[0]; + result[0] = 0; + + /* get the third argument variant (the invocation args) */ + argsPtr += jsval_sizeof; + rc = connect.JSValToVariant (cx, argsPtr, result); + if (rc == XPCOM.NS_OK && result[0] != 0) { + long /*int*/ argsVariant = result[0]; + result[0] = 0; + + /* invoke the BrowserFunction */ + resultVariant = new nsIVariant (invokeFunction (functionId, tokenVariant, argsVariant)); + new nsISupports (argsVariant).Release (); + } + new nsISupports (tokenVariant).Release (); + } + } + } + idVariant.Release (); + } + result[0] = 0; + + /* if the BrowserFunction could not be invoked for some reason then return null to JS */ + if (resultVariant == null) { + rc = XPCOM.NS_GetComponentManager (result); + if (rc != XPCOM.NS_OK) Mozilla.error (rc); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + nsIComponentManager componentManager = new nsIComponentManager (result[0]); + result[0] = 0; + resultVariant = convertToJS (null, componentManager); + componentManager.Release (); + } + + /* convert the resulting variant to a jsval */ + byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); + rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsIMemory.class), result); + if (rc != XPCOM.NS_OK) Mozilla.error (rc); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + serviceManager.Release(); + + nsIMemory memory = new nsIMemory (result[0]); + result[0] = 0; + long /*int*/ jsVal = memory.Alloc (jsval_sizeof); + C.memset (jsVal, 0, jsval_sizeof); + long /*int*/ globalObject = 0; + globalObject = XPCOM.JS_GetGlobalObject (Mozilla.getJSLibPathBytes (), cx); + rc = connect.VariantToJS (cx, globalObject, resultVariant.getAddress (), jsVal); + resultVariant.Release (); + connect.Release (); + + long /*int*/ returnValue = XPCOM.JS_FALSE; + if (rc == XPCOM.NS_OK) { + /* write the jsval to the return value slot */ + C.memmove (vp, jsVal, jsval_sizeof); + returnValue = XPCOM.JS_TRUE; + } + memory.Free (jsVal); + memory.Release (); + return returnValue; +} + +/* this is the BrowserFunction entry point when the detected XULRunner version is < 4 */ static int callJava (int functionId, long /*int*/ tokenVariant, long /*int*/ argsVariant, long /*int*/ returnPtr) { long /*int*/ resultVariant = invokeFunction (functionId, tokenVariant, argsVariant); C.memmove (returnPtr, new long /*int*/[] {resultVariant}, C.PTR_SIZEOF); @@ -360,6 +473,23 @@ void createCOMInterfaces () { public long /*int*/ method10 (long /*int*/[] args) {return getClassIDNoAlloc (args[0]);} }; + securityCheckedComponent = new XPCOMObject (new int[] {2, 0, 0, 2, 3, 3, 3}) { + @Override + public long /*int*/ method0 (long /*int*/[] args) {return QueryInterface (args[0], args[1]);} + @Override + public long /*int*/ method1 (long /*int*/[] args) {return AddRef ();} + @Override + public long /*int*/ method2 (long /*int*/[] args) {return Release ();} + @Override + public long /*int*/ method3 (long /*int*/[] args) {return canCreateWrapper (args[0], args[1]);} + @Override + public long /*int*/ method4 (long /*int*/[] args) {return canCallMethod (args[0], args[1], args[2]);} + @Override + public long /*int*/ method5 (long /*int*/[] args) {return canGetProperty (args[0], args[1], args[2]);} + @Override + public long /*int*/ method6 (long /*int*/[] args) {return canSetProperty (args[0], args[1], args[2]);} + }; + external = new XPCOMObject (new int[] {2, 0, 0, 4}) { @Override public long /*int*/ method0 (long /*int*/[] args) {return QueryInterface (args[0], args[1]);} @@ -370,6 +500,19 @@ void createCOMInterfaces () { @Override public long /*int*/ method3 (long /*int*/[] args) {return callJava ((int)/*64*/args[0], args[1], args[2], args[3]);} }; + + scriptObjectOwner = new XPCOMObject (new int[] {2, 0, 0, 2, 1}) { + @Override + public long /*int*/ method0 (long /*int*/[] args) {return QueryInterface (args[0], args[1]);} + @Override + public long /*int*/ method1 (long /*int*/[] args) {return AddRef ();} + @Override + public long /*int*/ method2 (long /*int*/[] args) {return Release ();} + @Override + public long /*int*/ method3 (long /*int*/[] args) {return getScriptObject (args[0], args[1]);} + @Override + public long /*int*/ method4 (long /*int*/[] args) {return setScriptObject (args[0]);} + }; } void disposeCOMInterfaces () { @@ -381,10 +524,18 @@ void disposeCOMInterfaces () { classInfo.dispose (); classInfo = null; } + if (securityCheckedComponent != null) { + securityCheckedComponent.dispose (); + securityCheckedComponent = null; + } if (external != null) { external.dispose (); external = null; } + if (scriptObjectOwner != null) { + scriptObjectOwner.dispose (); + scriptObjectOwner = null; + } } long /*int*/ getAddress () { @@ -406,12 +557,25 @@ int QueryInterface (long /*int*/ riid, long /*int*/ ppvObject) { AddRef(); return XPCOM.NS_OK; } + if (guid.Equals (XPCOM.NS_ISECURITYCHECKEDCOMPONENT_IID)) { + XPCOM.memmove (ppvObject, new long /*int*/[] {securityCheckedComponent.getAddress ()}, C.PTR_SIZEOF); + AddRef(); + return XPCOM.NS_OK; + } if (guid.Equals (EXTERNAL_IID)) { XPCOM.memmove (ppvObject, new long /*int*/[] {external.getAddress ()}, C.PTR_SIZEOF); AddRef(); return XPCOM.NS_OK; } + if (MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR10)) { + if (guid.Equals (XPCOM.NS_ISCRIPTOBJECTOWNER_IID)) { + XPCOM.memmove (ppvObject, new long /*int*/[] {scriptObjectOwner.getAddress ()}, C.PTR_SIZEOF); + AddRef(); + return XPCOM.NS_OK; + } + } + XPCOM.memmove (ppvObject, new long /*int*/[] {0}, C.PTR_SIZEOF); return XPCOM.NS_ERROR_NO_INTERFACE; } @@ -492,15 +656,148 @@ int getInterfaces (long /*int*/ count, long /*int*/ array) { nsIMemory memory = new nsIMemory (result[0]); result[0] = 0; + long /*int*/ securityCheckedComponentIID = memory.Alloc (nsID.sizeof); + XPCOM.memmove (securityCheckedComponentIID, XPCOM.NS_ISECURITYCHECKEDCOMPONENT_IID, nsID.sizeof); long /*int*/ externalIID = memory.Alloc (nsID.sizeof); XPCOM.memmove (externalIID, EXTERNAL_IID, nsID.sizeof); - long /*int*/ ptrArray = memory.Alloc (C.PTR_SIZEOF); - C.memmove (ptrArray, new long /*int*/[] {externalIID}, C.PTR_SIZEOF); + long /*int*/ ptrArray = memory.Alloc (3 * C.PTR_SIZEOF); + C.memmove (ptrArray, new long /*int*/[] {securityCheckedComponentIID}, C.PTR_SIZEOF); + C.memmove (ptrArray + C.PTR_SIZEOF, new long /*int*/[] {externalIID}, C.PTR_SIZEOF); C.memmove (array, new long /*int*/[] {ptrArray}, C.PTR_SIZEOF); memory.Release (); - C.memmove (count, new int[] {1}, 4); /* PRUint */ + C.memmove (count, new int[] {2}, 4); /* PRUint */ + return XPCOM.NS_OK; +} + +/* nsIScriptObjectOwner */ + +int getScriptObject (long /*int*/ aContext, long /*int*/ aScriptObject) { + byte[] jsLibPath = Mozilla.getJSLibPathBytes (); + long /*int*/ nativeContext = XPCOM.nsIScriptContext_GetNativeContext (aContext); + long /*int*/ globalJSObject = XPCOM.JS_GetGlobalObject (jsLibPath, nativeContext); + long /*int*/ newObject = XPCOM.JS_NewObject (jsLibPath, nativeContext, 0, 0, globalJSObject); + + byte[] functionName = MozillaDelegate.wcsToMbcs (null, CALLJAVA, true); + int flags = XPCOM.JSPROP_ENUMERATE | XPCOM.JSPROP_READONLY | XPCOM.JSPROP_PERMANENT; + XPCOM.JS_DefineFunction (jsLibPath, nativeContext, newObject, functionName, XPCOM.CALLBACK_JSNative (CallJavaProc.getAddress ()), 3, flags); + XPCOM.memmove (aScriptObject, new long /*int*/[] {newObject}, C.PTR_SIZEOF); + return XPCOM.NS_OK; +} + +int setScriptObject (long /*int*/ aScriptObject) { + return XPCOM.NS_COMFALSE; +} + +/* nsISecurityCheckedComponent */ + +int canCreateWrapper (long /*int*/ iid, long /*int*/ _retVal) { + long /*int*/[] result = new long /*int*/[1]; + int rc = XPCOM.NS_GetServiceManager (result); + if (rc != XPCOM.NS_OK) Mozilla.error (rc); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + + nsIServiceManager serviceManager = new nsIServiceManager (result[0]); + result[0] = 0; + byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); + rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsIMemory.class), result); + if (rc != XPCOM.NS_OK) Mozilla.error (rc); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + serviceManager.Release (); + + nsIMemory memory = new nsIMemory (result[0]); + result[0] = 0; + byte[] bytes = MozillaDelegate.wcsToMbcs (null, "allAccess", true); //$NON-NLS-1$ + long /*int*/ ptr = memory.Alloc (bytes.length); + C.memmove (ptr, bytes, bytes.length); + C.memmove (_retVal, new long /*int*/[] {ptr}, C.PTR_SIZEOF); + memory.Release (); + + return XPCOM.NS_OK; +} + +int canCallMethod (long /*int*/ iid, long /*int*/ methodName, long /*int*/ _retVal) { + long /*int*/[] result = new long /*int*/[1]; + int rc = XPCOM.NS_GetServiceManager (result); + if (rc != XPCOM.NS_OK) Mozilla.error (rc); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + + nsIServiceManager serviceManager = new nsIServiceManager (result[0]); + result[0] = 0; + byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); + rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsIMemory.class), result); + if (rc != XPCOM.NS_OK) Mozilla.error (rc); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + serviceManager.Release (); + + nsIMemory memory = new nsIMemory (result[0]); + result[0] = 0; + int length = XPCOM.strlen_PRUnichar (methodName); + char[] dest = new char[length]; + XPCOM.memmove (dest, methodName, length * 2); + String string = new String (dest); + byte[] bytes; + if (string.equals (CALLJAVA)) { + bytes = MozillaDelegate.wcsToMbcs (null, "allAccess", true); //$NON-NLS-1$ + } else { + bytes = MozillaDelegate.wcsToMbcs (null, "noAccess", true); //$NON-NLS-1$ + } + long /*int*/ ptr = memory.Alloc (bytes.length); + C.memmove (ptr, bytes, bytes.length); + C.memmove (_retVal, new long /*int*/[] {ptr}, C.PTR_SIZEOF); + memory.Release (); + + return XPCOM.NS_OK; +} + +int canGetProperty (long /*int*/ iid, long /*int*/ propertyName, long /*int*/ _retVal) { + long /*int*/[] result = new long /*int*/[1]; + int rc = XPCOM.NS_GetServiceManager (result); + if (rc != XPCOM.NS_OK) Mozilla.error (rc); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + + nsIServiceManager serviceManager = new nsIServiceManager (result[0]); + result[0] = 0; + byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); + rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsIMemory.class), result); + if (rc != XPCOM.NS_OK) Mozilla.error (rc); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + serviceManager.Release (); + + nsIMemory memory = new nsIMemory (result[0]); + result[0] = 0; + byte[] bytes = MozillaDelegate.wcsToMbcs (null, "noAccess", true); //$NON-NLS-1$ + long /*int*/ ptr = memory.Alloc (bytes.length); + C.memmove (ptr, bytes, bytes.length); + C.memmove (_retVal, new long /*int*/[] {ptr}, C.PTR_SIZEOF); + memory.Release (); + + return XPCOM.NS_OK; +} + +int canSetProperty (long /*int*/ iid, long /*int*/ propertyName, long /*int*/ _retVal) { + long /*int*/[] result = new long /*int*/[1]; + int rc = XPCOM.NS_GetServiceManager (result); + if (rc != XPCOM.NS_OK) Mozilla.error (rc); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + + nsIServiceManager serviceManager = new nsIServiceManager (result[0]); + result[0] = 0; + byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); + rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsIMemory.class), result); + if (rc != XPCOM.NS_OK) Mozilla.error (rc); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + serviceManager.Release (); + + nsIMemory memory = new nsIMemory (result[0]); + result[0] = 0; + byte[] bytes = MozillaDelegate.wcsToMbcs (null, "noAccess", true); //$NON-NLS-1$ + long /*int*/ ptr = memory.Alloc (bytes.length); + C.memmove (ptr, bytes, bytes.length); + C.memmove (_retVal, new long /*int*/[] {ptr}, C.PTR_SIZEOF); + memory.Release (); + return XPCOM.NS_OK; } 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 caa59a8786..f3be017783 100755 --- 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 @@ -182,6 +182,15 @@ public class XPCOM extends C { public static final int SEC_ERROR_UNTRUSTED_CERT = 0x805A1FEB; public static final int SEC_ERROR_UNTRUSTED_ISSUER = 0x805A1FEC; public static final int SSL_ERROR_BAD_CERT_DOMAIN = 0x805A2FF4; + public static final int USE_JSSTUB_FOR_ADDPROPERTY = 1 << 17; + public static final int WANT_POSTCREATE = 4; + + /* JSAPI constants */ + public static final int JSPROP_ENUMERATE = 0x1; + public static final int JSPROP_PERMANENT = 0x4; + public static final int JSPROP_READONLY = 0x2; + public static final int JS_FALSE = 0x0; + public static final int JS_TRUE = 0x1; public static final native int nsDynamicFunctionLoad_sizeof (); @@ -232,7 +241,27 @@ public static final native long /*int*/ CALLBACK_GetScriptableFlags24(long /*int public static final native long /*int*/ CALLBACK_JSNative(long /*int*/ func); /** @method flags=no_gen */ -public static final native int _JS_EvaluateUCScriptForPrincipals(byte[] mozillaPath, long /*int*/ cx, long /*int*/ obj, long /*int*/ principals, char[] chars, int length, byte[] filename, int lineno, long /*int*/[] retVal); +public static final native long /*int*/ _JS_DefineFunction(byte[] mozillaPath, long /*int*/ cx, long /*int*/ obj, byte[] name, long /*int*/ call, int nargs, int flags); +public static final long /*int*/ JS_DefineFunction(byte[] mozillaPath, long /*int*/ cx, long /*int*/ obj, byte[] name, long /*int*/ call, int nargs, int flags) { + lock.lock(); + try { + return _JS_DefineFunction(mozillaPath, cx, obj, name, call, nargs, flags); + } finally { + lock.unlock(); + } +} +/** @method flags=no_gen */ +public static final native long /*int*/ _JS_DefineFunction24(long /*int*/ cx, long /*int*/ obj, byte[] name, long /*int*/ call, int nargs, int flags); +public static final long /*int*/ JS_DefineFunction24(long /*int*/ cx, long /*int*/ obj, byte[] name, long /*int*/ call, int nargs, int flags) { + lock.lock(); + try { + return _JS_DefineFunction24(cx, obj, name, call, nargs, flags); + } finally { + lock.unlock(); + } +} +/** @method flags=no_gen */ +public static final native int _JS_EvaluateUCScriptForPrincipals(byte[] mozillaPath, long /*int*/ cx, long /*int*/ obj, long /*int*/ principals, char[] chars, int length, byte[] filename, int lineno, long /*int*/[] retVal); public static final int JS_EvaluateUCScriptForPrincipals(byte[] mozillaPath, long /*int*/ cx, long /*int*/ obj, long /*int*/ principals, char[] chars, int length, byte[] filename, int lineno, long /*int*/[] retVal) { lock.lock(); try { @@ -252,7 +281,27 @@ public static final int JS_EvaluateUCScriptForPrincipals191(byte[] mozillaPath, } } /** @method flags=no_gen */ -public static final native long /*int*/ _JS_GetGlobalObject(byte[] mozillaPath, long /*int*/ cx); +public static final native int _JS_EvaluateUCScriptForPrincipals24(byte[] mozillaPath, long /*int*/ cx, long /*int*/ obj, long /*int*/ principals, char[] chars, int length, byte[] filename, int lineno, long /*int*/ retVal); +public static final int JS_EvaluateUCScriptForPrincipals24(byte[] mozillaPath, long /*int*/ cx, long /*int*/ obj, long /*int*/ principals, char[] chars, int length, byte[] filename, int lineno, long /*int*/ retVal) { + lock.lock(); + try { + return _JS_EvaluateUCScriptForPrincipals24(mozillaPath, cx, obj, principals, chars, length, filename, lineno, retVal); + } finally { + lock.unlock(); + } +} +/** @method flags=no_gen */ +public static final native long /*int*/ _JS_GetGlobalForScopeChain24(long /*int*/ cx); +public static final long /*int*/ JS_GetGlobalForScopeChain24(long /*int*/ cx) { + lock.lock(); + try { + return _JS_GetGlobalForScopeChain24(cx); + } finally { + lock.unlock(); + } +} +/** @method flags=no_gen */ +public static final native long /*int*/ _JS_GetGlobalObject(byte[] mozillaPath, long /*int*/ cx); public static final long /*int*/ JS_GetGlobalObject(byte[] mozillaPath, long /*int*/ cx) { lock.lock(); try { @@ -262,6 +311,16 @@ public static final long /*int*/ JS_GetGlobalObject(byte[] mozillaPath, long /*i } } /** @method flags=no_gen */ +public static final native long /*int*/ _JS_NewObject(byte[] mozillaPath, long /*int*/ cx, long /*int*/ clasp, long /*int*/ proto, long /*int*/ parent); +public static final long /*int*/ JS_NewObject(byte[] mozillaPath, long /*int*/ cx, long /*int*/ clasp, long /*int*/ proto, long /*int*/ parent) { + lock.lock(); + try { + return _JS_NewObject(mozillaPath, cx, clasp, proto, parent); + } finally { + lock.unlock(); + } +} +/** @method flags=no_gen */ public static final native boolean _NS_Free(byte[] mozillaPath, long /*int*/ aPtr); public static final boolean NS_Free(byte[] mozillaPath, long /*int*/ aPtr) { lock.lock(); @@ -393,6 +452,26 @@ public static final int nsIScriptGlobalObject_EnsureScriptEnvironment(long /*int lock.unlock(); } } +/** @method flags=no_gen */ +public static final native int _nsIScriptGlobalObject24_EnsureScriptEnvironment(long /*int*/ ptr); +public static final int nsIScriptGlobalObject24_EnsureScriptEnvironment(long /*int*/ ptr) { + lock.lock(); + try { + return _nsIScriptGlobalObject24_EnsureScriptEnvironment(ptr); + } finally { + lock.unlock(); + } +} +/** @method flags=no_gen */ +public static final native long /*int*/ _nsIScriptGlobalObject24_GetGlobalJSObject(long /*int*/ ptr); +public static final long /*int*/ nsIScriptGlobalObject24_GetGlobalJSObject(long /*int*/ ptr) { + lock.lock(); + try { + return _nsIScriptGlobalObject24_GetGlobalJSObject(ptr); + } finally { + lock.unlock(); + } +} /** * @method flags=cpp * @param ptr cast=(nsIScriptGlobalObject *) @@ -406,6 +485,16 @@ public static final long /*int*/ nsIScriptGlobalObject_GetScriptContext(long /*i lock.unlock(); } } +/** @method flags=no_gen */ +public static final native long /*int*/ _nsIScriptGlobalObject24_GetScriptContext(long /*int*/ ptr); +public static final long /*int*/ nsIScriptGlobalObject24_GetScriptContext(long /*int*/ ptr) { + lock.lock(); + try { + return _nsIScriptGlobalObject24_GetScriptContext(ptr); + } finally { + lock.unlock(); + } +} /** * @method flags=cpp * @param ptr cast=(nsIScriptContext *) @@ -419,6 +508,16 @@ public static final long /*int*/ nsIScriptContext_GetNativeContext(long /*int*/ lock.unlock(); } } +/** @method flags=no_gen */ +public static final native long /*int*/ _nsIScriptContext24_GetNativeContext(long /*int*/ ptr); +public static final long /*int*/ nsIScriptContext24_GetNativeContext(long /*int*/ ptr) { + lock.lock(); + try { + return _nsIScriptContext24_GetNativeContext(ptr); + } finally { + lock.unlock(); + } +} /** * @method flags=cpp * @param ptr cast=(nsEmbedCString *) diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIXPConnect.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIXPConnect.java index c3f5136a0f..3fb93abddc 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIXPConnect.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIXPConnect.java @@ -47,10 +47,10 @@ public class nsIXPConnect extends nsISupports { } public int JSValToVariant(long /*int*/ cx, long /*int*/ aJSVal, long /*int*/[] _retval) { - return XPCOM.VtblCall(this.getMethodIndex("JSValToVariant"), getAddress(), cx, aJSVal, _retval); + return XPCOM.VtblCall(this.getMethodIndex("jSValToVariant"), getAddress(), cx, aJSVal, _retval); } public int VariantToJS(long /*int*/ ctx, long /*int*/ scope, long /*int*/ value, long /*int*/ _retval) { - return XPCOM.VtblCall(this.getMethodIndex("VariantToJS"), getAddress(), ctx, scope, value, _retval); + return XPCOM.VtblCall(this.getMethodIndex("variantToJS"), getAddress(), ctx, scope, value, _retval); } } |