[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
mrowe at apple.com
mrowe at apple.com
Wed Dec 22 13:15:29 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 3dbbe126d3391af17d66be070c1415584912194e
Author: mrowe at apple.com <mrowe at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Sep 10 00:13:29 2010 +0000
<http://webkit.org/b/45502> JSObjectSetPrivateProperty does not handle NULL values as it claims
Reviewed by Oliver Hunt.
* API/JSObjectRef.cpp:
(JSObjectSetPrivateProperty): Don't call toJS if we have a NULL value as that will cause an assertion
failure. Instead map NULL directly to the null JSValue.
* API/tests/testapi.c:
(main): Add test coverage for the NULL value case.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67129 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/API/JSObjectRef.cpp b/JavaScriptCore/API/JSObjectRef.cpp
index 5e0536f..8bd33d6 100644
--- a/JavaScriptCore/API/JSObjectRef.cpp
+++ b/JavaScriptCore/API/JSObjectRef.cpp
@@ -382,7 +382,7 @@ bool JSObjectSetPrivateProperty(JSContextRef ctx, JSObjectRef object, JSStringRe
ExecState* exec = toJS(ctx);
APIEntryShim entryShim(exec);
JSObject* jsObject = toJS(object);
- JSValue jsValue = toJS(exec, value);
+ JSValue jsValue = value ? toJS(exec, value) : JSValue();
Identifier name(propertyName->identifier(&exec->globalData()));
if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::info)) {
static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->setPrivateProperty(name, jsValue);
diff --git a/JavaScriptCore/API/tests/testapi.c b/JavaScriptCore/API/tests/testapi.c
index 183abf5..1ecfc7e 100644
--- a/JavaScriptCore/API/tests/testapi.c
+++ b/JavaScriptCore/API/tests/testapi.c
@@ -933,17 +933,15 @@ int main(int argc, char* argv[])
JSStringRef privatePropertyName = JSStringCreateWithUTF8CString("privateProperty");
if (!JSObjectSetPrivateProperty(context, myObject, privatePropertyName, aHeapRef)) {
printf("FAIL: Could not set private property.\n");
- failed = 1;
- } else {
+ failed = 1;
+ } else
printf("PASS: Set private property.\n");
- }
aStackRef = 0;
if (JSObjectSetPrivateProperty(context, aHeapRef, privatePropertyName, aHeapRef)) {
printf("FAIL: JSObjectSetPrivateProperty should fail on non-API objects.\n");
- failed = 1;
- } else {
+ failed = 1;
+ } else
printf("PASS: Did not allow JSObjectSetPrivateProperty on a non-API object.\n");
- }
if (JSObjectGetPrivateProperty(context, myObject, privatePropertyName) != aHeapRef) {
printf("FAIL: Could not retrieve private property.\n");
failed = 1;
@@ -954,15 +952,15 @@ int main(int argc, char* argv[])
failed = 1;
} else
printf("PASS: JSObjectGetPrivateProperty return NULL.\n");
-
+
if (JSObjectGetProperty(context, myObject, privatePropertyName, 0) == aHeapRef) {
printf("FAIL: Accessed private property through ordinary property lookup.\n");
failed = 1;
} else
printf("PASS: Cannot access private property through ordinary property lookup.\n");
-
+
JSGarbageCollect(context);
-
+
for (int i = 0; i < 10000; i++)
JSObjectMake(context, 0, 0);
@@ -973,7 +971,18 @@ int main(int argc, char* argv[])
} else
printf("PASS: Private property does not appear to have been collected.\n");
JSStringRelease(lengthStr);
-
+
+ if (!JSObjectSetPrivateProperty(context, myObject, privatePropertyName, 0)) {
+ printf("FAIL: Could not set private property to NULL.\n");
+ failed = 1;
+ } else
+ printf("PASS: Set private property to NULL.\n");
+ if (JSObjectGetPrivateProperty(context, myObject, privatePropertyName)) {
+ printf("FAIL: Could not retrieve private property.\n");
+ failed = 1;
+ } else
+ printf("PASS: Retrieved private property.\n");
+
JSStringRef validJSON = JSStringCreateWithUTF8CString("{\"aProperty\":true}");
JSValueRef jsonObject = JSValueMakeFromJSONString(context, validJSON);
JSStringRelease(validJSON);
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 30f80c9..e30a30e 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,15 @@
+2010-09-09 Mark Rowe <mrowe at apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <http://webkit.org/b/45502> JSObjectSetPrivateProperty does not handle NULL values as it claims
+
+ * API/JSObjectRef.cpp:
+ (JSObjectSetPrivateProperty): Don't call toJS if we have a NULL value as that will cause an assertion
+ failure. Instead map NULL directly to the null JSValue.
+ * API/tests/testapi.c:
+ (main): Add test coverage for the NULL value case.
+
2010-09-09 Csaba Osztrogonác <ossy at webkit.org>
Reviewed by Gavin Barraclough.
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list