Bug 1491403 - Part 1: Add a promise argument to JSEnqueuePromiseJobCallback r=arai
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 09 Oct 2018 21:42:18 +0000
changeset 496070 2ba3a8f9424d711a83765981eb8dedb50944e507
parent 496069 7e925d47de47a3c5775c6169c039e9240fa4f21b
child 496071 b62dd5af680e03d48caaa31f6fa337b12dc0eeb7
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarai
bugs1491403
milestone64.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 1491403 - Part 1: Add a promise argument to JSEnqueuePromiseJobCallback r=arai Differential Revision: https://phabricator.services.mozilla.com/D7003
js/src/jsapi.h
js/src/vm/JSContext.cpp
js/src/vm/Runtime.cpp
xpcom/base/CycleCollectedJSContext.cpp
xpcom/base/CycleCollectedJSContext.h
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -184,17 +184,17 @@ struct JSFreeOp {
 
 typedef bool
 (* JSInterruptCallback)(JSContext* cx);
 
 typedef JSObject*
 (* JSGetIncumbentGlobalCallback)(JSContext* cx);
 
 typedef bool
-(* JSEnqueuePromiseJobCallback)(JSContext* cx, JS::HandleObject job,
+(* JSEnqueuePromiseJobCallback)(JSContext* cx, JS::HandleObject promise, JS::HandleObject job,
                                 JS::HandleObject allocationSite, JS::HandleObject incumbentGlobal,
                                 void* data);
 
 namespace JS {
 
 enum class PromiseRejectionHandlingState {
     Unhandled,
     Handled
--- a/js/src/vm/JSContext.cpp
+++ b/js/src/vm/JSContext.cpp
@@ -1131,17 +1131,18 @@ JSContext::recoverFromOutOfMemory()
         if (isExceptionPending()) {
             MOZ_ASSERT(isThrowingOutOfMemory());
             clearPendingException();
         }
     }
 }
 
 static bool
-InternalEnqueuePromiseJobCallback(JSContext* cx, JS::HandleObject job,
+InternalEnqueuePromiseJobCallback(JSContext* cx, JS::HandleObject promise,
+                                  JS::HandleObject job,
                                   JS::HandleObject allocationSite,
                                   JS::HandleObject incumbentGlobal, void* data)
 {
     MOZ_ASSERT(job);
     JS::JobQueueMayNotBeEmpty(cx);
     if (!cx->jobQueue->append(job)) {
         ReportOutOfMemory(cx);
         return false;
--- a/js/src/vm/Runtime.cpp
+++ b/js/src/vm/Runtime.cpp
@@ -658,17 +658,18 @@ JSRuntime::enqueuePromiseJob(JSContext* 
         // builtin/Promise.cpp for details.
         if (IsWrapper(promise)) {
             unwrappedPromise = UncheckedUnwrap(promise);
         }
         if (unwrappedPromise->is<PromiseObject>()) {
             allocationSite = JS::GetPromiseAllocationSite(unwrappedPromise);
         }
     }
-    return cx->enqueuePromiseJobCallback(cx, job, allocationSite, incumbentGlobal, data);
+    return cx->enqueuePromiseJobCallback(cx, promise, job, allocationSite,
+                                         incumbentGlobal, data);
 }
 
 void
 JSRuntime::addUnhandledRejectedPromise(JSContext* cx, js::HandleObject promise)
 {
     MOZ_ASSERT(promise->is<PromiseObject>());
     if (!cx->promiseRejectionTrackerCallback) {
         return;
--- a/xpcom/base/CycleCollectedJSContext.cpp
+++ b/xpcom/base/CycleCollectedJSContext.cpp
@@ -255,16 +255,17 @@ CycleCollectedJSContext::GetIncumbentGlo
     return global->GetGlobalJSObject();
   }
   return nullptr;
 }
 
 /* static */
 bool
 CycleCollectedJSContext::EnqueuePromiseJobCallback(JSContext* aCx,
+                                                   JS::HandleObject aPromise,
                                                    JS::HandleObject aJob,
                                                    JS::HandleObject aAllocationSite,
                                                    JS::HandleObject aIncumbentGlobal,
                                                    void* aData)
 {
   CycleCollectedJSContext* self = static_cast<CycleCollectedJSContext*>(aData);
   MOZ_ASSERT(aCx == self->Context());
   MOZ_ASSERT(Get() == self);
--- a/xpcom/base/CycleCollectedJSContext.h
+++ b/xpcom/base/CycleCollectedJSContext.h
@@ -108,16 +108,17 @@ protected:
   size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
 
 private:
   MOZ_IS_CLASS_INIT
   void InitializeCommon();
 
   static JSObject* GetIncumbentGlobalCallback(JSContext* aCx);
   static bool EnqueuePromiseJobCallback(JSContext* aCx,
+                                        JS::HandleObject aPromise,
                                         JS::HandleObject aJob,
                                         JS::HandleObject aAllocationSite,
                                         JS::HandleObject aIncumbentGlobal,
                                         void* aData);
   static void PromiseRejectionTrackerCallback(JSContext* aCx,
                                               JS::HandleObject aPromise,
                                               JS::PromiseRejectionHandlingState state,
                                               void* aData);