Skip to content

Commit abc1f05

Browse files
committed
Ensure that GeneratorReturnExceptions are not handled by InterpreterStackFrame::DebugProcess
1 parent 288d7fe commit abc1f05

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

lib/Runtime/Language/InterpreterStackFrame.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2353,8 +2353,9 @@ namespace Js
23532353
if (exception)
23542354
{
23552355
bool skipException = false;
2356-
if (exception != scriptContext->GetThreadContext()->GetPendingSOErrorObject()
2357-
&& exception != scriptContext->GetThreadContext()->GetPendingOOMErrorObject())
2356+
if (!exception->IsGeneratorReturnException() &&
2357+
exception != scriptContext->GetThreadContext()->GetPendingSOErrorObject() &&
2358+
exception != scriptContext->GetThreadContext()->GetPendingOOMErrorObject())
23582359
{
23592360
skipException = exception->IsDebuggerSkip();
23602361
}

test/es6/generators-functionality.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,11 @@ var tests = [
949949
assert.areEqual({ value: 2, done: false }, g.return(100), "Return causes the finally block to execute");
950950
assert.throws(function () { g.next(); }, ExpectedException, "Second next call should throw from finally block");
951951
assert.areEqual({ value: undefined, done: true }, g.next(), "Method execution has finished");
952+
953+
gf = function* () { try { throw new ExpectedException(); } catch (e) { throw e; } }
954+
g = gf();
955+
assert.throws(function () { g.next() }, ExpectedException, "First next call should rethrow exception");
956+
assert.areEqual({ value: 2, done: true }, g.return(2), "Return statement completes the function from try block");
952957
}
953958
},
954959
{

test/es6/rlexe.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,13 @@
868868
<tags>exclude_arm</tags>
869869
</default>
870870
</test>
871+
<test>
872+
<default>
873+
<files>generators-functionality.js</files>
874+
<compile-flags>-ES6Generators -ES6Classes -ES6DefaultArgs -debuglaunch -args summary -endargs</compile-flags>
875+
<tags>exclude_arm</tags>
876+
</default>
877+
</test>
871878
<test>
872879
<default>
873880
<files>generators-deferred.js</files>

test/es7/rlexe.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
<baseline>asyncawait-functionality.baseline</baseline>
2020
</default>
2121
</test>
22+
<test>
23+
<default>
24+
<files>asyncawait-functionality.js</files>
25+
<compile-flags>-es6experimental -nodeferparse -debuglaunch -args summary -endargs</compile-flags>
26+
<baseline>asyncawait-functionality.baseline</baseline>
27+
</default>
28+
</test>
2229
<test>
2330
<default>
2431
<files>asyncawait-functionality.js</files>

0 commit comments

Comments
 (0)