Re: Removing JS_CallOnce

Steve Fink <[email protected]> Tue, 23 Aug 2016 15:41:40 -0700
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <[email protected]>
On 08/23/2016 01:12 PM, Mihai Dobrescu wrote:
> On Tuesday, August 23, 2016 at 4:28:00 PM UTC+3, Ms2ger wrote:
>> Hey all,
>>
>> JSAPI contains a JS_CallOnce function, documented as follows:
>>
>>> The first call to JS_CallOnce by any thread in a process will call
>>> 'func'. Later calls to JS_CallOnce with the same JSCallOnceType
>>> object will be suppressed.
>>>
>>> Equivalently: each distinct JSCallOnceType object will allow one
>>> JS_CallOnce to invoke its JSInitCallback.
>>
>> I believe the implementation of this function is now the only code in
>> SpiderMonkey that depends on NSPR.
>>
>> As jandem said:
>>
>>> It's a pretty weird API for something that has little to do with JS
>>> (embedders have other ways to do it), and it's not used in Firefox.
>>
>> Any objections to removing the API, and dropping the dependency on NSPR
>> once and for all?
>>
>> Thanks
>> Ms2ger
>
> I love you!
>

Note that we're not *quite* there. We have a (very) few other uses of 
NSPR lying around still.

By the way, I'm pretty sure I added JS_CallOnce, for a long-dead project 
that I never managed to land. I would be happy to see JS_CallOnce die.