Bug 1317460 - Detect uncatchable exception in AsyncFunctionThrown. r=till
authorTooru Fujisawa <arai_a@mac.com>
Tue, 15 Nov 2016 13:00:50 +0900
changeset 322475 be0a409b178acc10fc89b0d528c78a03755d89e4
parent 322474 e725cf00b32e304c50e4df8614cf01dfb49c095d
child 322485 bc4ca02773a468d8a52b2b1218e8e27f69749b25
push id83887
push userarai_a@mac.com
push dateTue, 15 Nov 2016 04:01:12 +0000
treeherdermozilla-inbound@be0a409b178a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill
bugs1317460
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1317460 - Detect uncatchable exception in AsyncFunctionThrown. r=till
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();