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

New rule: don't pass values to the JSAPI using the {u,}int{8,16,32,64} types

27 views
Skip to first unread message

Jeff Walden

unread,
Dec 15, 2011, 1:16:23 PM12/15/11
to
Shortly, in bug 708735, we'll be removing the uint32-style types from the JSAPI, and the JSAPI will switch over entirely to uint32_t and the like. Thus when calling JSAPI methods, you should use the <stdint.h> types instead of the uint32-style types (which various other headers still expose, this being much of the reason the JSAPI is switching) or PRUint32-style types or whatever. If you don't, your code might break. If the argument type in question is a pointer type, it'll probably break. If it's just a value type, it probably won't. But better to be consistent than not.

As part of bug 708735 I'll be fixing all code in the tree using methods currently being passed uint32* and the like -- necessarily, to be able to compile. I'm not fixing the methods currently being passed uint32 or PRUint32 or similar (I encourage people to fix such code when they see it). These changes will touch a lot of code, probably partially bitrotting people's in-progress patches. Your merge tool should make short work of dealing with conflicts, if any.

Anyway, just a head's-up: use the <stdint.h> types when dealing with the JSAPI from now on. And watch out for a patch coming soon that makes this change for many/most current users.

Jeff

Jeff Walden

unread,
Dec 15, 2011, 6:55:22 PM12/15/11
to
My current plan is to land this tomorrow morning, 0345 or so ZST ('zilla Standard Time, i.e. Pacific Standard Time right now), doing the close-both-trees-then-land-and-pull dance to minimize overall pain as best I can. There might be some slippage on exact timing depending on whatever rebasing/postfixing I need to do, which will depend on what lands between now and then, but I'm going to hold to that particular time as best as I can.

Jeff

Jonas Sicking

unread,
Dec 16, 2011, 1:12:38 AM12/16/11
to Jeff Walden, dev-pl...@lists.mozilla.org
Would it be worth doing this after the branching on tuesday as to
avoid disrupting people that are trying to get stuff landed before
then?

I personally don't have anything that uses JSAPI enough that it's
likely to be significantly affected, but it seems like a bad timing
for such a landing.

/ Jonas

Jeff Walden

unread,
Dec 16, 2011, 1:07:17 PM12/16/11
to
On 12/16/2011 01:12 AM, Jonas Sicking wrote:
> Would it be worth doing this after the branching on tuesday as to
> avoid disrupting people that are trying to get stuff landed before
> then?

...well, seeing as I didn't see this post before now, I guess it's kind of moot. :-\

That said, the basic amount someone would need to change a patch is to make sure to use the right type for addresses passed into the JSAPI, and to make sure to use the right argument types for JSAPI callbacks -- and that's usually pretty small. Consider bug 661877, for example, which landed early morning today in <https://hg.mozilla.org/mozilla-central/rev/5efcb9c3b375>. That patch is more than a bit large, and it definitely has JSAPI interaction points -- yet even still the necessary changes to it come to four lines. I'd expect similar for most people's patches, usually.

Jeff
0 new messages