aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Gayed2013-01-25 08:42:00 (EST)
committerCarolyn MacLeod2013-04-09 10:49:30 (EDT)
commit5f1f309ebaf150da711c6562c86425efcb797d38 (patch)
tree5c512d967df2d8e695cfc3491ea44c9d37553a45
parent76ef2572607d3d3ef3b02afd8e7de690e2990777 (diff)
downloadeclipse.platform.swt-5f1f309ebaf150da711c6562c86425efcb797d38.zip
eclipse.platform.swt-5f1f309ebaf150da711c6562c86425efcb797d38.tar.gz
eclipse.platform.swt-5f1f309ebaf150da711c6562c86425efcb797d38.tar.bz2
Bug 398070 - BrowserFunction not converting correctly boolean arrays
with XULRunner 10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp27
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/External.java13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIVariant.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIWritableVariant.java4
7 files changed, 68 insertions, 6 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 b3db828..026e178 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, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -213,6 +213,31 @@ JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJ)(JNIEnv *env, jclass that, ji
}
#endif
+#if (!defined(NO__1VtblCall__IIB) && !defined(JNI64)) || (!defined(NO__1VtblCall__IJB) && defined(JNI64))
+#ifndef JNI64
+extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIB)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jbyte arg2);
+JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIB)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jbyte arg2)
+#else
+extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJB)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jbyte arg2);
+JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJB)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jbyte arg2)
+#endif
+{
+ jint rc = 0;
+#ifndef JNI64
+ XPCOM_NATIVE_ENTER(env, that, _1VtblCall__IIB_FUNC);
+#else
+ XPCOM_NATIVE_ENTER(env, that, _1VtblCall__IJB_FUNC);
+#endif
+ rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, jbyte))(*(jintLong **)arg1)[arg0])(arg1, arg2);
+#ifndef JNI64
+ XPCOM_NATIVE_EXIT(env, that, _1VtblCall__IIB_FUNC);
+#else
+ XPCOM_NATIVE_EXIT(env, that, _1VtblCall__IJB_FUNC);
+#endif
+ return rc;
+}
+#endif
+
#if (!defined(NO__1VtblCall__IID) && !defined(JNI64)) || (!defined(NO__1VtblCall__IJD) && defined(JNI64))
#ifndef JNI64
extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IID)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jdouble arg2);
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 c8b5b7c..c51c168 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, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -51,6 +51,11 @@ char * XPCOM_nativeFunctionNames[] = {
"_1VtblCall__IJ",
#endif
#ifndef JNI64
+ "_1VtblCall__IIB",
+#else
+ "_1VtblCall__IJB",
+#endif
+#ifndef JNI64
"_1VtblCall__IID",
#else
"_1VtblCall__IJD",
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 b47b3ae..ff1e3a0 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, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -61,6 +61,11 @@ typedef enum {
_1VtblCall__IJ_FUNC,
#endif
#ifndef JNI64
+ _1VtblCall__IIB_FUNC,
+#else
+ _1VtblCall__IJB_FUNC,
+#endif
+#ifndef JNI64
_1VtblCall__IID_FUNC,
#else
_1VtblCall__IJD_FUNC,
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 c4087df..4ac867b 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
@@ -251,9 +251,16 @@ static Object convertToJava (nsIVariant variant, short type) {
case nsIDataType.VTYPE_BOOL:
arrayReturn = new Object[count[0]];
for (int i = 0; i < count[0]; i++) {
- int[] boolValue = new int[1]; /* PRUInt32 */
- C.memmove (boolValue, ptr[0] + i * 4, 4);
- arrayReturn[i] = new Boolean (boolValue[0] != 0);
+ /* mozilla's representation of boolean changed from 4 bytes to 1 byte as of XULRunner 4.x */
+ if (nsISupports.IsXULRunner10) {
+ byte[] byteValue = new byte[1];
+ C.memmove (byteValue, ptr[0] + i, 1);
+ arrayReturn[i] = new Boolean (byteValue[0] != 0);
+ } else {
+ int[] boolValue = new int[1]; /* PRUInt32 */
+ C.memmove (boolValue, ptr[0] + i * 4, 4);
+ arrayReturn[i] = new Boolean (boolValue[0] != 0);
+ }
}
break;
case nsIDataType.VTYPE_INT32:
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 1b29b85..b5c7f27 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
@@ -643,6 +643,15 @@ static final int VtblCall(int fnNumber, long /*int*/ ppVtbl) {
}
}
+static final native int _VtblCall(int fnNumber, long /*int*/ ppVtbl, byte arg0);
+static final int VtblCall(int fnNumber, long /*int*/ ppVtbl, byte arg0) {
+ lock.lock();
+ try {
+ return _VtblCall(fnNumber, ppVtbl, arg0);
+ } finally {
+ lock.unlock();
+ }
+}
static final native int _VtblCall(int fnNumber, long /*int*/ ppVtbl, byte[] arg0);
static final int VtblCall(int fnNumber, long /*int*/ ppVtbl, byte[] arg0) {
lock.lock();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIVariant.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIVariant.java
index 07b3525..36ea2a2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIVariant.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIVariant.java
@@ -92,6 +92,13 @@ public class nsIVariant extends nsISupports {
}
public int GetAsBool(int[] _retval) {
+ /* mozilla's representation of boolean changed from 4 bytes to 1 byte as of XULRunner 4.x */
+ if (nsISupports.IsXULRunner10) {
+ byte[] byteValue = new byte[1];
+ int rc = XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 12, getAddress(), byteValue);
+ _retval[0] = (int)byteValue[0];
+ return rc;
+ }
return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 12, getAddress(), _retval);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIWritableVariant.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIWritableVariant.java
index 2ccd628..59b5008 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIWritableVariant.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIWritableVariant.java
@@ -90,6 +90,10 @@ public class nsIWritableVariant extends nsIVariant {
}
public int SetAsBool(int aValue) {
+ /* mozilla's representation of boolean changed from 4 bytes to 1 byte as of XULRunner 4.x */
+ if (IsXULRunner10) {
+ return XPCOM.VtblCall(nsIVariant.LAST_METHOD_ID + 13, getAddress(), (byte)aValue);
+ }
return XPCOM.VtblCall(nsIVariant.LAST_METHOD_ID + 13, getAddress(), aValue);
}