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 321237 c71bdc18c5c77be4f8b40ced4adac2ba44b6b34c
parent 321236 0394048027e82fc887c9e8008b6bd468d4c4a49e
child 321238 0d05d3e09e51f1fb71a1b37abc8dc19156dac723
push id30920
push userphilringnalda@gmail.com
push dateSat, 05 Nov 2016 20:41:02 +0000
treeherdermozilla-central@c44c01dfd264 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs1314028
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 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;