Bug 530879 - Generators get incorrect arguments.length. Discovered by Donny Viszneki. r=brendan.

This commit is contained in:
Jason Orendorff
2009-12-03 16:12:09 -06:00
parent efa585aeb0
commit e89417765e
3 changed files with 12 additions and 1 deletions

View File

@@ -766,7 +766,7 @@ js_NewGenerator(JSContext *cx, JSStackFrame *fp)
/* Copy rval, argv and vars. */
gen->frame.rval = fp->rval;
memcpy(slots, fp->argv - 2, (2 + nargs) * sizeof(jsval));
gen->frame.argc = nargs;
gen->frame.argc = fp->argc;
gen->frame.argv = slots + 2;
slots += 2 + nargs;
memcpy(slots, fp->slots, fp->script->nfixed * sizeof(jsval));