mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 985894 - Sending a value to a newborn generator should not raise an error r=jorendorff
This commit is contained in:
parent
38775afe87
commit
6fca650383
@ -1921,13 +1921,6 @@ star_generator_next(JSContext *cx, CallArgs args)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (gen->state == JSGEN_NEWBORN && args.hasDefined(0)) {
|
||||
RootedValue val(cx, args[0]);
|
||||
js_ReportValueError(cx, JSMSG_BAD_GENERATOR_SEND,
|
||||
JSDVG_SEARCH_STACK, val, js::NullPtr());
|
||||
return false;
|
||||
}
|
||||
|
||||
return SendToGenerator(cx, JSGENOP_SEND, thisObj, gen, args.get(0), StarGenerator,
|
||||
args.rval());
|
||||
}
|
||||
@ -1956,13 +1949,6 @@ legacy_generator_next(JSContext *cx, CallArgs args)
|
||||
if (gen->state == JSGEN_CLOSED)
|
||||
return js_ThrowStopIteration(cx);
|
||||
|
||||
if (gen->state == JSGEN_NEWBORN && args.hasDefined(0)) {
|
||||
RootedValue val(cx, args[0]);
|
||||
js_ReportValueError(cx, JSMSG_BAD_GENERATOR_SEND,
|
||||
JSDVG_SEARCH_STACK, val, js::NullPtr());
|
||||
return false;
|
||||
}
|
||||
|
||||
return SendToGenerator(cx, JSGENOP_SEND, thisObj, gen, args.get(0), LegacyGenerator,
|
||||
args.rval());
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ function TestGenerator(g, expected_values_for_next,
|
||||
function testSend(thunk) {
|
||||
var iter = thunk();
|
||||
for (var i = 0; i < expected_values_for_send.length; i++) {
|
||||
assertIteratorResult(i ? iter.next(send_val) : iter.next(),
|
||||
assertIteratorResult(iter.next(send_val),
|
||||
expected_values_for_send[i],
|
||||
i == expected_values_for_send.length - 1);
|
||||
}
|
||||
|
@ -28,20 +28,13 @@ function test()
|
||||
actual = 'after yield';
|
||||
}
|
||||
|
||||
expect = /TypeError: attempt to send ("before yield"|value) to newborn generator/i;
|
||||
var gen = yielder();
|
||||
try
|
||||
{
|
||||
gen.send('before yield');
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
actual = ex + '';
|
||||
}
|
||||
reportMatch(expect, actual, 'send(value) to newborn generator');
|
||||
|
||||
expect = 'before yield';
|
||||
gen.send('foo');
|
||||
reportCompare(expect, actual, 'send(value) to newborn generator');
|
||||
|
||||
var gen = yielder();
|
||||
expect = 'before yield';
|
||||
gen.send(undefined);
|
||||
reportCompare(expect, actual, 'send(undefined) to newborn generator');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user