Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Unified Diff: src/generator.js

Issue 717123002: Leaving a generator via an exception causes it to close (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/generator.js
diff --git a/src/generator.js b/src/generator.js
index b35744a094f29ef0acd8baf3180bdfb7234a9084..49a1ed266cf173c9fe78a08ba058ad0015006cb3 100644
--- a/src/generator.js
+++ b/src/generator.js
@@ -21,7 +21,12 @@ function GeneratorObjectNext(value) {
}
if (DEBUG_IS_ACTIVE) %DebugPrepareStepInIfStepping(this);
- return %_GeneratorNext(this, value);
+ try {
+ return %_GeneratorNext(this, value);
+ } catch (e) {
+ %GeneratorClose(this);
+ throw e;
+ }
}
function GeneratorObjectThrow(exn) {
@@ -30,7 +35,12 @@ function GeneratorObjectThrow(exn) {
['[Generator].prototype.throw', this]);
}
- return %_GeneratorThrow(this, exn);
+ try {
+ return %_GeneratorThrow(this, exn);
+ } catch (e) {
rossberg 2014/11/12 11:56:27 Wait, won't this catch the very throw above?
wingo 2014/11/12 12:03:02 It could, if the generator itself doesn't catch it
+ %GeneratorClose(this);
+ throw e;
+ }
}
function GeneratorObjectIterator() {
« no previous file with comments | « no previous file | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698