mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Fix bug 563243. r=jorendorff
--HG-- extra : rebase_source : 4d0b7a62b0b1c458e2bb7f109e98da604ecba03a
This commit is contained in:
parent
c346baf81a
commit
5acba45793
@ -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