Diff
Modified: branches/safari-534.56-branch/Source/_javascript_Core/API/JSCallbackFunction.cpp (113731 => 113732)
--- branches/safari-534.56-branch/Source/_javascript_Core/API/JSCallbackFunction.cpp 2012-04-10 17:18:27 UTC (rev 113731)
+++ branches/safari-534.56-branch/Source/_javascript_Core/API/JSCallbackFunction.cpp 2012-04-10 17:20:32 UTC (rev 113732)
@@ -76,7 +76,7 @@
// result must be a valid JSValue.
if (!result)
- return throwVMTypeError(exec);
+ return JSValue::encode(jsUndefined());
return JSValue::encode(toJS(exec, result));
}
Modified: branches/safari-534.56-branch/Source/_javascript_Core/API/tests/testapi.c (113731 => 113732)
--- branches/safari-534.56-branch/Source/_javascript_Core/API/tests/testapi.c 2012-04-10 17:18:27 UTC (rev 113731)
+++ branches/safari-534.56-branch/Source/_javascript_Core/API/tests/testapi.c 2012-04-10 17:20:32 UTC (rev 113732)
@@ -678,9 +678,22 @@
return JSValueMakeNumber(ctx, 1); // distinguish base call from derived call
}
+static JSValueRef Base_returnHardNull(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ UNUSED_PARAM(ctx);
+ UNUSED_PARAM(function);
+ UNUSED_PARAM(thisObject);
+ UNUSED_PARAM(argumentCount);
+ UNUSED_PARAM(arguments);
+ UNUSED_PARAM(exception);
+
+ return 0; // should convert to undefined!
+}
+
static JSStaticFunction Base_staticFunctions[] = {
{ "baseProtoDup", NULL, kJSPropertyAttributeNone },
{ "baseProto", Base_callAsFunction, kJSPropertyAttributeNone },
+ { "baseHardNull", Base_returnHardNull, kJSPropertyAttributeNone },
{ 0, 0, 0 }
};
Modified: branches/safari-534.56-branch/Source/_javascript_Core/API/tests/testapi.js (113731 => 113732)
--- branches/safari-534.56-branch/Source/_javascript_Core/API/tests/testapi.js 2012-04-10 17:18:27 UTC (rev 113731)
+++ branches/safari-534.56-branch/Source/_javascript_Core/API/tests/testapi.js 2012-04-10 17:20:32 UTC (rev 113732)
@@ -186,6 +186,8 @@
shouldBe("derived.protoDup", 2);
shouldBe("derived.derivedOnly", 2)
+shouldBe("derived.baseHardNull()", undefined)
+
// base properties throw 1 when set; derived, 2
shouldBe("derived.baseDup = 0", 2);
shouldBe("derived.baseOnly = 0", 1);
Modified: branches/safari-534.56-branch/Source/_javascript_Core/ChangeLog (113731 => 113732)
--- branches/safari-534.56-branch/Source/_javascript_Core/ChangeLog 2012-04-10 17:18:27 UTC (rev 113731)
+++ branches/safari-534.56-branch/Source/_javascript_Core/ChangeLog 2012-04-10 17:20:32 UTC (rev 113732)
@@ -1,3 +1,22 @@
+2012-04-10 Lucas Forschler <[email protected]>
+
+ Merge 113654
+
+ 2012-04-09 Gavin Barraclough <[email protected]>
+
+ If a callback function returns a C++ null, convert to undefined.
+ https://bugs.webkit.org/show_bug.cgi?id=83534
+
+ Reviewed by Geoff Garen.
+
+ * API/JSCallbackFunction.cpp:
+ - If a callback function returns a C++ null, convert to undefined.
+ (JSC::JSCallbackFunction::call):
+ * API/tests/testapi.c:
+ (Base_returnHardNull):
+ * API/tests/testapi.js:
+ - Add a test case for callback functions that return a C++ null.
+
2012-03-20 Lucas Forschler <[email protected]>
Merge 111162