Bug 1278562 - Implement a C++ interface for DebuggerObject.promiseValue. r=jimb

This commit is contained in:
Eddy Bruel 2016-08-26 14:08:53 +02:00
Родитель 8c3262835f
Коммит af094784e5
2 изменённых файлов: 23 добавлений и 8 удалений

Просмотреть файл

@ -8633,19 +8633,17 @@ DebuggerObject::promiseStateGetter(JSContext* cx, unsigned argc, Value* vp)
/* static */ bool
DebuggerObject::promiseValueGetter(JSContext* cx, unsigned argc, Value* vp)
{
THIS_DEBUGOBJECT_OWNER_PROMISE(cx, argc, vp, "get promiseValue", args, dbg, refobj);
THIS_DEBUGOBJECT(cx, argc, vp, "get promiseValue", args, object);
if (promise->state() != JS::PromiseState::Fulfilled) {
if (!DebuggerObject::requirePromise(cx, object))
return false;
if (object->promiseState() != JS::PromiseState::Fulfilled) {
args.rval().setUndefined();
return true;
}
RootedValue result(cx, promise->value());
if (!dbg->wrapDebuggeeValue(cx, &result))
return false;
args.rval().set(result);
return true;
return DebuggerObject::getPromiseValue(cx, object, args.rval());;
}
/* static */ bool
@ -9530,6 +9528,18 @@ DebuggerObject::getErrorMessageName(JSContext* cx, HandleDebuggerObject object,
return true;
}
#ifdef SPIDERMONKEY_PROMISE
/* static */ bool
DebuggerObject::getPromiseValue(JSContext* cx, HandleDebuggerObject object,
MutableHandleValue result)
{
MOZ_ASSERT(object->promiseState() == JS::PromiseState::Fulfilled);
result.set(object->promise()->value());
return object->owner()->wrapDebuggeeValue(cx, result);
}
#endif // SPIDERMONKEY_PROMISE
/* static */ bool
DebuggerObject::isExtensible(JSContext* cx, HandleDebuggerObject object, bool& result)
{

Просмотреть файл

@ -1257,6 +1257,11 @@ class DebuggerObject : public NativeObject
MutableHandleDebuggerObject result);
static MOZ_MUST_USE bool getScriptedProxyHandler(JSContext* cx, HandleDebuggerObject object,
MutableHandleDebuggerObject result);
#ifdef SPIDERMONKEY_PROMISE
static MOZ_MUST_USE bool getPromiseValue(JSContext* cx, HandleDebuggerObject object,
MutableHandleValue result);
#endif // SPIDERMONKEY_PROMISE
// Methods
static MOZ_MUST_USE bool isExtensible(JSContext* cx, HandleDebuggerObject object,
bool& result);