Bug 1317460 - Detect uncatchable exception in AsyncFunctionThrown. r=till, a=jcristau
authorTooru Fujisawa <arai_a@mac.com>
Tue, 15 Nov 2016 13:00:50 +0900
changeset 352453 94b2a92a2b8d07a425f0a22ee721de26bc87223c
parent 352452 3375fcac31eb402bf5e610a7be793f2943bd3cde
child 352454 f52c628bce82e3e20cb6d9a6b27ba5372bf8849c
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill, jcristau
bugs1317460
milestone52.0a2
Bug 1317460 - Detect uncatchable exception in AsyncFunctionThrown. r=till, a=jcristau
js/src/builtin/Promise.cpp
js/src/jit-test/tests/auto-regress/bug1317460.js
--- a/js/src/builtin/Promise.cpp
+++ b/js/src/builtin/Promise.cpp
@@ -2128,16 +2128,20 @@ js::CreatePromiseObjectForAsync(JSContex
     promise->setFixedSlot(PromiseSlot_AwaitGenerator, generatorVal);
     return promise;
 }
 
 // Async Functions proposal 2.2 steps 3.f, 3.g.
 MOZ_MUST_USE bool
 js::AsyncFunctionThrown(JSContext* cx, Handle<PromiseObject*> resultPromise)
 {
+    // Not much we can do about uncatchable exceptions, so just bail.
+    if (!cx->isExceptionPending())
+        return false;
+
     // Step 3.f.
     RootedValue exc(cx);
     if (!GetAndClearException(cx, &exc))
         return false;
 
     if (!RejectMaybeWrappedPromise(cx, resultPromise, exc))
         return false;
 
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/auto-regress/bug1317460.js
@@ -0,0 +1,11 @@
+// |jit-test| error:TypeError
+
+g = newGlobal();
+g.parent = this;
+g.eval("(" + function() {
+    Debugger(parent).onExceptionUnwind = function() 0;
+} + ")()");
+async function f() {
+    t;
+}
+f();