diff --git a/dom/promise/Promise.cpp b/dom/promise/Promise.cpp index c8f6b525e33d..6dd368b51a73 100644 --- a/dom/promise/Promise.cpp +++ b/dom/promise/Promise.cpp @@ -7,6 +7,7 @@ #include "mozilla/dom/Promise.h" #include "jsfriendapi.h" +#include "js/Debug.h" #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/DOMError.h" #include "mozilla/dom/OwningNonNull.h" @@ -324,8 +325,8 @@ Promise::CreateWrapper(ErrorResult& aRv) } JSContext* cx = jsapi.cx(); - JS::Rooted ignored(cx); - if (!WrapNewBindingObject(cx, this, &ignored)) { + JS::Rooted wrapper(cx); + if (!WrapNewBindingObject(cx, this, &wrapper)) { JS_ClearPendingException(cx); aRv.Throw(NS_ERROR_OUT_OF_MEMORY); return; @@ -339,6 +340,9 @@ Promise::CreateWrapper(ErrorResult& aRv) aRv.Throw(NS_ERROR_OUT_OF_MEMORY); return; } + + JS::RootedObject obj(cx, &wrapper.toObject()); + JS::dbg::onNewPromise(cx, obj); } void diff --git a/dom/promise/tests/chrome.ini b/dom/promise/tests/chrome.ini index bb04ab1bf268..45b4948bad25 100644 --- a/dom/promise/tests/chrome.ini +++ b/dom/promise/tests/chrome.ini @@ -1,3 +1,4 @@ [DEFAULT] [test_dependentPromises.html] +[test_on_new_promise.html] diff --git a/dom/promise/tests/test_on_new_promise.html b/dom/promise/tests/test_on_new_promise.html new file mode 100644 index 000000000000..634dd7dda85e --- /dev/null +++ b/dom/promise/tests/test_on_new_promise.html @@ -0,0 +1,45 @@ + + + + + + + Test for interaction with SpiderMonkey's Debugger.prototype.onNewPromise + + + + +

+ +
+  
+
+ + +