Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

help with defining custom properties

26 views
Skip to first unread message

Ivan Alagenchev

unread,
Mar 19, 2013, 6:31:11 PM3/19/13
to dev-tech-...@lists.mozilla.org
Could someone please help me out? I already asked my question on IRC #jsapi
and wasn't able to get an answer.
I'm working on this bug here:
https://bugzilla.mozilla.org/show_bug.cgi?id=811877 and I'm trying to add a
custom property to the string class in jsstr.cpp. I've followed the
documentation here:
https://developer.mozilla.org/en-US/docs/SpiderMonkey/JSAPI_Reference/JSPropertySpecand
here:
https://developer.mozilla.org/en-US/docs/SpiderMonkey/JSAPI_Reference/JS_DefineProperties,
but my JSPropertyOp never gets called and the property comes back as
undefined. Here is a pastebin of my modifications:
http://pastebin.com/0PZxpdsj . The relevant changes are on lines 634-653
and 3439-3442.

Thanks in advance,
Ivan

Rolando Abarca

unread,
Mar 19, 2013, 7:11:28 PM3/19/13
to Ivan Alagenchev, dev-tech-...@lists.mozilla.org
I don't know if this is the same issue, but starting in Spidermonkey 19, I
had problems when defining properties with the JSPROP_SHARED flag (and in
your case, it seems you don't need it):

#define JSPROP_SHARED 0x40 /* don't allocate a value slot for
this
property; don't copy the
property on
set of the same-named property
in an
object that delegates to a
prototype
containing this property */


hth,
Rolando
> _______________________________________________
> dev-tech-js-engine mailing list
> dev-tech-...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-js-engine
>



--
Rolando Abarca
https://github.com/funkaster - @funkaster
Phones: +1 (415) 562-7656
+56 (2) 2581-4591

Ivan Alagenchev

unread,
Mar 19, 2013, 9:14:04 PM3/19/13
to Rolando Abarca, dev-tech-...@lists.mozilla.org
Hi Rolando,

Thank you for your reply. I removed the JSPROP_SHARED flag, but
unfortunately that didn't fix the problem.

Regards,
Ivan

Ivan Alagenchev

unread,
Mar 20, 2013, 7:19:42 PM3/20/13
to Rolando Abarca, dev-tech-...@lists.mozilla.org
I thought I should share with everyone what fixed my problem.
JS_DefineProperties had to set properties on the prototype
JS_DefineProperties(cx,proto, taint_properties) and not the object -
JS_DefineProperties(cx, obj, taint_properties); Changing that fixed the
problem.

Ivan
0 new messages