From 1bfe75470cd55e0296aab1b1805484e261c61fe7 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Tue, 9 Dec 2014 11:59:25 -0800 Subject: [PATCH] Bug 1102549 - Make Debugger::slowPathPromiseHook handle various JSTrapStatus results. r=shu --- js/src/jit-test/tests/debug/bug-1102549.js | 5 +++++ js/src/vm/Debugger.cpp | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 js/src/jit-test/tests/debug/bug-1102549.js diff --git a/js/src/jit-test/tests/debug/bug-1102549.js b/js/src/jit-test/tests/debug/bug-1102549.js new file mode 100644 index 000000000000..bf88ef3f3829 --- /dev/null +++ b/js/src/jit-test/tests/debug/bug-1102549.js @@ -0,0 +1,5 @@ +// |jit-test| error: log is not defined +var g = newGlobal(); +var dbg = new Debugger(g); +dbg.onPromiseSettled = function (g) { log += 's'; throw "foopy"; }; +g.settleFakePromise(g.makeFakePromise()); diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index 6b3ed5f769cb..0c0d481bbc6d 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -1683,9 +1683,10 @@ Debugger::slowPathPromiseHook(JSContext *cx, Hook hook, HandleObject promise) { MOZ_ASSERT(hook == OnNewPromise || hook == OnPromiseSettled); RootedValue rval(cx); - DebugOnly status = dispatchHook(cx, &rval, hook, promise); - MOZ_ASSERT(status == JSTRAP_CONTINUE); - MOZ_ASSERT(!cx->isExceptionPending()); + + // Promise hooks are infallible and we ignore errors from uncaught + // exceptions by design. + (void) dispatchHook(cx, &rval, hook, promise); }