Bug 1314028 - Don't try to handle uncatchable exceptions in AbruptRejectPromise. r?luke draft
authorTill Schneidereit <till@tillschneidereit.net>
Thu, 03 Nov 2016 23:07:50 +0100
changeset 433532 2cac7d9c823d8dbe4a0a0dc4eb33d877720eafc3
parent 433531 17acf8810c986f8263a35b69646a1575832227af
child 535920 c8f8fe7a782e43fb2ddccd1f7b494a9c65cd58c0
push id34612
push userbmo:till@tillschneidereit.net
push dateThu, 03 Nov 2016 22:08:51 +0000
reviewersluke
bugs1314028
milestone52.0a1
Bug 1314028 - Don't try to handle uncatchable exceptions in AbruptRejectPromise. r?luke MozReview-Commit-ID: K0ThI6m1piW
js/src/builtin/Promise.cpp
--- a/js/src/builtin/Promise.cpp
+++ b/js/src/builtin/Promise.cpp
@@ -133,16 +133,20 @@ static MOZ_MUST_USE bool RunResolutionFu
 
 // ES2016, 25.4.1.1.1, Steps 1.a-b.
 // Extracting all of this internal spec algorithm into a helper function would
 // be tedious, so the check in step 1 and the entirety of step 2 aren't
 // included.
 static bool
 AbruptRejectPromise(JSContext *cx, CallArgs& args, HandleObject promiseObj, HandleObject reject)
 {
+    // Not much we can do about uncatchable exceptions, so just bail.
+    if (!cx->isExceptionPending())
+        return false;
+
     // Step 1.a.
     RootedValue reason(cx);
     if (!GetAndClearException(cx, &reason))
         return false;
 
     if (!RunResolutionFunction(cx, reject, reason, RejectMode, promiseObj))
         return false;