Subj : Re: why does it not print Hello twice? To : netscape.public.mozilla.jseng From : Sterling Bates Date : Thu Apr 15 2004 11:04 am Brendan Eich wrote: > - fun = js_ValueToFunction(cx, &argv[1], 0); > - if (!fun) > - return JS_FALSE; > - argv[1] = OBJECT_TO_JSVAL(fun->object); > + if (JSVAL_IS_FUNCTION(cx, argv[1])) { > + funobj = JSVAL_TO_OBJECT(argv[1]); > + } else { > + fun = js_ValueToFunction(cx, &argv[1], 0); > + if (!fun) > + return JS_FALSE; > + funobj = fun->object; > + } > + argv[1] = OBJECT_TO_JSVAL(funobj); For the junior padawans among us: where did js_ValueToFunction() break the code in this case? Was it the statement at http://lxr.mozilla.org/mozilla/source/js/src/jsfun.c#2028 ? Aside from JS_GetPrivate, the js_ValueToFunction code seems to do exactly what the patch does above (as far as Jens' testcase goes). Sterling .