Index: test/debugger/debug/es8/debug-async-liveedit.js |
diff --git a/test/debugger/debug/es8/debug-async-liveedit.js b/test/debugger/debug/es8/debug-async-liveedit.js |
index cad314cfadb4bccb6c381b9a2117a38d18a7dcdd..761a24fdfa75526f191ff9efdb5a7b0c07399160 100644 |
--- a/test/debugger/debug/es8/debug-async-liveedit.js |
+++ b/test/debugger/debug/es8/debug-async-liveedit.js |
@@ -48,6 +48,25 @@ function MakeFunction() { |
assertPromiseValue('Cat', promise); |
})(); |
+function ExecuteInDebugContext(f) { |
+ var result; |
+ var exception = null; |
+ Debug.setListener(function(event) { |
+ if (event == Debug.DebugEvent.Break) { |
+ try { |
+ result = f(); |
+ } catch (e) { |
+ // Rethrow this exception later. |
+ exception = e; |
+ } |
+ } |
+ }); |
+ debugger; |
+ Debug.setListener(null); |
+ if (exception !== null) throw exception; |
+ return result; |
+} |
+ |
function patch(fun, from, to) { |
function debug() { |
var log = new Array(); |
@@ -61,7 +80,7 @@ function patch(fun, from, to) { |
print("Change log: " + JSON.stringify(log) + "\n"); |
} |
} |
- %ExecuteInDebugContext(debug); |
+ ExecuteInDebugContext(debug); |
} |
// Try to edit a MakeAsyncFunction while it's running, then again while it's |