From:  coolrenu <subin_john@yahoo.com>
Date:  09 Oct 2007 17:49:14 Hong Kong Time
Newsgroup:  news.mozilla.org/netscape.public.mozilla.jseng
Subject:  

Dynamic addition of property

NNTP-Posting-Host:  61.95.164.171

For an application that we are building, on startup we initialize all
the JS classes we need (using JS_InitClass with info containing the
properties and functions)

Whenever a script containing the properties already defined using
JS_InitClass is evaluated, the corresponding getproperty stubs that
were registered are called to evaluate the script.

Now there is an issue faced to evaluate a NEW property of a class that
has not yet been defined using JS_initclass. We understand that this
can be achieved using JS_ResolveStub.

For eg. Myobject.newproperty = 10;  //Where newproperty has not been
defined in JS_InitClass.

The control comes inside ResolveStub, and able to extract
"newproperty" string, We make a call to
JS_DefinePropertyWithTinyId to add "newproperty" as a property. The
function returns 1.

Once this is done, we expect that the getpropertystub is called again,
now, with tinyID as newly assigned in JS_DefinePropertyWithTinyId so
that I could evaluate the same.

But this is not happening.

Can anyone explain where we may have gone wrong?