Permalink
Browse files

JavaScriptCore: Reverted 2 of the JSValueMakeUndefined replacements b…

…ecause those functions are tied to JSObjectRef instead of JSValueRef. The C compiler will allow this, but C++ will reject the conversion.

It is unclear what the correct handling is for JavaScriptCore. (Nobody bothers to document this in JSCore.) Unlike our other problem where we incorrectly assume JSObjectRef when the functions want JSValueRef, this time Apple is demanding the JSObjectRef. Like our other problem, I assume it is unsafe to try to convert Undefined into a JSObjectRef.

So reverting to NULL seems like the safer bet for this specific case. Perhaps the other alternative is to return an exception object or an error object. But I would like to see JSCore document this before trying.
  • Loading branch information...
1 parent f1c331f commit e7b20624cc32d1220d5ad53370bfc1d92c8657c4 Eric Wing committed with oliver---- May 20, 2014
Showing with 2 additions and 2 deletions.
  1. +2 −2 Lib/javascript/jsc/javascriptcode.swg
@@ -17,7 +17,7 @@ static JSObjectRef $jswrapper(JSContextRef context, JSObjectRef thisObject, size
return SWIG_JSC_NewPointerObj(context, result, SWIGTYPE_$jsmangledtype, SWIG_POINTER_OWN);
goto fail;
fail:
- return JSValueMakeUndefined(context);
+ return NULL;
}
%}
@@ -78,7 +78,7 @@ static JSObjectRef $jswrapper(JSContextRef context, JSObjectRef thisObject, size
goto fail;
fail:
- return JSValueMakeUndefined(context);
+ return NULL;
}
%}

0 comments on commit e7b2062

Please sign in to comment.