mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Fix bug 563243. r=jorendorff
--HG-- extra : rebase_source : 4d0b7a62b0b1c458e2bb7f109e98da604ecba03a
This commit is contained in:
parent
152a313e86
commit
470ce2375e
@ -4236,12 +4236,11 @@ js_generic_fast_native_method_dispatcher(JSContext *cx, uintN argc, jsval *vp)
|
||||
fs = (JSFunctionSpec *) JSVAL_TO_PRIVATE(fsv);
|
||||
JS_ASSERT((~fs->flags & (JSFUN_FAST_NATIVE | JSFUN_GENERIC_NATIVE)) == 0);
|
||||
|
||||
/*
|
||||
* We know that vp[2] is valid because JS_DefineFunctions, which is our
|
||||
* only (indirect) referrer, defined us as requiring at least one argument
|
||||
* (notice how it passes fs->nargs + 1 as the next-to-last argument to
|
||||
* JS_DefineFunction).
|
||||
*/
|
||||
if (argc < 1) {
|
||||
js_ReportMissingArg(cx, vp, 0);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(vp[2])) {
|
||||
/*
|
||||
* Make sure that this is an object or null, as required by the generic
|
||||
@ -4266,15 +4265,9 @@ js_generic_fast_native_method_dispatcher(JSContext *cx, uintN argc, jsval *vp)
|
||||
*/
|
||||
if (!js_ComputeThis(cx, vp + 2))
|
||||
return JS_FALSE;
|
||||
/*
|
||||
* Protect against argc underflowing. By calling js_ComputeThis, we made
|
||||
* it as if the static was called with one parameter, the explicit |this|
|
||||
* object.
|
||||
*/
|
||||
if (argc != 0) {
|
||||
/* Clear the last parameter in case too few arguments were passed. */
|
||||
vp[2 + --argc] = JSVAL_VOID;
|
||||
}
|
||||
|
||||
/* Clear the last parameter in case too few arguments were passed. */
|
||||
vp[2 + --argc] = JSVAL_VOID;
|
||||
|
||||
native =
|
||||
#ifdef JS_TRACER
|
||||
@ -4300,12 +4293,11 @@ js_generic_native_method_dispatcher(JSContext *cx, JSObject *obj,
|
||||
JS_ASSERT((fs->flags & (JSFUN_FAST_NATIVE | JSFUN_GENERIC_NATIVE)) ==
|
||||
JSFUN_GENERIC_NATIVE);
|
||||
|
||||
/*
|
||||
* We know that argv[0] is valid because JS_DefineFunctions, which is our
|
||||
* only (indirect) referrer, defined us as requiring at least one argument
|
||||
* (notice how it passes fs->nargs + 1 as the next-to-last argument to
|
||||
* JS_DefineFunction).
|
||||
*/
|
||||
if (argc < 1) {
|
||||
js_ReportMissingArg(cx, argv - 2, 0);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(argv[0])) {
|
||||
/*
|
||||
* Make sure that this is an object or null, as required by the generic
|
||||
@ -4333,15 +4325,8 @@ js_generic_native_method_dispatcher(JSContext *cx, JSObject *obj,
|
||||
js_GetTopStackFrame(cx)->thisv = argv[-1];
|
||||
JS_ASSERT(cx->fp->argv == argv);
|
||||
|
||||
/*
|
||||
* Protect against argc underflowing. By calling js_ComputeThis, we made
|
||||
* it as if the static was called with one parameter, the explicit |this|
|
||||
* object.
|
||||
*/
|
||||
if (argc != 0) {
|
||||
/* Clear the last parameter in case too few arguments were passed. */
|
||||
argv[--argc] = JSVAL_VOID;
|
||||
}
|
||||
/* Clear the last parameter in case too few arguments were passed. */
|
||||
argv[--argc] = JSVAL_VOID;
|
||||
|
||||
return fs->call(cx, JSVAL_TO_OBJECT(argv[-1]), argc, argv, rval);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user