From 35523d50ccc79350c72003ae09d2abb82841da29 Mon Sep 17 00:00:00 2001 From: Tom Schuster Date: Fri, 25 Jan 2019 16:41:34 +0000 Subject: [PATCH] Bug 1156077 - Remove the non-standard Proxy getPropertyDescriptor trap. r=bzbarsky,jorendorff I am bit surprised myself, but just removing the getPropertyDescriptor trap seems to mostly work. The only real special case here is the XPC Sandbox, which I changed to keep using its getPropertyDescriptorImpl. testSetPropertyIgnoringNamedGetter.cpp didn't even really need its getPropertyDescriptor implementation. Differential Revision: https://phabricator.services.mozilla.com/D17386 --HG-- extra : moz-landing-system : lando --- dom/base/nsGlobalWindowOuter.cpp | 50 ------------------- js/public/Proxy.h | 16 +++--- js/public/Wrapper.h | 9 ---- js/rust/src/glue.rs | 6 --- js/rust/src/jsglue.cpp | 17 ------- .../testSetPropertyIgnoringNamedGetter.cpp | 40 ++++----------- js/src/proxy/BaseProxyHandler.cpp | 23 --------- js/src/proxy/CrossCompartmentWrapper.cpp | 8 --- js/src/proxy/DeadObjectProxy.h | 4 +- .../proxy/OpaqueCrossCompartmentWrapper.cpp | 6 --- js/src/proxy/Proxy.cpp | 25 ---------- js/src/proxy/Proxy.h | 3 -- js/src/proxy/Wrapper.cpp | 10 ---- js/src/vm/CommonPropertyNames.h | 1 - js/src/vm/EnvironmentObject.cpp | 6 --- js/src/vm/JSObject.cpp | 8 --- js/xpconnect/src/Sandbox.cpp | 19 ++----- js/xpconnect/wrappers/FilteringWrapper.cpp | 13 ----- js/xpconnect/wrappers/FilteringWrapper.h | 3 -- js/xpconnect/wrappers/WaiveXrayWrapper.cpp | 9 ---- js/xpconnect/wrappers/WaiveXrayWrapper.h | 3 -- js/xpconnect/wrappers/XrayWrapper.cpp | 8 --- js/xpconnect/wrappers/XrayWrapper.h | 3 -- 23 files changed, 22 insertions(+), 268 deletions(-) diff --git a/dom/base/nsGlobalWindowOuter.cpp b/dom/base/nsGlobalWindowOuter.cpp index 0cc49b65a21c..f527796f26bf 100644 --- a/dom/base/nsGlobalWindowOuter.cpp +++ b/dom/base/nsGlobalWindowOuter.cpp @@ -457,19 +457,6 @@ class nsOuterWindowProxy : public MaybeCrossOriginObject { JS::ObjectOpResult& result) const override; // SpiderMonkey extensions - /** - * Non-standard method we want to get rid of. - * - * "proxy" is the WindowProxy object involved. It may not be same-compartment - * with cx. - * - * The only reason we implement this is because js::Wrapper does and we want - * different behavior from the js::Wrapper implementation. - */ - bool getPropertyDescriptor( - JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) const override; - /** * Implementation of SpiderMonkey extension which just checks whether this * object has the property. Basically Object.getOwnPropertyDescriptor(obj, @@ -566,43 +553,6 @@ void nsOuterWindowProxy::finalize(JSFreeOp* fop, JSObject* proxy) const { } } -bool nsOuterWindowProxy::getPropertyDescriptor( - JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) const { - // In the same-origin case the only thing we can do differently from - // js::Wrapper is shadow stuff with our indexed properties, so we can just try - // getOwnPropertyDescriptor and if that gives us nothing call on through to - // js::Wrapper. - // - // In the cross-origin case, we can only have own properties, so don't even - // need to worry about the js::Proxy bit. - desc.object().set(nullptr); - if (!getOwnPropertyDescriptor(cx, proxy, id, desc)) { - return false; - } - - if (desc.object()) { - return true; - } - - if (!IsPlatformObjectSameOrigin(cx, proxy)) { - return true; - } - - // When forwarding to js::Wrapper, we should just enter the Realm of proxy - // for now. That's what js::Wrapper expects, and since we're same-origin - // anyway this is not changing any security behavior. - { - JSAutoRealm ar(cx, proxy); - JS_MarkCrossZoneId(cx, id); - if (!js::Wrapper::getPropertyDescriptor(cx, proxy, id, desc)) { - return false; - } - } - - return JS_WrapPropertyDescriptor(cx, desc); -} - /** * IsNonConfigurableReadonlyPrimitiveGlobalProp returns true for * property names that fit the following criteria: diff --git a/js/public/Proxy.h b/js/public/Proxy.h index 2de1e853a473..0f35b9c84afb 100644 --- a/js/public/Proxy.h +++ b/js/public/Proxy.h @@ -184,11 +184,10 @@ class JS_FRIEND_API BaseProxyHandler { * treatment from the JS engine: * * - When mHasPrototype is true, the engine never calls these methods: - * getPropertyDescriptor, has, set, enumerate, iterate. Instead, for - * these operations, it calls the "own" methods like - * getOwnPropertyDescriptor, hasOwn, defineProperty, - * getOwnEnumerablePropertyKeys, etc., and consults the prototype chain - * if needed. + * has, set, enumerate, iterate. Instead, for these operations, + * it calls the "own" methods like getOwnPropertyDescriptor, hasOwn, + * defineProperty, getOwnEnumerablePropertyKeys, etc., + * and consults the prototype chain if needed. * * - When mHasPrototype is true, the engine calls handler->get() only if * handler->hasOwn() says an own property exists on the proxy. If not, @@ -307,7 +306,9 @@ class JS_FRIEND_API BaseProxyHandler { * These standard internal methods are implemented, as a convenience, so * that ProxyHandler subclasses don't have to provide every single method. * - * The base-class implementations work by calling getPropertyDescriptor(). + * The base-class implementations work by calling getOwnPropertyDescriptor() + * and going up the [[Prototype]] chain if necessary. The algorithm for this + * follows what is defined for Ordinary Objects in the ES spec. * They do not follow any standard. When in doubt, override them. */ virtual bool has(JSContext* cx, HandleObject proxy, HandleId id, @@ -337,9 +338,6 @@ class JS_FRIEND_API BaseProxyHandler { /* SpiderMonkey extensions. */ virtual JSObject* enumerate(JSContext* cx, HandleObject proxy) const; - virtual bool getPropertyDescriptor( - JSContext* cx, HandleObject proxy, HandleId id, - MutableHandle desc) const; virtual bool hasOwn(JSContext* cx, HandleObject proxy, HandleId id, bool* bp) const; virtual bool getOwnEnumerablePropertyKeys(JSContext* cx, HandleObject proxy, diff --git a/js/public/Wrapper.h b/js/public/Wrapper.h index b0f0b3b0e858..98074b52afcf 100644 --- a/js/public/Wrapper.h +++ b/js/public/Wrapper.h @@ -83,9 +83,6 @@ class JS_FRIEND_API ForwardingProxyHandler : public BaseProxyHandler { const CallArgs& args) const override; /* SpiderMonkey extensions. */ - virtual bool getPropertyDescriptor( - JSContext* cx, HandleObject proxy, HandleId id, - MutableHandle desc) const override; virtual bool hasOwn(JSContext* cx, HandleObject proxy, HandleId id, bool* bp) const override; virtual bool getOwnEnumerablePropertyKeys(JSContext* cx, HandleObject proxy, @@ -215,9 +212,6 @@ class JS_FRIEND_API CrossCompartmentWrapper : public Wrapper { const CallArgs& args) const override; /* SpiderMonkey extensions. */ - virtual bool getPropertyDescriptor( - JSContext* cx, HandleObject wrapper, HandleId id, - MutableHandle desc) const override; virtual bool hasOwn(JSContext* cx, HandleObject wrapper, HandleId id, bool* bp) const override; virtual bool getOwnEnumerablePropertyKeys(JSContext* cx, HandleObject wrapper, @@ -288,9 +282,6 @@ class JS_FRIEND_API OpaqueCrossCompartmentWrapper const CallArgs& args) const override; /* SpiderMonkey extensions. */ - virtual bool getPropertyDescriptor( - JSContext* cx, HandleObject wrapper, HandleId id, - MutableHandle desc) const override; virtual bool hasOwn(JSContext* cx, HandleObject wrapper, HandleId id, bool* bp) const override; virtual bool getOwnEnumerablePropertyKeys(JSContext* cx, HandleObject wrapper, diff --git a/js/rust/src/glue.rs b/js/rust/src/glue.rs index 8a9cc451484d..9b6f6a95b1bb 100644 --- a/js/rust/src/glue.rs +++ b/js/rust/src/glue.rs @@ -82,12 +82,6 @@ pub struct ProxyTraps { proxy: JS::HandleObject, args: *const JS::CallArgs) -> bool>, - pub getPropertyDescriptor: - ::std::option::Option) - -> bool>, pub hasOwn: ::std::option::Option desc); bool (*hasOwn)(JSContext* cx, JS::HandleObject proxy, JS::HandleId id, bool* bp); bool (*getOwnEnumerablePropertyKeys)(JSContext* cx, JS::HandleObject proxy, @@ -267,14 +264,6 @@ class WrapperProxyHandler : public js::Wrapper { ? mTraps.isExtensible(cx, proxy, succeeded) : js::Wrapper::isExtensible(cx, proxy, succeeded); } - - virtual bool getPropertyDescriptor( - JSContext* cx, JS::HandleObject proxy, JS::HandleId id, - JS::MutableHandle desc) const override { - return mTraps.getPropertyDescriptor - ? mTraps.getPropertyDescriptor(cx, proxy, id, desc) - : js::Wrapper::getPropertyDescriptor(cx, proxy, id, desc); - } }; class RustJSPrincipal : public JSPrincipals { @@ -356,12 +345,6 @@ class ForwardingProxyHandler : public js::BaseProxyHandler { bool* succeeded) const override { return mTraps.isExtensible(cx, proxy, succeeded); } - - virtual bool getPropertyDescriptor( - JSContext* cx, JS::HandleObject proxy, JS::HandleId id, - JS::MutableHandle desc) const override { - return mTraps.getPropertyDescriptor(cx, proxy, id, desc); - } }; extern "C" { diff --git a/js/src/jsapi-tests/testSetPropertyIgnoringNamedGetter.cpp b/js/src/jsapi-tests/testSetPropertyIgnoringNamedGetter.cpp index 946a16d87456..8f098bae8ec8 100644 --- a/js/src/jsapi-tests/testSetPropertyIgnoringNamedGetter.cpp +++ b/js/src/jsapi-tests/testSetPropertyIgnoringNamedGetter.cpp @@ -15,49 +15,29 @@ class CustomProxyHandler : public Wrapper { public: CustomProxyHandler() : Wrapper(0) {} - bool getPropertyDescriptor( - JSContext* cx, HandleObject proxy, HandleId id, - MutableHandle desc) const override { - return impl(cx, proxy, id, desc, false); - } - bool getOwnPropertyDescriptor( JSContext* cx, HandleObject proxy, HandleId id, MutableHandle desc) const override { - return impl(cx, proxy, id, desc, true); + if (JSID_IS_STRING(id) && + JS_FlatStringEqualsAscii(JSID_TO_FLAT_STRING(id), "phantom")) { + desc.object().set(proxy); + desc.attributesRef() = JSPROP_ENUMERATE; + desc.value().setInt32(42); + return true; + } + + return Wrapper::getOwnPropertyDescriptor(cx, proxy, id, desc); } bool set(JSContext* cx, HandleObject proxy, HandleId id, HandleValue v, HandleValue receiver, ObjectOpResult& result) const override { Rooted desc(cx); - if (!Wrapper::getPropertyDescriptor(cx, proxy, id, &desc)) { + if (!Wrapper::getOwnPropertyDescriptor(cx, proxy, id, &desc)) { return false; } return SetPropertyIgnoringNamedGetter(cx, proxy, id, v, receiver, desc, result); } - - private: - bool impl(JSContext* cx, HandleObject proxy, HandleId id, - MutableHandle desc, bool ownOnly) const { - if (JSID_IS_STRING(id)) { - bool match; - if (!JS_StringEqualsAscii(cx, JSID_TO_STRING(id), "phantom", &match)) { - return false; - } - if (match) { - desc.object().set(proxy); - desc.attributesRef() = JSPROP_ENUMERATE; - desc.value().setInt32(42); - return true; - } - } - - if (ownOnly) { - return Wrapper::getOwnPropertyDescriptor(cx, proxy, id, desc); - } - return Wrapper::getPropertyDescriptor(cx, proxy, id, desc); - } }; const CustomProxyHandler customProxyHandler; diff --git a/js/src/proxy/BaseProxyHandler.cpp b/js/src/proxy/BaseProxyHandler.cpp index 6b0e112c5e8e..fa79470bd4c9 100644 --- a/js/src/proxy/BaseProxyHandler.cpp +++ b/js/src/proxy/BaseProxyHandler.cpp @@ -56,29 +56,6 @@ bool BaseProxyHandler::has(JSContext* cx, HandleObject proxy, HandleId id, return true; } -bool BaseProxyHandler::getPropertyDescriptor( - JSContext* cx, HandleObject proxy, HandleId id, - MutableHandle desc) const { - assertEnteredPolicy(cx, proxy, id, GET | SET | GET_PROPERTY_DESCRIPTOR); - - if (!getOwnPropertyDescriptor(cx, proxy, id, desc)) { - return false; - } - if (desc.object()) { - return true; - } - - RootedObject proto(cx); - if (!GetPrototype(cx, proxy, &proto)) { - return false; - } - if (!proto) { - MOZ_ASSERT(!desc.object()); - return true; - } - return GetPropertyDescriptor(cx, proto, id, desc); -} - bool BaseProxyHandler::hasOwn(JSContext* cx, HandleObject proxy, HandleId id, bool* bp) const { assertEnteredPolicy(cx, proxy, id, GET); diff --git a/js/src/proxy/CrossCompartmentWrapper.cpp b/js/src/proxy/CrossCompartmentWrapper.cpp index d68337e64519..31fe4fef0e81 100644 --- a/js/src/proxy/CrossCompartmentWrapper.cpp +++ b/js/src/proxy/CrossCompartmentWrapper.cpp @@ -43,14 +43,6 @@ static bool MarkAtoms(JSContext* cx, const AutoIdVector& ids) { return true; } -bool CrossCompartmentWrapper::getPropertyDescriptor( - JSContext* cx, HandleObject wrapper, HandleId id, - MutableHandle desc) const { - PIERCE(cx, wrapper, MarkAtoms(cx, id), - Wrapper::getPropertyDescriptor(cx, wrapper, id, desc), - cx->compartment()->wrap(cx, desc)); -} - bool CrossCompartmentWrapper::getOwnPropertyDescriptor( JSContext* cx, HandleObject wrapper, HandleId id, MutableHandle desc) const { diff --git a/js/src/proxy/DeadObjectProxy.h b/js/src/proxy/DeadObjectProxy.h index 3a0932b54c64..23a96ab9db31 100644 --- a/js/src/proxy/DeadObjectProxy.h +++ b/js/src/proxy/DeadObjectProxy.h @@ -49,9 +49,7 @@ class DeadObjectProxy : public BaseProxyHandler { const CallArgs& args) const override; /* SpiderMonkey extensions. */ - // BaseProxyHandler::getPropertyDescriptor will throw by calling - // getOwnPropertyDescriptor. BaseProxyHandler::enumerate will throw by calling - // ownKeys. + // BaseProxyHandler::enumerate will throw by calling ownKeys. virtual bool nativeCall(JSContext* cx, IsAcceptableThis test, NativeImpl impl, const CallArgs& args) const override; virtual bool hasInstance(JSContext* cx, HandleObject proxy, diff --git a/js/src/proxy/OpaqueCrossCompartmentWrapper.cpp b/js/src/proxy/OpaqueCrossCompartmentWrapper.cpp index 4ffecc030fed..0769086871c4 100644 --- a/js/src/proxy/OpaqueCrossCompartmentWrapper.cpp +++ b/js/src/proxy/OpaqueCrossCompartmentWrapper.cpp @@ -111,12 +111,6 @@ bool OpaqueCrossCompartmentWrapper::construct(JSContext* cx, return false; } -bool OpaqueCrossCompartmentWrapper::getPropertyDescriptor( - JSContext* cx, HandleObject wrapper, HandleId id, - MutableHandle desc) const { - return BaseProxyHandler::getPropertyDescriptor(cx, wrapper, id, desc); -} - bool OpaqueCrossCompartmentWrapper::hasOwn(JSContext* cx, HandleObject wrapper, HandleId id, bool* bp) const { return BaseProxyHandler::hasOwn(cx, wrapper, id, bp); diff --git a/js/src/proxy/Proxy.cpp b/js/src/proxy/Proxy.cpp index 6e081032e537..ffcfb3740aaf 100644 --- a/js/src/proxy/Proxy.cpp +++ b/js/src/proxy/Proxy.cpp @@ -73,31 +73,6 @@ JS_FRIEND_API void js::assertEnteredPolicy(JSContext* cx, JSObject* proxy, } #endif -bool Proxy::getPropertyDescriptor(JSContext* cx, HandleObject proxy, - HandleId id, - MutableHandle desc) { - if (!CheckRecursionLimit(cx)) { - return false; - } - - const BaseProxyHandler* handler = proxy->as().handler(); - desc.object().set( - nullptr); // default result if we refuse to perform this action - AutoEnterPolicy policy(cx, handler, proxy, id, - BaseProxyHandler::GET_PROPERTY_DESCRIPTOR, true); - if (!policy.allowed()) { - return policy.returnValue(); - } - - // Special case. See the comment on BaseProxyHandler::mHasPrototype. - if (handler->hasPrototype()) { - return handler->BaseProxyHandler::getPropertyDescriptor(cx, proxy, id, - desc); - } - - return handler->getPropertyDescriptor(cx, proxy, id, desc); -} - bool Proxy::getOwnPropertyDescriptor(JSContext* cx, HandleObject proxy, HandleId id, MutableHandle desc) { diff --git a/js/src/proxy/Proxy.h b/js/src/proxy/Proxy.h index ffac05aa9d56..8348b44786a9 100644 --- a/js/src/proxy/Proxy.h +++ b/js/src/proxy/Proxy.h @@ -65,9 +65,6 @@ class Proxy { const CallArgs& args); /* SpiderMonkey extensions. */ - static bool getPropertyDescriptor(JSContext* cx, HandleObject proxy, - HandleId id, - MutableHandle desc); static bool hasOwn(JSContext* cx, HandleObject proxy, HandleId id, bool* bp); static bool getOwnEnumerablePropertyKeys(JSContext* cx, HandleObject proxy, AutoIdVector& props); diff --git a/js/src/proxy/Wrapper.cpp b/js/src/proxy/Wrapper.cpp index 3ce79d1ad6dc..c54f0f0b347f 100644 --- a/js/src/proxy/Wrapper.cpp +++ b/js/src/proxy/Wrapper.cpp @@ -187,16 +187,6 @@ bool ForwardingProxyHandler::construct(JSContext* cx, HandleObject proxy, return true; } -bool ForwardingProxyHandler::getPropertyDescriptor( - JSContext* cx, HandleObject proxy, HandleId id, - MutableHandle desc) const { - assertEnteredPolicy(cx, proxy, id, GET | SET | GET_PROPERTY_DESCRIPTOR); - MOZ_ASSERT( - !hasPrototype()); // Should never be called if there's a prototype. - RootedObject target(cx, proxy->as().target()); - return GetPropertyDescriptor(cx, target, id, desc); -} - bool ForwardingProxyHandler::hasOwn(JSContext* cx, HandleObject proxy, HandleId id, bool* bp) const { assertEnteredPolicy(cx, proxy, id, GET); diff --git a/js/src/vm/CommonPropertyNames.h b/js/src/vm/CommonPropertyNames.h index 970c7757344a..d4786f218ae1 100644 --- a/js/src/vm/CommonPropertyNames.h +++ b/js/src/vm/CommonPropertyNames.h @@ -171,7 +171,6 @@ "getOwnPropertyDescriptor") \ MACRO(getOwnPropertyNames, getOwnPropertyNames, "getOwnPropertyNames") \ MACRO(getPrefix, getPrefix, "get ") \ - MACRO(getPropertyDescriptor, getPropertyDescriptor, "getPropertyDescriptor") \ MACRO(getPropertySuper, getPropertySuper, "getPropertySuper") \ MACRO(getPrototypeOf, getPrototypeOf, "getPrototypeOf") \ MACRO(GetTypeError, GetTypeError, "GetTypeError") \ diff --git a/js/src/vm/EnvironmentObject.cpp b/js/src/vm/EnvironmentObject.cpp index 6cb1c9f0eac7..db56c6db4881 100644 --- a/js/src/vm/EnvironmentObject.cpp +++ b/js/src/vm/EnvironmentObject.cpp @@ -1947,12 +1947,6 @@ class DebugEnvironmentProxyHandler : public BaseProxyHandler { return true; } - bool getPropertyDescriptor( - JSContext* cx, HandleObject proxy, HandleId id, - MutableHandle desc) const override { - return getOwnPropertyDescriptor(cx, proxy, id, desc); - } - bool getMissingArgumentsPropertyDescriptor( JSContext* cx, Handle debugEnv, EnvironmentObject& env, MutableHandle desc) const { diff --git a/js/src/vm/JSObject.cpp b/js/src/vm/JSObject.cpp index f7d888a0bdbc..9c4efac23d9f 100644 --- a/js/src/vm/JSObject.cpp +++ b/js/src/vm/JSObject.cpp @@ -3046,14 +3046,6 @@ bool js::GetPropertyDescriptor(JSContext* cx, HandleObject obj, HandleId id, RootedObject pobj(cx); for (pobj = obj; pobj;) { - if (pobj->is()) { - bool ok = Proxy::getPropertyDescriptor(cx, pobj, id, desc); - if (ok) { - desc.assertCompleteIfFound(); - } - return ok; - } - if (!GetOwnPropertyDescriptor(cx, pobj, id, desc)) { return false; } diff --git a/js/xpconnect/src/Sandbox.cpp b/js/xpconnect/src/Sandbox.cpp index c056b6a586d4..647fdb609924 100644 --- a/js/xpconnect/src/Sandbox.cpp +++ b/js/xpconnect/src/Sandbox.cpp @@ -507,9 +507,6 @@ class SandboxProxyHandler : public js::Wrapper { JS::Handle receiver, JS::ObjectOpResult& result) const override; - virtual bool getPropertyDescriptor( - JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) const override; virtual bool hasOwn(JSContext* cx, JS::Handle proxy, JS::Handle id, bool* bp) const override; virtual bool getOwnEnumerablePropertyKeys( @@ -723,12 +720,6 @@ bool SandboxProxyHandler::getPropertyDescriptorImpl( return true; } -bool SandboxProxyHandler::getPropertyDescriptor( - JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) const { - return getPropertyDescriptorImpl(cx, proxy, id, /* getOwn = */ false, desc); -} - bool SandboxProxyHandler::getOwnPropertyDescriptor( JSContext* cx, JS::Handle proxy, JS::Handle id, JS::MutableHandle desc) const { @@ -742,10 +733,9 @@ bool SandboxProxyHandler::getOwnPropertyDescriptor( bool SandboxProxyHandler::has(JSContext* cx, JS::Handle proxy, JS::Handle id, bool* bp) const { - // This uses getPropertyDescriptor for backward compatibility with - // the old BaseProxyHandler::has implementation. + // This uses JS_GetPropertyDescriptorById for backward compatibility. Rooted desc(cx); - if (!getPropertyDescriptor(cx, proxy, id, &desc)) { + if (!getPropertyDescriptorImpl(cx, proxy, id, /* getOwn = */ false, &desc)) { return false; } @@ -761,10 +751,9 @@ bool SandboxProxyHandler::get(JSContext* cx, JS::Handle proxy, JS::Handle receiver, JS::Handle id, JS::MutableHandle vp) const { - // This uses getPropertyDescriptor for backward compatibility with - // the old BaseProxyHandler::get implementation. + // This uses JS_GetPropertyDescriptorById for backward compatibility. Rooted desc(cx); - if (!getPropertyDescriptor(cx, proxy, id, &desc)) { + if (!getPropertyDescriptorImpl(cx, proxy, id, /* getOwn = */ false, &desc)) { return false; } desc.assertCompleteIfFound(); diff --git a/js/xpconnect/wrappers/FilteringWrapper.cpp b/js/xpconnect/wrappers/FilteringWrapper.cpp index 2e261b620f59..4f082760b453 100644 --- a/js/xpconnect/wrappers/FilteringWrapper.cpp +++ b/js/xpconnect/wrappers/FilteringWrapper.cpp @@ -132,19 +132,6 @@ static bool FilterPropertyDescriptor(JSContext* cx, HandleObject wrapper, return true; } -template -bool FilteringWrapper::getPropertyDescriptor( - JSContext* cx, HandleObject wrapper, HandleId id, - MutableHandle desc) const { - assertEnteredPolicy(cx, wrapper, id, - BaseProxyHandler::GET | BaseProxyHandler::SET | - BaseProxyHandler::GET_PROPERTY_DESCRIPTOR); - if (!Base::getPropertyDescriptor(cx, wrapper, id, desc)) { - return false; - } - return FilterPropertyDescriptor(cx, wrapper, id, desc); -} - template bool FilteringWrapper::getOwnPropertyDescriptor( JSContext* cx, HandleObject wrapper, HandleId id, diff --git a/js/xpconnect/wrappers/FilteringWrapper.h b/js/xpconnect/wrappers/FilteringWrapper.h index bfa3ee31d763..a19785947ddf 100644 --- a/js/xpconnect/wrappers/FilteringWrapper.h +++ b/js/xpconnect/wrappers/FilteringWrapper.h @@ -29,9 +29,6 @@ class FilteringWrapper : public Base { virtual bool ownPropertyKeys(JSContext* cx, JS::Handle wrapper, JS::AutoIdVector& props) const override; - virtual bool getPropertyDescriptor( - JSContext* cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) const override; virtual bool getOwnEnumerablePropertyKeys( JSContext* cx, JS::Handle wrapper, JS::AutoIdVector& props) const override; diff --git a/js/xpconnect/wrappers/WaiveXrayWrapper.cpp b/js/xpconnect/wrappers/WaiveXrayWrapper.cpp index 22f2f36ce35f..d93d0f8e4805 100644 --- a/js/xpconnect/wrappers/WaiveXrayWrapper.cpp +++ b/js/xpconnect/wrappers/WaiveXrayWrapper.cpp @@ -32,15 +32,6 @@ static bool WaiveAccessors(JSContext* cx, return true; } -bool WaiveXrayWrapper::getPropertyDescriptor( - JSContext* cx, HandleObject wrapper, HandleId id, - MutableHandle desc) const { - return CrossCompartmentWrapper::getPropertyDescriptor(cx, wrapper, id, - desc) && - WrapperFactory::WaiveXrayAndWrap(cx, desc.value()) && - WaiveAccessors(cx, desc); -} - bool WaiveXrayWrapper::getOwnPropertyDescriptor( JSContext* cx, HandleObject wrapper, HandleId id, MutableHandle desc) const { diff --git a/js/xpconnect/wrappers/WaiveXrayWrapper.h b/js/xpconnect/wrappers/WaiveXrayWrapper.h index fcadfa2b2de5..a6a989e953cf 100644 --- a/js/xpconnect/wrappers/WaiveXrayWrapper.h +++ b/js/xpconnect/wrappers/WaiveXrayWrapper.h @@ -41,9 +41,6 @@ class WaiveXrayWrapper : public js::CrossCompartmentWrapper { const JS::CallArgs& args) const override; virtual bool hasInstance(JSContext* cx, JS::HandleObject wrapper, JS::MutableHandleValue v, bool* bp) const override; - virtual bool getPropertyDescriptor( - JSContext* cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) const override; static const WaiveXrayWrapper singleton; }; diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index b704fcdeae9c..c35cd051946f 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -1870,14 +1870,6 @@ bool XrayWrapper::isExtensible(JSContext* cx, return true; } -template -bool XrayWrapper::getPropertyDescriptor( - JSContext* cx, HandleObject wrapper, HandleId id, - JS::MutableHandle desc) const { - MOZ_CRASH("Shouldn't be called: we return true for hasPrototype()"); - return false; -} - template bool XrayWrapper::getOwnPropertyDescriptor( JSContext* cx, HandleObject wrapper, HandleId id, diff --git a/js/xpconnect/wrappers/XrayWrapper.h b/js/xpconnect/wrappers/XrayWrapper.h index b4a430b4bab2..19fa08a6e6a8 100644 --- a/js/xpconnect/wrappers/XrayWrapper.h +++ b/js/xpconnect/wrappers/XrayWrapper.h @@ -421,9 +421,6 @@ class XrayWrapper : public Base { const JS::CallArgs& args) const override; /* SpiderMonkey extensions. */ - virtual bool getPropertyDescriptor( - JSContext* cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) const override; virtual bool hasOwn(JSContext* cx, JS::Handle wrapper, JS::Handle id, bool* bp) const override; virtual bool getOwnEnumerablePropertyKeys(