Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Gayed2011-08-08 18:20:16 +0000
committerGrant Gayed2011-08-08 18:20:16 +0000
commit186676f1d2971f22d8b4e8719af64e820e2bf3a4 (patch)
tree3235693c01138c5cb3406ad27d865921fe22d4ce /bundles/org.eclipse.swt/Eclipse SWT WebKit
parent15c44de917581dd8d95cec9b081ec7ed327edf65 (diff)
downloadeclipse.platform.swt-186676f1d2971f22d8b4e8719af64e820e2bf3a4.tar.gz
eclipse.platform.swt-186676f1d2971f22d8b4e8719af64e820e2bf3a4.tar.xz
eclipse.platform.swt-186676f1d2971f22d8b4e8719af64e820e2bf3a4.zip
Bug 352383 - increase BrowserFunction security token to 128 bits
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT WebKit')
-rw-r--r--[-rwxr-xr-x]bundles/org.eclipse.swt/Eclipse SWT WebKit/carbon/org/eclipse/swt/browser/WebKit.java9
-rw-r--r--[-rwxr-xr-x]bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java6
4 files changed, 15 insertions, 12 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/carbon/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/carbon/org/eclipse/swt/browser/WebKit.java
index 3d223835a3..b824c7b503 100755..100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/carbon/org/eclipse/swt/browser/WebKit.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/carbon/org/eclipse/swt/browser/WebKit.java
@@ -2169,11 +2169,14 @@ int /*long*/ callJava (int /*long*/ index, int /*long*/ token, int /*long*/ args
Object returnValue = null;
if (Cocoa.objc_msgSend (index, Cocoa.S_isKindOfClass, Cocoa.C_NSNumber) != 0) {
int functionIndex = Cocoa.objc_msgSend (index, Cocoa.S_intValue);
- if (Cocoa.objc_msgSend (token, Cocoa.S_isKindOfClass, Cocoa.C_NSNumber) != 0) {
- long tokenValue = (long)Cocoa.objc_msgSend_fpret (token, Cocoa.S_doubleValue);
+ if (Cocoa.objc_msgSend (token, Cocoa.S_isKindOfClass, Cocoa.C_NSString) != 0) {
+ int length = Cocoa.objc_msgSend (token, Cocoa.S_length);
+ char[] buffer = new char[length];
+ Cocoa.objc_msgSend (token, Cocoa.S_getCharacters_, buffer);
+ String tokenString = new String (buffer);
Object key = new Integer (functionIndex);
BrowserFunction function = (BrowserFunction)functions.get (key);
- if (function != null && tokenValue == function.token) {
+ if (function != null && tokenString.equals (function.token)) {
try {
Object temp = convertToJava (args);
if (temp instanceof Object[]) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java
index 032bdb2120..6da746ac1d 100755..100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java
@@ -1765,11 +1765,11 @@ NSObject callJava (int /*long*/ index, int /*long*/ token, int /*long*/ args, in
NSNumber number = new NSNumber (index);
Object key = new Integer (number.intValue ());
object = new NSObject (token);
+ clazz = OS.objc_lookUpClass ("NSString"); //$NON-NLS-1$
if (object.isKindOfClass (clazz)) {
- number = new NSNumber (token);
- long tokenValue = (long)number.doubleValue ();
+ NSString tokenString = new NSString (token);
BrowserFunction function = (BrowserFunction)functions.get (key);
- if (function != null && tokenValue == function.token) {
+ if (function != null && tokenString.getString ().equals (function.token)) {
try {
Object temp = convertToJava (args);
if (temp instanceof Object[]) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
index 727a9ed451..087bd2247f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
@@ -1751,10 +1751,10 @@ int /*long*/ callJava (int /*long*/ ctx, int /*long*/ func, int /*long*/ thisObj
Object key = new Integer (index);
C.memmove (result, arguments + C.PTR_SIZEOF, C.PTR_SIZEOF);
type = WebKitGTK.JSValueGetType (ctx, result[0]);
- if (type == WebKitGTK.kJSTypeNumber) {
- long token = ((Double)convertToJava (ctx, result[0])).longValue ();
+ if (type == WebKitGTK.kJSTypeString) {
+ String token = (String)convertToJava (ctx, result[0]);
BrowserFunction function = (BrowserFunction)functions.get (key);
- if (function != null && token == function.token) {
+ if (function != null && token.equals (function.token)) {
try {
C.memmove (result, arguments + 2 * C.PTR_SIZEOF, C.PTR_SIZEOF);
Object temp = convertToJava (ctx, result[0]);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java
index a68b060a22..1bc1a4e3ba 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java
@@ -385,10 +385,10 @@ int /*long*/ callJava (int /*long*/ ctx, int /*long*/ func, int /*long*/ thisObj
Object key = new Integer (index);
C.memmove (result, arguments + C.PTR_SIZEOF, C.PTR_SIZEOF);
type = WebKit_win32.JSValueGetType (ctx, result[0]);
- if (type == WebKit_win32.kJSTypeNumber) {
- long token = ((Double)convertToJava (ctx, result[0])).longValue ();
+ if (type == WebKit_win32.kJSTypeString) {
+ String token = (String)convertToJava (ctx, result[0]);
BrowserFunction function = (BrowserFunction)functions.get (key);
- if (function != null && token == function.token) {
+ if (function != null && token.equals (function.token)) {
try {
C.memmove (result, arguments + 2 * C.PTR_SIZEOF, C.PTR_SIZEOF);
Object temp = convertToJava (ctx, result[0]);

Back to the top