[Webkit-unassigned] [Bug 160032] Adding JSObjectGetClass method

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Sep 9 03:50:36 PDT 2016


https://bugs.webkit.org/show_bug.cgi?id=160032

--- Comment #15 from Danilo Cesar Lemes de Paula <danilo.cesar at collabora.co.uk> ---
(In reply to comment #13)
> This seems like a bad design.
> 
> The example code you've provided is broken because it unconditionally passes
> NULL to JSObjectMake, but many classes will require valid private data upon
> construction.
> 
> Can you give a more in-depth example of a program that would use this
> technique?

The example I mentioned it's close to my case. In a certain condition I need
to create an object of the same class of some other object I got.

JSClassRef clas = JSObjectGetClass(obj1);
JSObjectRef obj2 = JSObjectMake(context, clas, NULL);

The example I used here doesn't set a private data upon construction, but it shouldn't matter, I could set a pointer there and the example for the API I'm proposing would be the same.

As I mentioned in the mailing list, this same API is present in SpiderMonkey. I understand that the API dealing with JSObjectRef is stable for a while, however this API is simple, consistent and have already been proven useful by others javascript engines.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160909/02749367/attachment.html>


More information about the webkit-unassigned mailing list