JSAPI interface break about to land: C++ setter functions for JS properties
I'm about to land a change to one of JSAPI's widely used public types.
My patch includes fixes for Firefox on all platforms, but no fixes
outside the browser (Thunderbird, Seamonkey, etc). The compiler catches
all code where changes are needed, and the fixes required are minor.
In order to implement ECMAScript 5's strict mode correctly, some object
property setters need to know whether the assignment they're carrying
out was written in strict mode code or old-style code. For example, the
following must fail:
a.length = 2
because the assignment to 'a.length' is unable to delete the last
element of the array. The failure must be silent in 'lenient mode' code,
but throw an exception in strict mode code. The setter for arrays'
length properties needs to be sensitive to the strictness of the code in
which the assignment is written.
after some iterations and backouts, the best solution we found was to
simply add a 'JSBool strict' argument to the setter callback functions
for JS object properties. Thus, whereas getters and setters both used to
be JSPropertyOp, setters are now JSStrictPropertyOp. (Getters are
Fortunately, since we're changing a type, you'll get compiler errors for
all the code that needs to be changed. The fixes I've needed to make
have fallen into three main categories:
1) Use JS_StrictPropertyStub for the default setter in class
definitions, not JS_PropertyStub:
This is annoying, but it's the best way to ES5 compliance, and it's
actually pretty quick to go through these and fix them, and it doesn't
require any deep understanding of the code in question.
dev-tech-js-engine mailing list
[hidden email] https://lists.mozilla.org/listinfo/dev-tech-js-engine
Re: JSAPI interface break about to land: C++ setter functions for JS properties
On 09/02/2011 22:25, Jim Blandy wrote:
> On 02/09/2011 12:03 PM, Mark Banner wrote:
>> On 09/02/2011 19:26, Jim Blandy wrote:
>>> I'm about to land a change to one of JSAPI's widely used public types.
>> How soon is "about" ?
> It is currently landed in TraceMonkey, and will appear in Mozilla
> Central via the next merge.
Thanks. I ran the latest tracemonkey through Thunderbird's try server
yesterday and Thunderbird came out all green. I suspect SeaMonkey would
do as well.
So unless there's hidden problems not covered by our tests, we should be
Not sure about Lightning, I know that does have some different