Last Comment Bug 738356 - Add JSAPI for binding functions
: Add JSAPI for binding functions
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: Trunk
: All All
: P1 normal (vote)
: mozilla14
Assigned To: Boris Zbarsky [:bz]
:
Mentors:
Depends on:
Blocks: 726949
  Show dependency treegraph
 
Reported: 2012-03-22 11:11 PDT by Boris Zbarsky [:bz]
Modified: 2013-04-22 07:42 PDT (History)
6 users (show)
bzbarsky: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Add JSAPI for doing the equivalent of Function.prototype.bind. (4.49 KB, patch)
2012-03-22 20:44 PDT, Boris Zbarsky [:bz]
jorendorff: review+
Details | Diff | Splinter Review
Updated to comments, no tests yet (4.57 KB, patch)
2012-04-02 13:04 PDT, Boris Zbarsky [:bz]
no flags Details | Diff | Splinter Review

Description Boris Zbarsky [:bz] 2012-03-22 11:11:26 PDT
I want this for bug 726949.
Comment 1 Boris Zbarsky [:bz] 2012-03-22 20:44:05 PDT
Created attachment 608590 [details] [diff] [review]
Add JSAPI for doing the equivalent of Function.prototype.bind.
Comment 2 Jason Orendorff [:jorendorff] 2012-03-30 08:06:22 PDT
Comment on attachment 608590 [details] [diff] [review]
Add JSAPI for doing the equivalent of Function.prototype.bind.

Looks good.

Please change the functions JS_BindCallable and js_fun_bind to have return type JSObject * rather than an out parameter.

Can we have a jsapi-test? See js/src/jsapi-tests/README.
Comment 3 Boris Zbarsky [:bz] 2012-03-30 09:56:37 PDT
> Please change the functions JS_BindCallable and js_fun_bind to have return type 
> JSObject* rather than an out parameter.

And use an out param boolean to communicate failure state?  That seems odd for the JS engine...

> Can we have a jsapi-test?

Probably, once I have time to work on this again.
Comment 4 Boris Zbarsky [:bz] 2012-04-02 12:44:46 PDT
Per irc comments, just use NULL return to indicate failure.
Comment 5 Boris Zbarsky [:bz] 2012-04-02 13:04:28 PDT
Created attachment 611562 [details] [diff] [review]
Updated to comments, no tests yet
Comment 6 Boris Zbarsky [:bz] 2012-04-05 10:17:45 PDT
http://hg.mozilla.org/mozilla-central/rev/f381c497e47a with JSAPI test.
Comment 8 Matt Brubeck (:mbrubeck) 2012-04-06 11:31:36 PDT
https://hg.mozilla.org/mozilla-central/rev/f381c497e47a

Note You need to log in before you can comment on or make changes to this bug.