<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Adding JSObjectGetClass method"
href="https://bugs.webkit.org/show_bug.cgi?id=160032#c15">Comment # 15</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Adding JSObjectGetClass method"
href="https://bugs.webkit.org/show_bug.cgi?id=160032">bug 160032</a>
from <span class="vcard"><a class="email" href="mailto:danilo.cesar@collabora.co.uk" title="Danilo Cesar Lemes de Paula <danilo.cesar@collabora.co.uk>"> <span class="fn">Danilo Cesar Lemes de Paula</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=160032#c13">comment #13</a>)
<span class="quote">> 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?</span >
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>