Bug 1468774 - Remove getPropertyDescriptor from CPOWs. r=mrbkap r=mccr8

This commit is contained in:
Tom Schuster
2018-04-03 18:21:40 +02:00
parent b9d0ec13ba
commit 050d853e33
7 changed files with 0 additions and 92 deletions

View File

@@ -614,8 +614,6 @@ description =
description = description =
[PJavaScript::PreventExtensions] [PJavaScript::PreventExtensions]
description = description =
[PJavaScript::GetPropertyDescriptor]
description =
[PJavaScript::GetOwnPropertyDescriptor] [PJavaScript::GetOwnPropertyDescriptor]
description = description =
[PJavaScript::DefineProperty] [PJavaScript::DefineProperty]

View File

@@ -37,15 +37,6 @@ class JavaScriptBase : public WrapperOwner, public WrapperAnswer, public Base
} }
return IPC_OK(); 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, mozilla::ipc::IPCResult RecvGetOwnPropertyDescriptor(const uint64_t& objId,
const JSIDVariant& id, const JSIDVariant& id,
ReturnStatus* rs, ReturnStatus* rs,
@@ -216,11 +207,6 @@ class JavaScriptBase : public WrapperOwner, public WrapperAnswer, public Base
bool SendPreventExtensions(const ObjectId& objId, ReturnStatus* rs) override { bool SendPreventExtensions(const ObjectId& objId, ReturnStatus* rs) override {
return Base::SendPreventExtensions(objId.serialize(), rs); 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, bool SendGetOwnPropertyDescriptor(const ObjectId& objId,
const JSIDVariant& id, const JSIDVariant& id,
ReturnStatus* rs, ReturnStatus* rs,

View File

@@ -25,7 +25,6 @@ both:
// These roughly map to the ProxyHandler hooks that CPOWs need. // 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 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 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 DefineProperty(uint64_t objId, JSIDVariant id, PPropertyDescriptor descriptor) returns (ReturnStatus rs);
nested(inside_sync) sync Delete(uint64_t objId, JSIDVariant id) returns (ReturnStatus rs); nested(inside_sync) sync Delete(uint64_t objId, JSIDVariant id) returns (ReturnStatus rs);

View File

@@ -130,41 +130,6 @@ EmptyDesc(PPropertyDescriptor* desc)
desc->setter() = 0; 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 bool
WrapperAnswer::RecvGetOwnPropertyDescriptor(const ObjectId& objId, const JSIDVariant& idVar, WrapperAnswer::RecvGetOwnPropertyDescriptor(const ObjectId& objId, const JSIDVariant& idVar,
ReturnStatus* rs, PPropertyDescriptor* out) ReturnStatus* rs, PPropertyDescriptor* out)

View File

@@ -22,9 +22,6 @@ class WrapperAnswer : public virtual JavaScriptShared
{ {
public: public:
bool RecvPreventExtensions(const ObjectId& objId, ReturnStatus* rs); bool RecvPreventExtensions(const ObjectId& objId, ReturnStatus* rs);
bool RecvGetPropertyDescriptor(const ObjectId& objId, const JSIDVariant& id,
ReturnStatus* rs,
PPropertyDescriptor* out);
bool RecvGetOwnPropertyDescriptor(const ObjectId& objId, bool RecvGetOwnPropertyDescriptor(const ObjectId& objId,
const JSIDVariant& id, const JSIDVariant& id,
ReturnStatus* rs, ReturnStatus* rs,

View File

@@ -118,8 +118,6 @@ class CPOWProxyHandler : public BaseProxyHandler
virtual bool call(JSContext* cx, HandleObject proxy, const CallArgs& args) const override; 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 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 hasOwn(JSContext* cx, HandleObject proxy, HandleId id, bool* bp) const override;
virtual bool getOwnEnumerablePropertyKeys(JSContext* cx, HandleObject proxy, virtual bool getOwnEnumerablePropertyKeys(JSContext* cx, HandleObject proxy,
AutoIdVector& props) const override; AutoIdVector& props) const override;
@@ -160,36 +158,6 @@ const CPOWProxyHandler CPOWProxyHandler::singleton;
return owner->call args; \ 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 bool
CPOWProxyHandler::getOwnPropertyDescriptor(JSContext* cx, HandleObject proxy, HandleId id, CPOWProxyHandler::getOwnPropertyDescriptor(JSContext* cx, HandleObject proxy, HandleId id,
MutableHandle<PropertyDescriptor> desc) const MutableHandle<PropertyDescriptor> desc) const

View File

@@ -47,8 +47,6 @@ class WrapperOwner : public virtual JavaScriptShared
bool construct); bool construct);
// SpiderMonkey extensions. // 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 hasOwn(JSContext* cx, JS::HandleObject proxy, JS::HandleId id, bool* bp);
bool getOwnEnumerablePropertyKeys(JSContext* cx, JS::HandleObject proxy, bool getOwnEnumerablePropertyKeys(JSContext* cx, JS::HandleObject proxy,
JS::AutoIdVector& props); JS::AutoIdVector& props);
@@ -112,9 +110,6 @@ class WrapperOwner : public virtual JavaScriptShared
public: public:
virtual bool SendDropObject(const ObjectId& objId) = 0; virtual bool SendDropObject(const ObjectId& objId) = 0;
virtual bool SendPreventExtensions(const ObjectId& objId, ReturnStatus* rs) = 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, virtual bool SendGetOwnPropertyDescriptor(const ObjectId& objId,
const JSIDVariant& id, const JSIDVariant& id,
ReturnStatus* rs, ReturnStatus* rs,