Last Comment Bug 328037 - JS_CallFunctionName should return the same as JS_CallFunctionValue
: JS_CallFunctionName should return the same as JS_CallFunctionValue
Status: RESOLVED FIXED
[tcn-dl]
: fixed1.8.0.2, fixed1.8.1
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: Trunk
: All All
: -- minor (vote)
: ---
Assigned To: Brendan Eich [:brendan]
:
: Jason Orendorff [:jorendorff]
Mentors:
Depends on:
Blocks: js1.6rc1
  Show dependency treegraph
 
Reported: 2006-02-21 05:46 PST by Mads Bondo Dydensborg
Modified: 2006-03-02 14:08 PST (History)
5 users (show)
dveditz: blocking1.8.0.2+
bob: in‑testsuite-
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
fix (777 bytes, patch)
2006-02-21 19:02 PST, Brendan Eich [:brendan]
mrbkap: review+
brendan: approval‑branch‑1.8.1+
dveditz: approval1.8.0.2+
Details | Diff | Splinter Review

Description Mads Bondo Dydensborg 2006-02-21 05:46:31 PST
User-Agent:       Mozilla/5.0 (compatible; Konqueror/3.2; Linux) KHTML/3.2.3 (like Gecko)
Build Identifier: cvs

If you look at the source to current CVS js, here is the last lines for JS_CallFunctionName:
    ok = js_InternalCall(cx, obj, fval, argc, argv, rval);
    LAST_FRAME_CHECKS(cx, ok);
    return JS_TRUE;
and, for JS_CallFunctionValue
    ok = js_InternalCall(cx, obj, fval, argc, argv, rval);
    LAST_FRAME_CHECKS(cx, ok);
    return ok;

I think JS_CallFunctionName should return ok, not JS_TRUE. This is based on reading the docs. The difference is most clear, if your code throws an unhandled exception.

A work around is to call JS_GetProperty for the name, then call JS_CallFunctionValue. This will allow calls to function that throws, to return JS_FALSE.


Reproducible: Always
Comment 1 Brendan Eich [:brendan] 2006-02-21 19:01:43 PST
Whoops -- easily fixed.  Thanks for pointing this typo out.

/be
Comment 2 Brendan Eich [:brendan] 2006-02-21 19:02:38 PST
Created attachment 212684 [details] [diff] [review]
fix 

Trivial, I'm checking in.

/be
Comment 3 Blake Kaplan (:mrbkap) 2006-02-21 19:02:57 PST
Comment on attachment 212684 [details] [diff] [review]
fix 

Yes.
Comment 4 Brendan Eich [:brendan] 2006-02-21 19:04:52 PST
Fixed on trunk.

/be
Comment 5 Daniel Veditz [:dveditz] 2006-02-22 11:23:46 PST
Comment on attachment 212684 [details] [diff] [review]
fix 

approved for 1.8.0 branch, a=dveditz
Comment 6 Brendan Eich [:brendan] 2006-02-22 15:43:57 PST
Fixed on 1.8* branches.

/be
Comment 7 Dave Liebreich [:davel] 2006-03-02 14:08:56 PST
Please provide guidance for testing this fix.

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