Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 248258 Details for
Bug 429739
Permission denied to access property ''
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Fix
0001-Fix-for-Eclipse-bug-429739.patch (text/plain), 48.28 KB, created by
Neil Rashbrook
on 2014-10-29 13:31:16 EDT
(
hide
)
Description:
Fix
Filename:
MIME Type:
Creator:
Neil Rashbrook
Created:
2014-10-29 13:31:16 EDT
Size:
48.28 KB
patch
obsolete
>From c24bd8d007506777b373a212dd0701cc176a5d0e Mon Sep 17 00:00:00 2001 >From: Neil Rashbrook <neil@parkwaycc.co.uk> >Date: Wed, 29 Oct 2014 17:21:12 +0000 >Subject: [PATCH] Fix for Eclipse bug 429739. > >--- > .../eclipse/swt/browser/AppFileLocProvider.java | 6 +- > .../common/org/eclipse/swt/browser/External.java | 416 +-------------------- > .../common/org/eclipse/swt/browser/Mozilla.java | 170 +++++++-- > .../org/eclipse/swt/internal/mozilla/Execute.java | 48 +++ > .../org/eclipse/swt/internal/mozilla/XPCOM.java | 100 +---- > bundles/org.eclipse.swt/components/external.idl | 21 -- > bundles/org.eclipse.swt/components/external.xpt | Bin 187 -> 0 bytes > bundles/org.eclipse.swt/components/swt.idl | 30 ++ > bundles/org.eclipse.swt/components/swt.js | 30 ++ > bundles/org.eclipse.swt/components/swt.xpt | Bin 0 -> 360 bytes > 10 files changed, 256 insertions(+), 565 deletions(-) > create mode 100644 bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/Execute.java > delete mode 100644 bundles/org.eclipse.swt/components/external.idl > delete mode 100644 bundles/org.eclipse.swt/components/external.xpt > create mode 100644 bundles/org.eclipse.swt/components/swt.idl > create mode 100644 bundles/org.eclipse.swt/components/swt.js > create mode 100644 bundles/org.eclipse.swt/components/swt.xpt > >diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/AppFileLocProvider.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/AppFileLocProvider.java >index a77be13..f70c8a9 100644 >--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/AppFileLocProvider.java >+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/AppFileLocProvider.java >@@ -293,15 +293,15 @@ int getFile(long /*int*/ prop, long /*int*/ persistent, long /*int*/ _retval) { > } else if (propertyName.equals (XPCOM.NS_GRE_DIR)) { > propertyValue = mozillaPath; > } else if (propertyName.equals (XPCOM.NS_GRE_COMPONENT_DIR)) { >- propertyValue = profilePath + COMPONENTS_DIR; >+ propertyValue = mozillaPath + COMPONENTS_DIR; > } else if (propertyName.equals (XPCOM.NS_XPCOM_INIT_CURRENT_PROCESS_DIR)) { > propertyValue = mozillaPath; > } else if (propertyName.equals (XPCOM.NS_OS_CURRENT_PROCESS_DIR)) { > propertyValue = mozillaPath; > } else if (propertyName.equals (XPCOM.NS_XPCOM_COMPONENT_DIR)) { >- propertyValue = mozillaPath + COMPONENTS_DIR; >+ propertyValue = profilePath + COMPONENTS_DIR; > } else if (propertyName.equals (XPCOM.NS_XPCOM_CURRENT_PROCESS_DIR)) { >- propertyValue = mozillaPath; >+ propertyValue = profilePath; > } else if (propertyName.equals (XPCOM.NS_APP_PREF_DEFAULTS_50_DIR)) { > /* > * Answering a value for this property causes problems in Mozilla versions >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 2a238f3..8a1df9b 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 >@@ -25,27 +25,7 @@ class External { > XPCOMObject supports; > XPCOMObject external; > XPCOMObject classInfo; >- XPCOMObject securityCheckedComponent; >- XPCOMObject scriptObjectOwner; >- XPCOMObject xpcScriptable; > int refCount = 0; >- >- static final String CALLJAVA = "callJava"; //$NON-NLS-1$ >- >- static Callback CallJavaProc, GetScriptableFlags24Proc = null; >- static { >- CallJavaProc = new Callback (External.class, CALLJAVA, 3); >- if (CallJavaProc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); >- >- /* >- * On win32 a substitute callback is provided for nsIXPCScriptable.getScriptableFlags() >- * because it does not use the standard XPCOM calling convention. >- */ >- if (MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR24) && SWT.getPlatform ().equals ("win32")) { //$NON-NLS-1$ >- GetScriptableFlags24Proc = new Callback (External.class, "getScriptableFlags", 0); //$NON-NLS-1$ >- if (GetScriptableFlags24Proc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); >- } >- } > > External () { > createCOMInterfaces (); >@@ -53,121 +33,17 @@ 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; >- if (MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR24)) { >- globalObject = XPCOM.JS_GetGlobalForScopeChain24 (cx); >- } else { >- 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); > return XPCOM.NS_OK; > } > >-static Object convertToJava (nsIVariant variant, short type) { >- switch (type) { >+static Object convertToJava (nsIVariant variant) { >+ short[] dataType = new short[1]; >+ int rc = variant.GetDataType (dataType); >+ if (rc != XPCOM.NS_OK) Mozilla.error (rc); >+ switch (dataType[0]) { > case nsIDataType.VTYPE_EMPTY: > case nsIDataType.VTYPE_VOID: > return null; >@@ -175,7 +51,7 @@ static Object convertToJava (nsIVariant variant, short type) { > return new Object[0]; > case nsIDataType.VTYPE_BOOL: > int[] boolResult = new int[1]; /*PRInt32*/ >- int rc = variant.GetAsBool (boolResult); >+ rc = variant.GetAsBool (boolResult); > if (rc != XPCOM.NS_OK) Mozilla.error (rc); > return new Boolean (boolResult[0] != 0); > case nsIDataType.VTYPE_INT32: >@@ -241,11 +117,9 @@ static Object convertToJava (nsIVariant variant, short type) { > > nsIVariant currentVariant = new nsIVariant (result[0]); > result[0] = 0; >- currentType[0] = 0; >- rc = currentVariant.GetDataType (currentType); > if (rc != XPCOM.NS_OK) Mozilla.error (rc); > try { >- arrayReturn[i] = convertToJava (currentVariant, currentType[0]); >+ arrayReturn[i] = convertToJava (currentVariant); > currentVariant.Release (); > } catch (IllegalArgumentException e) { > /* invalid argument value type */ >@@ -395,19 +269,13 @@ static long /*int*/ invokeFunction (int functionId, long /*int*/ tokenVariant, l > > if (function != null) { > try { >- short[] type = new short[1]; /* PRUint16 */ > nsIVariant variant = new nsIVariant (tokenVariant); >- int rc = variant.GetDataType (type); >- if (rc != XPCOM.NS_OK) Mozilla.error (rc); >- Object temp = convertToJava (variant, type[0]); >- type[0] = 0; >+ Object temp = convertToJava (variant); > if (temp instanceof String) { > String token = (String)temp; > if (token.equals (function.token)) { > variant = new nsIVariant (args); >- rc = variant.GetDataType (type); >- if (rc != XPCOM.NS_OK) Mozilla.error (rc); >- temp = convertToJava (variant, type[0]); >+ temp = convertToJava (variant); > if (temp instanceof Object[]) { > Object[] arguments = (Object[])temp; > try { >@@ -488,23 +356,6 @@ 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]);} >@@ -515,44 +366,6 @@ 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]);} >- }; >- >- xpcScriptable = new XPCOMObject (new int[] {2, 0, 0, 1, 0, 4, 3, 3, 3, 6, 5, 6, 6, 4, 7, 7, 6, 3, 7, 5, 5, 6, 4, 2}) { >- @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 getClassName (args[0]);} >- @Override >- public long /*int*/ method4 (long /*int*/[] args) {return getScriptableFlags ();} >- @Override >- public long /*int*/ method7 (long /*int*/[] args) {return postCreate (args[0], args[1], args[2]);} >- }; >- >- if (GetScriptableFlags24Proc != null) { >- long /*int*/ ppVtable = xpcScriptable.getVtable (); >- long /*int*/[] pVtable = new long /*int*/[1]; >- C.memmove (pVtable, ppVtable, C.PTR_SIZEOF); >- long /*int*/[] funcs = new long /*int*/[24]; >- C.memmove (funcs, pVtable[0], C.PTR_SIZEOF * funcs.length); >- funcs[4] = XPCOM.CALLBACK_GetScriptableFlags24 (GetScriptableFlags24Proc.getAddress ()); >- C.memmove (pVtable[0], funcs, C.PTR_SIZEOF * funcs.length); >- } > } > > void disposeCOMInterfaces () { >@@ -564,22 +377,10 @@ 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; >- } >- if (xpcScriptable != null) { >- xpcScriptable.dispose (); >- xpcScriptable = null; >- } > } > > long /*int*/ getAddress () { >@@ -601,32 +402,12 @@ 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; >- } >- if (MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR24)) { >- if (guid.Equals (XPCOM.NS_IXPCSCRIPTABLE_IID)) { >- XPCOM.memmove (ppvObject, new long /*int*/[] {xpcScriptable.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; > } >@@ -677,7 +458,7 @@ int getContractID (long /*int*/ _retValue) { > } > > int getFlags (long /*int*/ flags) { >- C.memmove (flags, new int[] {nsIClassInfo.MAIN_THREAD_ONLY}, 4); /* PRUint32 */ >+ C.memmove (flags, new int[] {nsIClassInfo.DOM_OBJECT}, 4); /* PRUint32 */ > return XPCOM.NS_OK; > } > >@@ -707,187 +488,16 @@ 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 (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); >+ long /*int*/ ptrArray = memory.Alloc (C.PTR_SIZEOF); >+ C.memmove (ptrArray, new long /*int*/[] {externalIID}, C.PTR_SIZEOF); > > C.memmove (array, new long /*int*/[] {ptrArray}, C.PTR_SIZEOF); > memory.Release (); > >- 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); >+ C.memmove (count, new int[] {1}, 4); /* PRUint */ > 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; >-} >- >-/* nsIXPCScriptable */ >- >-long /*int*/ getClassName (long /*int*/ aClassName) { >- 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, "external", true); //$NON-NLS-1$ >- long /*int*/ ptr = memory.Alloc (bytes.length); >- C.memmove (ptr, bytes, bytes.length); >- C.memmove (aClassName, new long /*int*/[] {ptr}, C.PTR_SIZEOF); >- memory.Release (); >- >- return 0; >-} >- >-static long /*int*/ getScriptableFlags () { >- return XPCOM.WANT_POSTCREATE | XPCOM.USE_JSSTUB_FOR_ADDPROPERTY; >-} >- >-int postCreate (long /*int*/ wrapper, long /*int*/ cx, long /*int*/ obj) { >- byte[] functionName = MozillaDelegate.wcsToMbcs (null, CALLJAVA, true); >- int flags = XPCOM.JSPROP_ENUMERATE | XPCOM.JSPROP_READONLY | XPCOM.JSPROP_PERMANENT; >- XPCOM.JS_DefineFunction24 (cx, obj, functionName, XPCOM.CALLBACK_JSNative (CallJavaProc.getAddress ()), 3, flags); >- return 0; >-} >- > } >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 267df39..3d1cd4f 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 >@@ -702,7 +702,7 @@ public void create (Composite parent, int style) { > LocationProvider = new AppFileLocProvider (MozillaPath, profilePath, cacheParentPath, IsXULRunner); > LocationProvider.AddRef (); > >- /* write external.xpt to the file system if needed */ >+ /* write swt.xpt to the file system if needed */ > initExternal (LocationProvider.profilePath); > > /* invoke appropriate Init function (based on mozilla version) */ >@@ -1392,6 +1392,51 @@ void disposeCOMInterfaces () { > } > > @Override >+public Object evaluate (String script) throws SWTException { >+ if (!MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR24)) >+ return super.evaluate (script); >+ >+ delegate.removeWindowSubclass (); >+ >+ long /*int*/[] result = new long /*int*/[1]; >+ int rc = webBrowser.QueryInterface(IIDStore.GetIID (nsIInterfaceRequestor.class), result); >+ if (rc != XPCOM.NS_OK) error (rc); >+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); >+ nsIInterfaceRequestor interfaceRequestor = new nsIInterfaceRequestor (result[0]); >+ result[0] = 0; >+ rc = XPCOM.NS_GetServiceManager (result); >+ if (rc != XPCOM.NS_OK) error (rc); >+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); >+ >+ nsIServiceManager serviceManager = new nsIServiceManager (result[0]); >+ result[0] = 0; >+ rc = interfaceRequestor.GetInterface (IIDStore.GetIID (nsIDOMWindow.class), result); >+ interfaceRequestor.Release (); >+ if (rc != XPCOM.NS_OK) error (rc); >+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); >+ >+ nsIDOMWindow window = new nsIDOMWindow (result[0]); >+ result[0] = 0; >+ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.EXECUTE_CONTRACTID, true); >+ rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (Execute.class), result); >+ if (rc != XPCOM.NS_OK) error (rc); >+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); >+ >+ Execute execute = new Execute (result[0]); >+ result[0] = 0; >+ nsEmbedString data = new nsEmbedString (script); >+ execute.EvalInWindow (window, data, result); >+ data.dispose (); >+ execute.Release (); >+ if (result[0] == 0) >+ return null; >+ >+ nsIVariant variant = new nsIVariant (result[0]); >+ Object retval = External.convertToJava (variant); >+ variant.Release (); >+ return retval; >+} >+@Override > public boolean execute (String script) { > /* > * This could be the first content that is set into the browser, so >@@ -1400,6 +1445,50 @@ public boolean execute (String script) { > */ > delegate.removeWindowSubclass (); > >+ long /*int*/[] result = new long /*int*/[1]; >+ /* >+ * As of mozilla 1.9 executing javascript via the javascript: protocol no >+ * longer happens synchronously. As a result, the result of executing JS >+ * is not returned to the java side when expected by the client. The >+ * workaround for version 24 is to use a javascript-implemented component >+ * which then executes synchronously. >+ */ >+ if (MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR24)) { >+ result[0] = 0; >+ int rc = webBrowser.QueryInterface(IIDStore.GetIID (nsIInterfaceRequestor.class), result); >+ if (rc != XPCOM.NS_OK) error (rc); >+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); >+ nsIInterfaceRequestor interfaceRequestor = new nsIInterfaceRequestor (result[0]); >+ result[0] = 0; >+ rc = XPCOM.NS_GetServiceManager (result); >+ if (rc != XPCOM.NS_OK) error (rc); >+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); >+ >+ nsIServiceManager serviceManager = new nsIServiceManager (result[0]); >+ result[0] = 0; >+ rc = interfaceRequestor.GetInterface (IIDStore.GetIID (nsIDOMWindow.class), result); >+ interfaceRequestor.Release (); >+ if (rc != XPCOM.NS_OK) error (rc); >+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); >+ >+ nsIDOMWindow window = new nsIDOMWindow (result[0]); >+ result[0] = 0; >+ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.EXECUTE_CONTRACTID, true); >+ rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (Execute.class), result); >+ if (rc != XPCOM.NS_OK) error (rc); >+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); >+ >+ Execute execute = new Execute (result[0]); >+ result[0] = 0; >+ nsEmbedString data = new nsEmbedString (script); >+ execute.EvalInWindow (window, data, result); >+ if (result[0] != 0) >+ new nsIVariant (result[0]).Release (); >+ data.dispose (); >+ execute.Release (); >+ return true; >+ } >+ > /* > * As of mozilla 1.9 executing javascript via the javascript: protocol no > * longer happens synchronously. As a result, the result of executing JS >@@ -1407,7 +1496,6 @@ public boolean execute (String script) { > * workaround is to invoke the javascript handler directly via C++, which is > * exposed as of mozilla 1.9. > */ >- long /*int*/[] result = new long /*int*/[1]; > if (MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR1_9)) { > int rc = XPCOM.NS_GetServiceManager (result); > if (rc != XPCOM.NS_OK) error (rc); >@@ -1439,20 +1527,11 @@ public boolean execute (String script) { > if (rc == XPCOM.NS_OK && result[0] != 0) { > long /*int*/ scriptGlobalObject = result[0]; > result[0] = 0; >- if (MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR24)) { /* >= 24.x */ >- rc = (int/*64*/)XPCOM.nsIScriptGlobalObject24_EnsureScriptEnvironment (scriptGlobalObject); >- } else { >- rc = (int/*64*/)XPCOM.nsIScriptGlobalObject_EnsureScriptEnvironment (scriptGlobalObject, 2); /* nsIProgrammingLanguage.JAVASCRIPT */ >- } >+ rc = (int/*64*/)XPCOM.nsIScriptGlobalObject_EnsureScriptEnvironment (scriptGlobalObject, 2); /* nsIProgrammingLanguage.JAVASCRIPT */ > if (rc != XPCOM.NS_OK) { > new nsISupports (scriptGlobalObject).Release (); > } else { >- long /*int*/ scriptContext; >- if (MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR24)) { /* >= 24.x */ >- scriptContext = XPCOM.nsIScriptGlobalObject24_GetScriptContext (scriptGlobalObject); >- } else { >- scriptContext = XPCOM.nsIScriptGlobalObject_GetScriptContext (scriptGlobalObject, 2); /* nsIProgrammingLanguage.JAVASCRIPT */ >- } >+ long /*int*/ scriptContext = XPCOM.nsIScriptGlobalObject_GetScriptContext (scriptGlobalObject, 2); /* nsIProgrammingLanguage.JAVASCRIPT */ > > if (scriptContext != 0) { > /* ensure that the received nsIScriptContext implements the expected interface */ >@@ -1462,12 +1541,7 @@ public boolean execute (String script) { > new nsISupports (result[0]).Release (); > result[0] = 0; > >- long /*int*/ jsContext; >- if (MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR24)) { /* >= 24.x */ >- jsContext = XPCOM.nsIScriptContext24_GetNativeContext (scriptContext); >- } else { >- jsContext = XPCOM.nsIScriptContext_GetNativeContext (scriptContext); >- } >+ long /*int*/ jsContext = XPCOM.nsIScriptContext_GetNativeContext (scriptContext); > if (jsContext != 0) { > int length = script.length (); > char[] scriptChars = new char[length]; >@@ -1480,22 +1554,8 @@ public boolean execute (String script) { > result[0] = 0; > } > byte[] jsLibPath = getJSLibPathBytes (); >- long /*int*/ globalJSObject; >- if (MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR24)) { /* >= 24.x */ >- globalJSObject = XPCOM.nsIScriptGlobalObject24_GetGlobalJSObject (scriptGlobalObject); >- } else { >- globalJSObject = XPCOM.JS_GetGlobalObject (jsLibPath, jsContext); >- } >+ long /*int*/ globalJSObject = XPCOM.JS_GetGlobalObject (jsLibPath, jsContext); > if (globalJSObject != 0) { >- if (MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR24)) { /* >= 24.x */ >- boolean success = XPCOM.JS_EvaluateUCScriptForPrincipals24 (jsLibPath, jsContext, globalJSObject, principals, scriptChars, length, urlbytes, 0, 0) != 0; >- // should principals be Release()d too? >- new nsISupports (scriptGlobalObject).Release (); >- principal.Release (); >- serviceManager.Release (); >- return success; >- } >- /* 1.9.x - 10.x */ > aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_CONTEXTSTACK_CONTRACTID, true); > rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsIJSContextStack.class), result); > if (rc == XPCOM.NS_OK && result[0] != 0) { >@@ -1896,14 +1956,49 @@ static String InitDiscoverXULRunner () { > > void initExternal (String profilePath) { > File componentsDir = new File (profilePath, AppFileLocProvider.COMPONENTS_DIR); >- java.io.InputStream is = Library.class.getResourceAsStream ("/external.xpt"); //$NON-NLS-1$ >+ java.io.InputStream is = Library.class.getResourceAsStream ("/swt.xpt"); //$NON-NLS-1$ > if (is != null) { > if (!componentsDir.exists ()) { > componentsDir.mkdirs (); > } > int read; > byte [] buffer = new byte [4096]; >- File file = new File (componentsDir, "external.xpt"); //$NON-NLS-1$ >+ File file = new File (componentsDir, "swt.xpt"); //$NON-NLS-1$ >+ try { >+ FileOutputStream os = new FileOutputStream (file); >+ while ((read = is.read (buffer)) != -1) { >+ os.write(buffer, 0, read); >+ } >+ os.close (); >+ is.close (); >+ } catch (FileNotFoundException e) { >+ } catch (IOException e) { >+ } >+ } >+ is = Library.class.getResourceAsStream ("/swt.js"); //$NON-NLS-1$ >+ if (is != null) { >+ if (!componentsDir.exists ()) { >+ componentsDir.mkdirs (); >+ } >+ int read; >+ byte [] buffer = new byte [4096]; >+ File file = new File (componentsDir, "swt.js"); //$NON-NLS-1$ >+ try { >+ FileOutputStream os = new FileOutputStream (file); >+ while ((read = is.read (buffer)) != -1) { >+ os.write(buffer, 0, read); >+ } >+ os.close (); >+ is.close (); >+ } catch (FileNotFoundException e) { >+ } catch (IOException e) { >+ } >+ } >+ is = Library.class.getResourceAsStream ("/chrome.manifest"); //$NON-NLS-1$ >+ if (is != null) { >+ int read; >+ byte [] buffer = new byte [4096]; >+ File file = new File (profilePath, "chrome.manifest"); //$NON-NLS-1$ > try { > FileOutputStream os = new FileOutputStream (file); > while ((read = is.read (buffer)) != -1) { >@@ -2182,9 +2277,6 @@ void initXPCOM (String mozillaPath, boolean isXULRunner) { > error (XPCOM.NS_ERROR_NULL_POINTER); > } > >- if (MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR24, true)) { >- Library.loadLibrary("swt-xulrunner24"); //$NON-NLS-1$ >- } > MozillaDelegate.loadAdditionalLibraries (mozillaPath, true); > > if (MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR10)) { >diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/Execute.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/Execute.java >new file mode 100644 >index 0000000..f62f4df >--- /dev/null >+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/Execute.java >@@ -0,0 +1,48 @@ >+/* ***** BEGIN LICENSE BLOCK ***** >+ * Version: MPL 1.1 >+ * >+ * The contents of this file are subject to the Mozilla Public License Version >+ * 1.1 (the "License"); you may not use this file except in compliance with >+ * the License. You may obtain a copy of the License at >+ * http://www.mozilla.org/MPL/ >+ * >+ * Software distributed under the License is distributed on an "AS IS" basis, >+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License >+ * for the specific language governing rights and limitations under the >+ * License. >+ * >+ * The Original Code is Mozilla Communicator client code, released March 31, 1998. >+ * >+ * The Initial Developer of the Original Code is >+ * Netscape Communications Corporation. >+ * Portions created by Netscape are Copyright (C) 1998-1999 >+ * Netscape Communications Corporation. All Rights Reserved. >+ * >+ * Contributor(s): >+ * >+ * IBM >+ * - Binding to permit interfacing between Mozilla and SWT >+ * - Copyright (C) 2003, 2012 IBM Corp. All Rights Reserved. >+ * >+ * ***** END LICENSE BLOCK ***** */ >+package org.eclipse.swt.internal.mozilla; >+ >+ >+public class Execute extends nsISupports { >+ >+ static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 3; >+ >+ static final String EXECUTE_IID_STR = "75a03044-d129-4d96-9292-bc1623876de1"; >+ >+ static { >+ IIDStore.RegisterIID(Execute.class, MozillaVersion.VERSION_BASE, new nsID(EXECUTE_IID_STR)); >+ } >+ >+ public Execute(long /*int*/ address) { >+ super(address); >+ } >+ >+ public int EvalInWindow(nsIDOMWindow aWindow, nsEmbedString code, long /*int*/[] aVariant) { >+ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aWindow.getAddress(), code.getAddress(), aVariant); >+ } >+} >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 d129f06..552032d 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 >@@ -92,6 +92,7 @@ public class XPCOM extends C { > public static final nsID NS_IXPCSCRIPTABLE_IID = new nsID ("155d1863-2b0b-4f5e-b800-05184944156b"); //$NON-NLS-1$ > > /* contract ID constants */ >+ public static final String EXECUTE_CONTRACTID = "@eclipse.org/execute;1"; //$NON-NLS-1$ > public static final String EXTERNAL_CONTRACTID = "@eclipse.org/external;1"; //$NON-NLS-1$ > public static final String NS_AUTHPROMPTER_CONTRACTID = "@mozilla.org/passwordmanager/authpromptfactory;1"; //$NON-NLS-1$ > public static final String NS_CERTOVERRIDE_CONTRACTID = "@mozilla.org/security/certoverride;1"; //$NON-NLS-1$ >@@ -175,15 +176,6 @@ 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 (); > >@@ -234,26 +226,6 @@ 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 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(); >@@ -274,26 +246,6 @@ public static final int JS_EvaluateUCScriptForPrincipals191(byte[] mozillaPath, > } > } > /** @method flags=no_gen */ >-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(); >@@ -304,16 +256,6 @@ 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(); >@@ -445,26 +387,6 @@ 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 *) >@@ -478,16 +400,6 @@ 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 *) >@@ -501,16 +413,6 @@ 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/components/external.idl b/bundles/org.eclipse.swt/components/external.idl >deleted file mode 100644 >index 441fc09..0000000 >--- a/bundles/org.eclipse.swt/components/external.idl >+++ /dev/null >@@ -1,21 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2008, 2011 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 >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >- >-// to compile: xpidl -m typelib -I S:\swt-builddir\gecko-sdk\idl\ -e external.xpt external.idl >- >-#include "nsISupports.idl" >-#include "nsIVariant.idl" >- >-[scriptable, uuid(ded01d20-ba6f-11dd-ad8b-0800200c9a66)] >- >-interface External : nsISupports { >- nsIVariant callJava (in unsigned long index, in nsIVariant token, in nsIVariant args); >-}; >diff --git a/bundles/org.eclipse.swt/components/external.xpt b/bundles/org.eclipse.swt/components/external.xpt >deleted file mode 100644 >index 88a803d220269e4688b04a59b534308266b99992..0000000000000000000000000000000000000000 >GIT binary patch >literal 0 >HcmV?d00001 > >literal 187 >zcmazDaQ64*3aKne^~p@)<&t7#Vqj)qVAu`BN<duN03^WR0EBV_Qj8EL14GWd4GBG2 >zf>$SeW)N8N+;$dFoEIi{?}Dttu6)6}Yr8oZ6nJK(0mUVta*BDyp24LB1^GoK#SB1p >ySYlCTVqOV@Yeh+FQC?yW$Of<-b}S8S4U-s{KsW)28Q2&Y8j=%pa=a4D5*YyQ@F`#b > >diff --git a/bundles/org.eclipse.swt/components/swt.idl b/bundles/org.eclipse.swt/components/swt.idl >new file mode 100644 >index 0000000..362cd33 >--- /dev/null >+++ b/bundles/org.eclipse.swt/components/swt.idl >@@ -0,0 +1,30 @@ >+/******************************************************************************* >+ * Copyright (c) 2008, 2011 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+ >+// to compile: xpidl -m typelib -I S:\swt-builddir\gecko-sdk\idl\ -e external.xpt external.idl >+ >+#include "nsISupports.idl" >+interface nsIVariant; >+interface nsIDOMWindow; >+ >+[scriptable, uuid(ded01d20-ba6f-11dd-ad8b-0800200c9a66)] >+ >+interface External : nsISupports { >+ nsIVariant callJava (in unsigned long index, in nsIVariant token, in nsIVariant args); >+}; >+ >+[scriptable, uuid(75a03044-d129-4d96-9292-bc1623876de1)] >+ >+interface Execute : nsISupports { >+ nsIVariant evalInWindow (in nsIDOMWindow window, in AString code); >+ nsIVariant evalAsChrome (in nsIDOMWindow window, in AString code); >+ void evalAsync (in nsIDOMWindow window, in AString code); >+}; >diff --git a/bundles/org.eclipse.swt/components/swt.js b/bundles/org.eclipse.swt/components/swt.js >new file mode 100644 >index 0000000..6ebebb5 >--- /dev/null >+++ b/bundles/org.eclipse.swt/components/swt.js >@@ -0,0 +1,30 @@ >+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); >+ >+function execute() { >+} >+ >+execute.prototype.evalInWindow = function(aWindow, aString) { >+ aWindow = XPCNativeWrapper.unwrap(aWindow); >+ try { >+ aWindow.external.QueryInterface(Components.interfaces.External); >+ } catch (e) { >+ aWindow.external = Components.classes["@eclipse.org/external;1"].createInstance(); >+ } >+ return aWindow.eval(aString); >+}; >+ >+execute.prototype.evalAsChrome = function(aWindow, aString) { >+ with (aWindow) { >+ return eval(aString); >+ } >+}; >+ >+execute.prototype.evalAsync = function(aWindow, aString) { >+ aWindow.location = "javascript:" + unescape(aString) + ";void(0);"; >+}; >+ >+execute.prototype.QueryInterface = XPCOMUtils.generateQI([Components.interfaces.Execute]); >+ >+execute.prototype.classID = Components.ID("{0aebcff1-f7b3-4522-a64b-1706d65dc232}"); >+ >+var NSGetFactory = XPCOMUtils.generateNSGetFactory([execute]); >diff --git a/bundles/org.eclipse.swt/components/swt.xpt b/bundles/org.eclipse.swt/components/swt.xpt >new file mode 100644 >index 0000000000000000000000000000000000000000..6f6aca78e49775bc85940b8b8355674d91b6a5c6 >GIT binary patch >literal 360 >zcmazDaQ64*3aKne^~p@)<&t7#Vqj%pV9a1(U{C?#4Glm76EI>5!9{prta}$^6?Wwd >z-d)?x!Jxo1D-9?v0hQB&sX?OMVeHZc1}+yheWy*Dv`0+2J@+9{JOnD&z>rt$8J1X- >znV44sVg{EM6yz6`6f?M1l%y8rCFU?BC+6gMC6*;JFfcKIU8%^@z}7H{ff0lgKr|Zz >zLjzE&i@$GpW?o8uIZ$tEa%o8_Luy%Kj%OZJ5X5mTcFriu&xOc17FXsagG^-xxg~}f >WXdX+$PMC=d44D`rWlRt?U>gBC#Yyb| > >literal 0 >HcmV?d00001 > >-- >1.9.4.msysgit.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 429739
:
241635
| 248258 |
248966
|
249588