Title: [150990] trunk/Source/_javascript_Core
Revision
150990
Author
[email protected]
Date
2013-05-30 15:58:12 -0700 (Thu, 30 May 2013)

Log Message

JSCallbackObject does not correctly initialise the PropertySlot for getOwnPropertyDescriptor
https://bugs.webkit.org/show_bug.cgi?id=117053

Reviewed by Mark Hahnenberg.

Set appropriate thisValue on the PropertySlot

* API/JSCallbackObjectFunctions.h:
(JSC::::getOwnPropertyDescriptor):
* API/tests/testapi.mm:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSCallbackObjectFunctions.h (150989 => 150990)


--- trunk/Source/_javascript_Core/API/JSCallbackObjectFunctions.h	2013-05-30 22:55:28 UTC (rev 150989)
+++ trunk/Source/_javascript_Core/API/JSCallbackObjectFunctions.h	2013-05-30 22:58:12 UTC (rev 150990)
@@ -216,7 +216,7 @@
 bool JSCallbackObject<Parent>::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
 {
     JSCallbackObject* thisObject = jsCast<JSCallbackObject*>(object);
-    PropertySlot slot;
+    PropertySlot slot(thisObject);
     if (thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, propertyName, slot)) {
         // Ideally we should return an access descriptor, but returning a value descriptor is better than nothing.
         JSValue value = slot.getValue(exec, propertyName);

Modified: trunk/Source/_javascript_Core/API/tests/testapi.mm (150989 => 150990)


--- trunk/Source/_javascript_Core/API/tests/testapi.mm	2013-05-30 22:55:28 UTC (rev 150989)
+++ trunk/Source/_javascript_Core/API/tests/testapi.mm	2013-05-30 22:58:12 UTC (rev 150990)
@@ -811,6 +811,14 @@
 
         checkResult(@"JSValue correctly protected its internal value", [[o[@"foo"] toString] isEqualToString:@"foo"]);
     }
+
+    @autoreleasepool {
+        JSContext *context = [[JSContext alloc] init];
+        TestObject *testObject = TestObject.testObject;
+        context[@"testObject"] = testObject;
+        [context evaluateScript:@"testObject.__lookupGetter__('variable').call({})"];
+        checkResult(@"Make sure we throw an exception when calling getter on incorrect |this|", context.exception);
+    }
 }
 
 #else

Modified: trunk/Source/_javascript_Core/ChangeLog (150989 => 150990)


--- trunk/Source/_javascript_Core/ChangeLog	2013-05-30 22:55:28 UTC (rev 150989)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-05-30 22:58:12 UTC (rev 150990)
@@ -1,3 +1,16 @@
+2013-05-30  Oliver Hunt  <[email protected]>
+
+        JSCallbackObject does not correctly initialise the PropertySlot for getOwnPropertyDescriptor
+        https://bugs.webkit.org/show_bug.cgi?id=117053
+
+        Reviewed by Mark Hahnenberg.
+
+        Set appropriate thisValue on the PropertySlot
+
+        * API/JSCallbackObjectFunctions.h:
+        (JSC::::getOwnPropertyDescriptor):
+        * API/tests/testapi.mm:
+
 2013-05-29  Jeffrey Pfau  <[email protected]>
 
         [Mac] Enable cache partitioning and the public suffix list on 10.8
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to