Bug 637246 - generator.close() should return undefined (r=brendan)

This commit is contained in:
Luke Wagner
2011-03-07 09:33:55 -08:00
parent faed51e50f
commit 93c84f27f1
3 changed files with 25 additions and 1 deletions

View File

@@ -1376,6 +1376,7 @@ generator_op(JSContext *cx, JSGeneratorOp op, Value *vp, uintN argc)
default:
JS_ASSERT(op == JSGENOP_CLOSE);
gen->state = JSGEN_CLOSED;
JS_SET_RVAL(cx, vp, UndefinedValue());
return JS_TRUE;
}
} else if (gen->state == JSGEN_CLOSED) {
@@ -1389,6 +1390,7 @@ generator_op(JSContext *cx, JSGeneratorOp op, Value *vp, uintN argc)
return JS_FALSE;
default:
JS_ASSERT(op == JSGENOP_CLOSE);
JS_SET_RVAL(cx, vp, UndefinedValue());
return JS_TRUE;
}
}
@@ -1396,7 +1398,8 @@ generator_op(JSContext *cx, JSGeneratorOp op, Value *vp, uintN argc)
bool undef = ((op == JSGENOP_SEND || op == JSGENOP_THROW) && argc != 0);
if (!SendToGenerator(cx, op, obj, gen, undef ? vp[2] : UndefinedValue()))
return JS_FALSE;
*vp = gen->floatingFrame()->returnValue();
JS_SET_RVAL(cx, vp, gen->floatingFrame()->returnValue());
return JS_TRUE;
}