NEW 116844
Deleting static properties defined with the JSC API should work
https://bugs.webkit.org/show_bug.cgi?id=116844
Summary Deleting static properties defined with the JSC API should work
Mark Hahnenberg
Reported 2013-05-27 14:11:59 PDT
Currently it is impossible to delete static properties defined via the C API from API objects.
Attachments
Patch (20.91 KB, patch)
2013-05-27 15:45 PDT, Mark Hahnenberg
darin: review+
Mark Hahnenberg
Comment 1 2013-05-27 15:45:30 PDT
Darin Adler
Comment 2 2013-05-27 15:54:48 PDT
Comment on attachment 203013 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=203013&action=review > Source/JavaScriptCore/ChangeLog:21 > + (JSC::::getOwnPropertySlot): The script screws up parsing these function names. You should put in the JSCallbackObject part by hand if you are leaving these lines in. > Source/JavaScriptCore/API/JSCallbackObject.h:82 > + if (!m_deletedStaticProperties) > + return false; > + return m_deletedStaticProperties->contains(name); I like to write these with && instead of an early return.
Darin Adler
Comment 3 2013-05-27 15:55:06 PDT
Is there a similar issue for the Objective-C API?
Mark Hahnenberg
Comment 4 2013-05-27 19:49:10 PDT
(In reply to comment #3) > Is there a similar issue for the Objective-C API? I don't think so. We don't really have a concept of static functions in the Objective-C API. All properties are real properties on the underlying JS wrapper objects. The accessors added to the JS wrappers for Objective-C @properties are set to be "configurable" which means they can be deleted.
Geoffrey Garen
Comment 5 2013-06-13 16:08:14 PDT
Comment on attachment 203013 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=203013&action=review This patch will remove the *interface* for a static property in response to a delete request -- I don't think that's quite what our client wanted. They wanted an object that could implement a custom property, but store the backing for that property in normal object backing, and then use delete to remove it. Maybe we need to clear this up with them. > Source/JavaScriptCore/API/JSCallbackObjectFunctions.h:393 > + thisObject->m_callbackObjectData->deleteStaticProperty(name); > + bool result = Parent::deleteProperty(thisObject, exec, propertyName); > + ASSERT(result); > + return result; This isn't quite right. We should only call through to Parent::deleteProperty() if we did not find a static property to delete, and our return value should depend on whether we found anything to delete. > Source/JavaScriptCore/API/JSCallbackObjectFunctions.h:406 > + thisObject->m_callbackObjectData->deleteStaticProperty(name); > + bool result = Parent::deleteProperty(thisObject, exec, propertyName); > + ASSERT(result); > + return result; Ditto.
Note You need to log in before you can comment on or make changes to this bug.