Bug 1518662 - Clear pending exception when leaving promise rejection tracker callback. r=jorendorff
authorTooru Fujisawa <arai_a@mac.com>
Thu, 10 Jan 2019 05:17:06 +0000
changeset 510308 463d00cf41fdc9baf09ab663c55e680ec3dce6b6
parent 510307 33784a7ae90baf030b7a41b11f828a8767fa51ae
child 510309 4e654e9222bd7d2e16ab62bd3d3441059b25d0c8
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1518662
milestone66.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 1518662 - Clear pending exception when leaving promise rejection tracker callback. r=jorendorff Differential Revision: https://phabricator.services.mozilla.com/D16003
js/src/jit-test/tests/promise/unhandled-rejections-oom.js
js/src/shell/js.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/promise/unhandled-rejections-oom.js
@@ -0,0 +1,3 @@
+// |jit-test| allow-oom; skip-if: !('oomTest' in this)
+
+oomTest(async function() {}, { keepFailing: true });
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -1102,16 +1102,18 @@ static bool TrackUnhandledRejections(JSC
   }
 
   return true;
 }
 
 static void ForwardingPromiseRejectionTrackerCallback(
     JSContext* cx, JS::HandleObject promise,
     JS::PromiseRejectionHandlingState state, void* data) {
+  AutoReportException are(cx);
+
   if (!TrackUnhandledRejections(cx, promise, state)) {
     return;
   }
 
   RootedValue callback(cx,
                        GetShellContext(cx)->promiseRejectionTrackerCallback);
   if (callback.isNull()) {
     return;
@@ -1123,19 +1125,17 @@ static void ForwardingPromiseRejectionTr
   args[0].setObject(*promise);
   args[1].setInt32(static_cast<int32_t>(state));
 
   if (!JS_WrapValue(cx, args[0])) {
     return;
   }
 
   RootedValue rval(cx);
-  if (!Call(cx, callback, UndefinedHandleValue, args, &rval)) {
-    JS_ClearPendingException(cx);
-  }
+  (void) Call(cx, callback, UndefinedHandleValue, args, &rval);
 }
 
 static bool SetPromiseRejectionTrackerCallback(JSContext* cx, unsigned argc,
                                                Value* vp) {
   CallArgs args = CallArgsFromVp(argc, vp);
 
   if (!IsFunctionObject(args.get(0))) {
     JS_ReportErrorASCII(