Bug 1314028 - Don't try to handle uncatchable exceptions in AbruptRejectPromise. r=luke
authorTill Schneidereit <till@tillschneidereit.net>
Thu, 03 Nov 2016 23:07:50 +0100
changeset 347930 c71bdc18c5c77be4f8b40ced4adac2ba44b6b34c
parent 347929 0394048027e82fc887c9e8008b6bd468d4c4a49e
child 347931 0d05d3e09e51f1fb71a1b37abc8dc19156dac723
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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;