Bug 1278562 - Implement a C++ interface for DebuggerObject.promiseLifetime. r=jimb
authorEddy Bruel <ejpbruel@mozilla.com
Fri, 02 Sep 2016 13:23:40 +0200
changeset 312405 9c01cff2648aaa98a9ae4d72581b2933af74ac48
parent 312404 3613d167d065e344e81fa6aab23492f71dd996d1
child 312406 de45e910de91b18ed189a0bdbcb7c9b68aeb39b3
push id20447
push userkwierso@gmail.com
push dateFri, 02 Sep 2016 20:36:44 +0000
treeherderfx-team@969397f22187 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimb
bugs1278562
milestone51.0a1
Bug 1278562 - Implement a C++ interface for DebuggerObject.promiseLifetime. r=jimb
js/src/vm/Debugger.cpp
js/src/vm/Debugger.h
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -8688,19 +8688,22 @@ DebuggerObject::promiseReasonGetter(JSCo
     }
 
     return DebuggerObject::getPromiseReason(cx, object, args.rval());;
 }
 
 /* static */ bool
 DebuggerObject::promiseLifetimeGetter(JSContext* cx, unsigned argc, Value* vp)
 {
-    THIS_DEBUGOBJECT_PROMISE(cx, argc, vp, "get promiseLifetime", args, refobj);
-
-    args.rval().setNumber(promise->lifetime());
+    THIS_DEBUGOBJECT(cx, argc, vp, "get promiseLifetime", args, object);
+
+    if (!DebuggerObject::requirePromise(cx, object))
+        return false;
+
+    args.rval().setNumber(object->promiseLifetime());
     return true;
 }
 
 /* static */ bool
 DebuggerObject::promiseTimeToResolutionGetter(JSContext* cx, unsigned argc, Value* vp)
 {
     THIS_DEBUGOBJECT_PROMISE(cx, argc, vp, "get promiseTimeToResolution", args, refobj);
 
@@ -9410,16 +9413,22 @@ DebuggerObject::displayName() const
 }
 
 JS::PromiseState
 DebuggerObject::promiseState() const
 {
     return promise()->state();
 }
 
+double
+DebuggerObject::promiseLifetime() const
+{
+    return promise()->lifetime();
+}
+
 /* static */ bool
 DebuggerObject::getParameterNames(JSContext* cx, HandleDebuggerObject object,
                                   MutableHandle<StringVector> result)
 {
     MOZ_ASSERT(object->isDebuggeeFunction());
 
     RootedFunction referent(cx, &object->referent()->as<JSFunction>());
 
--- a/js/src/vm/Debugger.h
+++ b/js/src/vm/Debugger.h
@@ -1314,16 +1314,17 @@ class DebuggerObject : public NativeObje
     bool isScriptedProxy() const;
 #ifdef SPIDERMONKEY_PROMISE
     bool isPromise() const;
 #endif // SPIDERMONKEY_PROMISE
     JSAtom* name() const;
     JSAtom* displayName() const;
 #ifdef SPIDERMONKEY_PROMISE
     JS::PromiseState promiseState() const;
+    double promiseLifetime() const;
 #endif // SPIDERMONKEY_PROMISE
 
   private:
     enum {
         OWNER_SLOT
     };
 
     static const unsigned RESERVED_SLOTS = 1;