Bug 1468774 - Remove getPropertyDescriptor from CPOWs. r=mrbkap r=mccr8
This commit is contained in:
@@ -614,8 +614,6 @@ description =
|
||||
description =
|
||||
[PJavaScript::PreventExtensions]
|
||||
description =
|
||||
[PJavaScript::GetPropertyDescriptor]
|
||||
description =
|
||||
[PJavaScript::GetOwnPropertyDescriptor]
|
||||
description =
|
||||
[PJavaScript::DefineProperty]
|
||||
|
||||
@@ -37,15 +37,6 @@ class JavaScriptBase : public WrapperOwner, public WrapperAnswer, public Base
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
mozilla::ipc::IPCResult RecvGetPropertyDescriptor(const uint64_t& objId, const JSIDVariant& id,
|
||||
ReturnStatus* rs,
|
||||
PPropertyDescriptor* out) override {
|
||||
Maybe<ObjectId> obj(ObjectId::deserialize(objId));
|
||||
if (obj.isNothing() || !Answer::RecvGetPropertyDescriptor(obj.value(), id, rs, out)) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
mozilla::ipc::IPCResult RecvGetOwnPropertyDescriptor(const uint64_t& objId,
|
||||
const JSIDVariant& id,
|
||||
ReturnStatus* rs,
|
||||
@@ -216,11 +207,6 @@ class JavaScriptBase : public WrapperOwner, public WrapperAnswer, public Base
|
||||
bool SendPreventExtensions(const ObjectId& objId, ReturnStatus* rs) override {
|
||||
return Base::SendPreventExtensions(objId.serialize(), rs);
|
||||
}
|
||||
bool SendGetPropertyDescriptor(const ObjectId& objId, const JSIDVariant& id,
|
||||
ReturnStatus* rs,
|
||||
PPropertyDescriptor* out) override {
|
||||
return Base::SendGetPropertyDescriptor(objId.serialize(), id, rs, out);
|
||||
}
|
||||
bool SendGetOwnPropertyDescriptor(const ObjectId& objId,
|
||||
const JSIDVariant& id,
|
||||
ReturnStatus* rs,
|
||||
|
||||
@@ -25,7 +25,6 @@ both:
|
||||
|
||||
// These roughly map to the ProxyHandler hooks that CPOWs need.
|
||||
nested(inside_sync) sync PreventExtensions(uint64_t objId) returns (ReturnStatus rs);
|
||||
nested(inside_sync) sync GetPropertyDescriptor(uint64_t objId, JSIDVariant id) returns (ReturnStatus rs, PPropertyDescriptor result);
|
||||
nested(inside_sync) sync GetOwnPropertyDescriptor(uint64_t objId, JSIDVariant id) returns (ReturnStatus rs, PPropertyDescriptor result);
|
||||
nested(inside_sync) sync DefineProperty(uint64_t objId, JSIDVariant id, PPropertyDescriptor descriptor) returns (ReturnStatus rs);
|
||||
nested(inside_sync) sync Delete(uint64_t objId, JSIDVariant id) returns (ReturnStatus rs);
|
||||
|
||||
@@ -130,41 +130,6 @@ EmptyDesc(PPropertyDescriptor* desc)
|
||||
desc->setter() = 0;
|
||||
}
|
||||
|
||||
bool
|
||||
WrapperAnswer::RecvGetPropertyDescriptor(const ObjectId& objId, const JSIDVariant& idVar,
|
||||
ReturnStatus* rs, PPropertyDescriptor* out)
|
||||
{
|
||||
if (!IsInAutomation())
|
||||
return false;
|
||||
|
||||
MaybeForceDebugGC();
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
if (NS_WARN_IF(!jsapi.Init(scopeForTargetObjects())))
|
||||
return false;
|
||||
JSContext* cx = jsapi.cx();
|
||||
EmptyDesc(out);
|
||||
|
||||
RootedObject obj(cx, findObjectById(cx, objId));
|
||||
if (!obj)
|
||||
return deadCPOW(jsapi, rs);
|
||||
|
||||
LOG("%s.getPropertyDescriptor(%s)", ReceiverObj(objId), Identifier(idVar));
|
||||
|
||||
RootedId id(cx);
|
||||
if (!fromJSIDVariant(cx, idVar, &id))
|
||||
return fail(jsapi, rs);
|
||||
|
||||
Rooted<PropertyDescriptor> desc(cx);
|
||||
if (!JS_GetPropertyDescriptorById(cx, obj, id, &desc))
|
||||
return fail(jsapi, rs);
|
||||
|
||||
if (!fromDescriptor(cx, desc, out))
|
||||
return fail(jsapi, rs);
|
||||
|
||||
return ok(rs);
|
||||
}
|
||||
|
||||
bool
|
||||
WrapperAnswer::RecvGetOwnPropertyDescriptor(const ObjectId& objId, const JSIDVariant& idVar,
|
||||
ReturnStatus* rs, PPropertyDescriptor* out)
|
||||
|
||||
@@ -22,9 +22,6 @@ class WrapperAnswer : public virtual JavaScriptShared
|
||||
{
|
||||
public:
|
||||
bool RecvPreventExtensions(const ObjectId& objId, ReturnStatus* rs);
|
||||
bool RecvGetPropertyDescriptor(const ObjectId& objId, const JSIDVariant& id,
|
||||
ReturnStatus* rs,
|
||||
PPropertyDescriptor* out);
|
||||
bool RecvGetOwnPropertyDescriptor(const ObjectId& objId,
|
||||
const JSIDVariant& id,
|
||||
ReturnStatus* rs,
|
||||
|
||||
@@ -118,8 +118,6 @@ class CPOWProxyHandler : public BaseProxyHandler
|
||||
virtual bool call(JSContext* cx, HandleObject proxy, const CallArgs& args) const override;
|
||||
virtual bool construct(JSContext* cx, HandleObject proxy, const CallArgs& args) const override;
|
||||
|
||||
virtual bool getPropertyDescriptor(JSContext* cx, HandleObject proxy, HandleId id,
|
||||
MutableHandle<PropertyDescriptor> desc) const override;
|
||||
virtual bool hasOwn(JSContext* cx, HandleObject proxy, HandleId id, bool* bp) const override;
|
||||
virtual bool getOwnEnumerablePropertyKeys(JSContext* cx, HandleObject proxy,
|
||||
AutoIdVector& props) const override;
|
||||
@@ -160,36 +158,6 @@ const CPOWProxyHandler CPOWProxyHandler::singleton;
|
||||
return owner->call args; \
|
||||
}
|
||||
|
||||
bool
|
||||
CPOWProxyHandler::getPropertyDescriptor(JSContext* cx, HandleObject proxy, HandleId id,
|
||||
MutableHandle<PropertyDescriptor> desc) const
|
||||
{
|
||||
FORWARD(getPropertyDescriptor, (cx, proxy, id, desc), false);
|
||||
}
|
||||
|
||||
bool
|
||||
WrapperOwner::getPropertyDescriptor(JSContext* cx, HandleObject proxy, HandleId id,
|
||||
MutableHandle<PropertyDescriptor> desc)
|
||||
{
|
||||
ObjectId objId = idOf(proxy);
|
||||
|
||||
JSIDVariant idVar;
|
||||
if (!toJSIDVariant(cx, id, &idVar))
|
||||
return false;
|
||||
|
||||
ReturnStatus status;
|
||||
PPropertyDescriptor result;
|
||||
if (!SendGetPropertyDescriptor(objId, idVar, &status, &result))
|
||||
return ipcfail(cx);
|
||||
|
||||
LOG_STACK();
|
||||
|
||||
if (!ok(cx, status))
|
||||
return false;
|
||||
|
||||
return toDescriptor(cx, result, desc);
|
||||
}
|
||||
|
||||
bool
|
||||
CPOWProxyHandler::getOwnPropertyDescriptor(JSContext* cx, HandleObject proxy, HandleId id,
|
||||
MutableHandle<PropertyDescriptor> desc) const
|
||||
|
||||
@@ -47,8 +47,6 @@ class WrapperOwner : public virtual JavaScriptShared
|
||||
bool construct);
|
||||
|
||||
// SpiderMonkey extensions.
|
||||
bool getPropertyDescriptor(JSContext* cx, JS::HandleObject proxy, JS::HandleId id,
|
||||
JS::MutableHandle<JS::PropertyDescriptor> desc);
|
||||
bool hasOwn(JSContext* cx, JS::HandleObject proxy, JS::HandleId id, bool* bp);
|
||||
bool getOwnEnumerablePropertyKeys(JSContext* cx, JS::HandleObject proxy,
|
||||
JS::AutoIdVector& props);
|
||||
@@ -112,9 +110,6 @@ class WrapperOwner : public virtual JavaScriptShared
|
||||
public:
|
||||
virtual bool SendDropObject(const ObjectId& objId) = 0;
|
||||
virtual bool SendPreventExtensions(const ObjectId& objId, ReturnStatus* rs) = 0;
|
||||
virtual bool SendGetPropertyDescriptor(const ObjectId& objId, const JSIDVariant& id,
|
||||
ReturnStatus* rs,
|
||||
PPropertyDescriptor* out) = 0;
|
||||
virtual bool SendGetOwnPropertyDescriptor(const ObjectId& objId,
|
||||
const JSIDVariant& id,
|
||||
ReturnStatus* rs,
|
||||
|
||||
Reference in New Issue
Block a user