diff options
author | Grant Gayed | 2010-11-15 21:08:16 +0000 |
---|---|---|
committer | Grant Gayed | 2010-11-15 21:08:16 +0000 |
commit | 07b4e1467fff65b3050b4b9c50f9a916d8642440 (patch) | |
tree | bc9302de0e3cb2d73bfab8537e85418a4ccddf97 /bundles/org.eclipse.swt/Eclipse SWT Browser | |
parent | b590d64b3ccd7a0955639f7b5d741d1165df644c (diff) | |
download | eclipse.platform.swt-07b4e1467fff65b3050b4b9c50f9a916d8642440.tar.gz eclipse.platform.swt-07b4e1467fff65b3050b4b9c50f9a916d8642440.tar.xz eclipse.platform.swt-07b4e1467fff65b3050b4b9c50f9a916d8642440.zip |
329058 - BrowserFunction should map java null to JS null, not to undefined
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Browser')
2 files changed, 14 insertions, 16 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/BrowserFunction.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/BrowserFunction.java index f87aef0d47..95e4824005 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/BrowserFunction.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/BrowserFunction.java @@ -119,12 +119,14 @@ void dispose (boolean remove) { * javascript boolean -> <code>java.lang.Boolean</code> * javascript array whose elements are all of supported types -> <code>java.lang.Object[]</code> * - * If any of the Javascript arguments are of unsupported types then the + * If any of the javascript arguments are of unsupported types then the * function invocation will fail and this method will not be called. * - * This method must return a value with one of these supported types to - * the javascript caller (note that any subclass of <code>java.lang.Number</code> - * will be successfully converted to a javascript number). + * This method must return a value with one of these supported java types to + * the javascript caller. Note that <code>null</code> values are converted + * to javascript's <code>null</code> value (not <code>undefined</code>), and + * instances of any <code>java.lang.Number</code> subclass will be converted + * to a javascript number. * * @param arguments the javascript arguments converted to java equivalents * @return the value to return to the javascript caller diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java index a62a9a12df..c908218957 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java @@ -764,18 +764,14 @@ int Invoke (int dispIdMember, int /*long*/ riid, int lcid, int dwFlags, int /*lo variant.dispose (); if (pVarResult != 0) { - if (returnValue == null) { - COM.MoveMemory (pVarResult, new int /*long*/[] {0}, C.PTR_SIZEOF); - } else { - try { - variant = convertToJS (returnValue); - } catch (SWTException e) { - /* invalid return value type */ - variant = convertToJS (WebBrowser.CreateErrorString (e.getLocalizedMessage ())); - } - Variant.win32_copy (pVarResult, variant); - variant.dispose (); + try { + variant = convertToJS (returnValue); + } catch (SWTException e) { + /* invalid return value type */ + variant = convertToJS (WebBrowser.CreateErrorString (e.getLocalizedMessage ())); } + Variant.win32_copy (pVarResult, variant); + variant.dispose (); } return COM.S_OK; } @@ -839,7 +835,7 @@ Object convertToJava (Variant variant) { Variant convertToJS (Object value) { if (value == null) { - return new Variant (); + return Variant.NULL; } if (value instanceof String) { return new Variant ((String)value); |