--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -637,18 +637,18 @@ public:
// SpiderMonkey extensions
virtual bool getPropertyDescriptor(JSContext* cx,
JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc)
const MOZ_OVERRIDE;
virtual bool hasOwn(JSContext *cx, JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id, bool *bp) const MOZ_OVERRIDE;
- virtual bool keys(JSContext *cx, JS::Handle<JSObject*> proxy,
- JS::AutoIdVector &props) const MOZ_OVERRIDE;
+ virtual bool getOwnEnumerablePropertyKeys(JSContext *cx, JS::Handle<JSObject*> proxy,
+ JS::AutoIdVector &props) const MOZ_OVERRIDE;
virtual bool iterate(JSContext *cx, JS::Handle<JSObject*> proxy,
unsigned flags,
JS::MutableHandle<JS::Value> vp) const MOZ_OVERRIDE;
virtual const char *className(JSContext *cx,
JS::Handle<JSObject*> wrapper) const MOZ_OVERRIDE;
virtual void finalize(JSFreeOp *fop, JSObject *proxy) const MOZ_OVERRIDE;
@@ -926,22 +926,22 @@ nsOuterWindowProxy::set(JSContext *cx, J
}
return true;
}
return js::Wrapper::set(cx, proxy, receiver, id, strict, vp);
}
bool
-nsOuterWindowProxy::keys(JSContext *cx, JS::Handle<JSObject*> proxy,
- JS::AutoIdVector &props) const
+nsOuterWindowProxy::getOwnEnumerablePropertyKeys(JSContext *cx, JS::Handle<JSObject*> proxy,
+ JS::AutoIdVector &props) const
{
// BaseProxyHandler::keys seems to do what we want here: call
// ownPropertyKeys and then filter out the non-enumerable properties.
- return js::BaseProxyHandler::keys(cx, proxy, props);
+ return js::BaseProxyHandler::getOwnEnumerablePropertyKeys(cx, proxy, props);
}
bool
nsOuterWindowProxy::iterate(JSContext *cx, JS::Handle<JSObject*> proxy,
unsigned flags, JS::MutableHandle<JS::Value> vp) const
{
// BaseProxyHandler::iterate seems to do what we want here: fall
// back on the property names returned from keys() and enumerate().
--- a/dom/bindings/DOMJSProxyHandler.cpp
+++ b/dom/bindings/DOMJSProxyHandler.cpp
@@ -272,17 +272,17 @@ DOMProxyHandler::delete_(JSContext* cx,
bool
BaseDOMProxyHandler::enumerate(JSContext* cx, JS::Handle<JSObject*> proxy,
AutoIdVector& props) const
{
JS::Rooted<JSObject*> proto(cx);
if (!JS_GetPrototype(cx, proxy, &proto)) {
return false;
}
- return keys(cx, proxy, props) &&
+ return getOwnEnumerablePropertyKeys(cx, proxy, props) &&
(!proto || js::GetPropertyKeys(cx, proto, 0, &props));
}
bool
BaseDOMProxyHandler::watch(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id,
JS::Handle<JSObject*> callable) const
{
return js::WatchGuts(cx, proxy, id, callable);
@@ -298,19 +298,19 @@ bool
BaseDOMProxyHandler::ownPropertyKeys(JSContext* cx,
JS::Handle<JSObject*> proxy,
JS::AutoIdVector& props) const
{
return ownPropNames(cx, proxy, JSITER_OWNONLY | JSITER_HIDDEN, props);
}
bool
-BaseDOMProxyHandler::keys(JSContext* cx,
- JS::Handle<JSObject*> proxy,
- JS::AutoIdVector& props) const
+BaseDOMProxyHandler::getOwnEnumerablePropertyKeys(JSContext* cx,
+ JS::Handle<JSObject*> proxy,
+ JS::AutoIdVector& props) const
{
return ownPropNames(cx, proxy, JSITER_OWNONLY, props);
}
bool
DOMProxyHandler::has(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, bool* bp) const
{
if (!hasOwn(cx, proxy, id, bp)) {
--- a/dom/bindings/DOMJSProxyHandler.h
+++ b/dom/bindings/DOMJSProxyHandler.h
@@ -59,22 +59,23 @@ public:
JS::AutoIdVector &props) const MOZ_OVERRIDE;
bool enumerate(JSContext* cx, JS::Handle<JSObject*> proxy,
JS::AutoIdVector& props) const MOZ_OVERRIDE;
bool getPropertyDescriptor(JSContext* cx, JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
- // We override keys() and implement it directly instead of using the
- // default implementation, which would getOwnPropertyNames and then
- // filter out the non-enumerable ones. This avoids doing
+
+ // We override getOwnEnumerablePropertyKeys() and implement it directly
+ // instead of using the default implementation, which would call
+ // ownPropertyKeys and then filter out the non-enumerable ones. This avoids
// unnecessary work during enumeration.
- virtual bool keys(JSContext* cx, JS::Handle<JSObject*> proxy,
- JS::AutoIdVector &props) const MOZ_OVERRIDE;
+ virtual bool getOwnEnumerablePropertyKeys(JSContext* cx, JS::Handle<JSObject*> proxy,
+ JS::AutoIdVector &props) const MOZ_OVERRIDE;
bool watch(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id,
JS::Handle<JSObject*> callable) const MOZ_OVERRIDE;
bool unwatch(JSContext* cx, JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id) const MOZ_OVERRIDE;
protected:
// Hook for subclasses to implement shared ownPropertyKeys()/keys()
--- a/js/ipc/WrapperOwner.cpp
+++ b/js/ipc/WrapperOwner.cpp
@@ -79,17 +79,18 @@ class CPOWProxyHandler : public BaseProx
virtual bool set(JSContext *cx, JS::HandleObject proxy, JS::HandleObject receiver,
JS::HandleId id, bool strict, JS::MutableHandleValue vp) const MOZ_OVERRIDE;
virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE;
virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE;
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE;
- virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE;
+ virtual bool getOwnEnumerablePropertyKeys(JSContext *cx, HandleObject proxy,
+ AutoIdVector &props) const MOZ_OVERRIDE;
virtual bool hasInstance(JSContext *cx, HandleObject proxy,
MutableHandleValue v, bool *bp) const MOZ_OVERRIDE;
virtual bool objectClassIs(HandleObject obj, js::ESClassValue classValue,
JSContext *cx) const MOZ_OVERRIDE;
virtual const char* className(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE;
virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const MOZ_OVERRIDE;
virtual void finalize(JSFreeOp *fop, JSObject *proxy) const MOZ_OVERRIDE;
virtual void objectMoved(JSObject *proxy, const JSObject *old) const MOZ_OVERRIDE;
@@ -457,23 +458,24 @@ WrapperOwner::set(JSContext *cx, JS::Han
if (!ok(cx, status))
return false;
return fromVariant(cx, result, vp);
}
bool
-CPOWProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const
+CPOWProxyHandler::getOwnEnumerablePropertyKeys(JSContext *cx, HandleObject proxy,
+ AutoIdVector &props) const
{
- FORWARD(keys, (cx, proxy, props));
+ FORWARD(getOwnEnumerablePropertyKeys, (cx, proxy, props));
}
bool
-WrapperOwner::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props)
+WrapperOwner::getOwnEnumerablePropertyKeys(JSContext *cx, HandleObject proxy, AutoIdVector &props)
{
return getPropertyKeys(cx, proxy, JSITER_OWNONLY, props);
}
bool
CPOWProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const
{
FORWARD(isExtensible, (cx, proxy, extensible));
--- a/js/ipc/WrapperOwner.h
+++ b/js/ipc/WrapperOwner.h
@@ -49,17 +49,18 @@ class WrapperOwner : public virtual Java
JS::HandleId id, bool strict, JS::MutableHandleValue vp);
bool callOrConstruct(JSContext *cx, JS::HandleObject proxy, const JS::CallArgs &args,
bool construct);
// SpiderMonkey extensions.
bool getPropertyDescriptor(JSContext *cx, JS::HandleObject proxy, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc);
bool hasOwn(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, bool *bp);
- bool keys(JSContext *cx, JS::HandleObject proxy, JS::AutoIdVector &props);
+ bool getOwnEnumerablePropertyKeys(JSContext *cx, JS::HandleObject proxy,
+ JS::AutoIdVector &props);
// We use "iterate" provided by the base class here.
bool hasInstance(JSContext *cx, JS::HandleObject proxy, JS::MutableHandleValue v, bool *bp);
bool objectClassIs(JSContext *cx, JS::HandleObject obj, js::ESClassValue classValue);
const char* className(JSContext *cx, JS::HandleObject proxy);
bool regexp_toShared(JSContext *cx, JS::HandleObject proxy, js::RegExpGuard *g);
bool isCallable(JSObject *obj);
bool isConstructor(JSObject *obj);
--- a/js/src/jsiter.cpp
+++ b/js/src/jsiter.cpp
@@ -295,17 +295,17 @@ Snapshot(JSContext *cx, JSObject *pobj_,
if (flags & JSITER_OWNONLY) {
if (flags & JSITER_HIDDEN) {
// This gets all property keys, both strings and
// symbols. The call to Enumerate in the loop below
// will filter out unwanted keys, per the flags.
if (!Proxy::ownPropertyKeys(cx, pobj, proxyProps))
return false;
} else {
- if (!Proxy::keys(cx, pobj, proxyProps))
+ if (!Proxy::getOwnEnumerablePropertyKeys(cx, pobj, proxyProps))
return false;
}
} else {
if (!Proxy::enumerate(cx, pobj, proxyProps))
return false;
}
for (size_t n = 0, len = proxyProps.length(); n < len; n++) {
--- a/js/src/jsproxy.h
+++ b/js/src/jsproxy.h
@@ -162,18 +162,19 @@ class JS_FRIEND_API(BaseProxyHandler)
/*
* Proxy handlers can use mHasPrototype to request the following special
* 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, keys, etc., and
- * consults the prototype chain if needed.
+ * 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,
* it consults the prototype chain.
*
* This is useful because it frees the ProxyHandler from having to implement
* any behavior having to do with the prototype chain.
*/
@@ -294,17 +295,18 @@ class JS_FRIEND_API(BaseProxyHandler)
*/
virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const;
virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const;
/* SpiderMonkey extensions. */
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) const = 0;
virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const;
- virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const;
+ virtual bool getOwnEnumerablePropertyKeys(JSContext *cx, HandleObject proxy,
+ AutoIdVector &props) const;
virtual bool iterate(JSContext *cx, HandleObject proxy, unsigned flags,
MutableHandleValue vp) const;
virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args) const;
virtual bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp) const;
virtual bool objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx) const;
virtual const char *className(JSContext *cx, HandleObject proxy) const;
virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const;
virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const;
@@ -378,18 +380,18 @@ class JS_PUBLIC_API(DirectProxyHandler)
virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE;
virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE;
/* SpiderMonkey extensions. */
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id,
bool *bp) const MOZ_OVERRIDE;
- virtual bool keys(JSContext *cx, HandleObject proxy,
- AutoIdVector &props) const MOZ_OVERRIDE;
+ virtual bool getOwnEnumerablePropertyKeys(JSContext *cx, HandleObject proxy,
+ AutoIdVector &props) const MOZ_OVERRIDE;
virtual bool iterate(JSContext *cx, HandleObject proxy, unsigned flags,
MutableHandleValue vp) const MOZ_OVERRIDE;
virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl,
CallArgs args) const MOZ_OVERRIDE;
virtual bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v,
bool *bp) const MOZ_OVERRIDE;
virtual bool objectClassIs(HandleObject obj, ESClassValue classValue,
JSContext *cx) const MOZ_OVERRIDE;
--- a/js/src/jswrapper.h
+++ b/js/src/jswrapper.h
@@ -135,17 +135,18 @@ class JS_FRIEND_API(CrossCompartmentWrap
HandleId id, bool strict, MutableHandleValue vp) const MOZ_OVERRIDE;
virtual bool call(JSContext *cx, HandleObject wrapper, const CallArgs &args) const MOZ_OVERRIDE;
virtual bool construct(JSContext *cx, HandleObject wrapper, const CallArgs &args) const MOZ_OVERRIDE;
/* SpiderMonkey extensions. */
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
virtual bool hasOwn(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const MOZ_OVERRIDE;
- virtual bool keys(JSContext *cx, HandleObject wrapper, AutoIdVector &props) const MOZ_OVERRIDE;
+ virtual bool getOwnEnumerablePropertyKeys(JSContext *cx, HandleObject wrapper,
+ AutoIdVector &props) const MOZ_OVERRIDE;
virtual bool iterate(JSContext *cx, HandleObject wrapper, unsigned flags,
MutableHandleValue vp) const MOZ_OVERRIDE;
virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl,
CallArgs args) const MOZ_OVERRIDE;
virtual bool hasInstance(JSContext *cx, HandleObject wrapper, MutableHandleValue v,
bool *bp) const MOZ_OVERRIDE;
virtual const char *className(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE;
virtual JSString *fun_toString(JSContext *cx, HandleObject wrapper,
--- a/js/src/proxy/BaseProxyHandler.cpp
+++ b/js/src/proxy/BaseProxyHandler.cpp
@@ -160,17 +160,18 @@ js::SetPropertyIgnoringNamedGetter(JSCon
desc.value().set(vp.get());
desc.setAttributes(JSPROP_ENUMERATE);
desc.setGetter(nullptr);
desc.setSetter(nullptr); // Pick up the class getter/setter.
return handler->defineProperty(cx, receiver, id, desc);
}
bool
-BaseProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const
+BaseProxyHandler::getOwnEnumerablePropertyKeys(JSContext *cx, HandleObject proxy,
+ AutoIdVector &props) const
{
assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE);
MOZ_ASSERT(props.length() == 0);
if (!ownPropertyKeys(cx, proxy, props))
return false;
/* Select only the enumerable properties through in-place iteration. */
@@ -199,17 +200,17 @@ BaseProxyHandler::keys(JSContext *cx, Ha
bool
BaseProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags,
MutableHandleValue vp) const
{
assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE);
AutoIdVector props(cx);
if ((flags & JSITER_OWNONLY)
- ? !keys(cx, proxy, props)
+ ? !getOwnEnumerablePropertyKeys(cx, proxy, props)
: !enumerate(cx, proxy, props)) {
return false;
}
return EnumeratedIdVectorToIterator(cx, proxy, flags, props, vp);
}
bool
--- a/js/src/proxy/CrossCompartmentWrapper.cpp
+++ b/js/src/proxy/CrossCompartmentWrapper.cpp
@@ -146,21 +146,22 @@ CrossCompartmentWrapper::set(JSContext *
PIERCE(cx, wrapper,
cx->compartment()->wrap(cx, &receiverCopy) &&
cx->compartment()->wrap(cx, vp),
Wrapper::set(cx, wrapper, receiverCopy, id, strict, vp),
NOTHING);
}
bool
-CrossCompartmentWrapper::keys(JSContext *cx, HandleObject wrapper, AutoIdVector &props) const
+CrossCompartmentWrapper::getOwnEnumerablePropertyKeys(JSContext *cx, HandleObject wrapper,
+ AutoIdVector &props) const
{
PIERCE(cx, wrapper,
NOTHING,
- Wrapper::keys(cx, wrapper, props),
+ Wrapper::getOwnEnumerablePropertyKeys(cx, wrapper, props),
NOTHING);
}
/*
* We can reify non-escaping iterator objects instead of having to wrap them. This
* allows fast iteration over objects across a compartment boundary.
*/
static bool
--- a/js/src/proxy/DirectProxyHandler.cpp
+++ b/js/src/proxy/DirectProxyHandler.cpp
@@ -213,17 +213,18 @@ DirectProxyHandler::set(JSContext *cx, H
HandleId id, bool strict, MutableHandleValue vp) const
{
assertEnteredPolicy(cx, proxy, id, SET);
RootedObject target(cx, proxy->as<ProxyObject>().target());
return JSObject::setGeneric(cx, target, receiver, id, vp, strict);
}
bool
-DirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const
+DirectProxyHandler::getOwnEnumerablePropertyKeys(JSContext *cx, HandleObject proxy,
+ AutoIdVector &props) const
{
assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE);
RootedObject target(cx, proxy->as<ProxyObject>().target());
return GetPropertyKeys(cx, target, JSITER_OWNONLY, &props);
}
bool
DirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags,
--- a/js/src/proxy/Proxy.cpp
+++ b/js/src/proxy/Proxy.cpp
@@ -211,17 +211,17 @@ Proxy::enumerate(JSContext *cx, HandleOb
{
JS_CHECK_RECURSION(cx, return false);
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::ENUMERATE, true);
if (!policy.allowed())
return policy.returnValue();
if (!handler->hasPrototype())
return proxy->as<ProxyObject>().handler()->enumerate(cx, proxy, props);
- if (!handler->keys(cx, proxy, props))
+ if (!handler->getOwnEnumerablePropertyKeys(cx, proxy, props))
return false;
AutoIdVector protoProps(cx);
INVOKE_ON_PROTOTYPE(cx, handler, proxy,
GetPropertyKeys(cx, proto, 0, &protoProps) &&
AppendUnique(cx, props, protoProps));
}
bool
@@ -336,24 +336,24 @@ Proxy::set(JSContext *cx, HandleObject p
newDesc.setAttributes(desc.attributes());
else
newDesc.setAttributes(JSPROP_ENUMERATE);
newDesc.value().set(vp);
return handler->defineProperty(cx, receiver, id, &newDesc);
}
bool
-Proxy::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props)
+Proxy::getOwnEnumerablePropertyKeys(JSContext *cx, HandleObject proxy, AutoIdVector &props)
{
JS_CHECK_RECURSION(cx, return false);
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::ENUMERATE, true);
if (!policy.allowed())
return policy.returnValue();
- return handler->keys(cx, proxy, props);
+ return handler->getOwnEnumerablePropertyKeys(cx, proxy, props);
}
bool
Proxy::iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleValue vp)
{
JS_CHECK_RECURSION(cx, return false);
const BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
vp.setUndefined(); // default result if we refuse to perform this action
@@ -367,17 +367,17 @@ Proxy::iterate(JSContext *cx, HandleObje
return policy.returnValue() &&
EnumeratedIdVectorToIterator(cx, proxy, flags, props, vp);
}
return handler->iterate(cx, proxy, flags, vp);
}
AutoIdVector props(cx);
// The other Proxy::foo methods do the prototype-aware work for us here.
if ((flags & JSITER_OWNONLY)
- ? !Proxy::keys(cx, proxy, props)
+ ? !Proxy::getOwnEnumerablePropertyKeys(cx, proxy, props)
: !Proxy::enumerate(cx, proxy, props)) {
return false;
}
return EnumeratedIdVectorToIterator(cx, proxy, flags, props, vp);
}
bool
Proxy::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible)
--- a/js/src/proxy/Proxy.h
+++ b/js/src/proxy/Proxy.h
@@ -48,17 +48,18 @@ class Proxy
static bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args);
/* SpiderMonkey extensions. */
static bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<JSPropertyDescriptor> desc);
static bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandleValue vp);
static bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp);
- static bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props);
+ static bool getOwnEnumerablePropertyKeys(JSContext *cx, HandleObject proxy,
+ AutoIdVector &props);
static bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleValue vp);
static bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args);
static bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp);
static bool objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx);
static const char *className(JSContext *cx, HandleObject proxy);
static JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent);
static bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g);
static bool boxedValue_unbox(JSContext *cx, HandleObject proxy, MutableHandleValue vp);
--- a/js/src/proxy/ScriptedDirectProxyHandler.cpp
+++ b/js/src/proxy/ScriptedDirectProxyHandler.cpp
@@ -167,17 +167,18 @@ ReportInvalidTrapResult(JSContext *cx, J
RootedValue v(cx, ObjectOrNullValue(proxy));
JSAutoByteString bytes;
if (!AtomToPrintableString(cx, atom, &bytes))
return;
js_ReportValueError2(cx, JSMSG_INVALID_TRAP_RESULT, JSDVG_IGNORE_STACK, v,
js::NullPtr(), bytes.ptr());
}
-// This function is shared between ownPropertyKeys, enumerate, and keys
+// This function is shared between ownPropertyKeys, enumerate, and
+// getOwnEnumerablePropertyKeys.
static bool
ArrayToIdVector(JSContext *cx, HandleObject proxy, HandleObject target, HandleValue v,
AutoIdVector &props, unsigned flags, JSAtom *trapName_)
{
MOZ_ASSERT(v.isObject());
RootedObject array(cx, &v.toObject());
RootedAtom trapName(cx, trapName_);
--- a/js/src/proxy/ScriptedDirectProxyHandler.h
+++ b/js/src/proxy/ScriptedDirectProxyHandler.h
@@ -39,20 +39,23 @@ class ScriptedDirectProxyHandler : publi
/* SpiderMonkey extensions. */
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE {
return BaseProxyHandler::hasOwn(cx, proxy, id, bp);
}
- // Kick keys out to getOwnPropertyName and then filter. [[GetOwnProperty]] could potentially
- // change the enumerability of the target's properties.
- virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE {
- return BaseProxyHandler::keys(cx, proxy, props);
+
+ // Kick getOwnEnumerablePropertyKeys out to ownPropertyKeys and then
+ // filter. [[GetOwnProperty]] could potentially change the enumerability of
+ // the target's properties.
+ virtual bool getOwnEnumerablePropertyKeys(JSContext *cx, HandleObject proxy,
+ AutoIdVector &props) const MOZ_OVERRIDE {
+ return BaseProxyHandler::getOwnEnumerablePropertyKeys(cx, proxy, props);
}
virtual bool iterate(JSContext *cx, HandleObject proxy, unsigned flags,
MutableHandleValue vp) const MOZ_OVERRIDE;
virtual bool isCallable(JSObject *obj) const MOZ_OVERRIDE;
virtual bool isConstructor(JSObject *obj) const MOZ_OVERRIDE {
// For now we maintain the broken behavior that a scripted proxy is constructable if it's
// callable. See bug 929467.
--- a/js/src/proxy/ScriptedIndirectProxyHandler.cpp
+++ b/js/src/proxy/ScriptedIndirectProxyHandler.cpp
@@ -297,24 +297,25 @@ ScriptedIndirectProxyHandler::set(JSCont
if (!GetDerivedTrap(cx, handler, cx->names().set, &fval))
return false;
if (!IsCallable(fval))
return BaseProxyHandler::set(cx, proxy, receiver, id, strict, vp);
return Trap(cx, handler, fval, 3, argv.begin(), &idv);
}
bool
-ScriptedIndirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const
+ScriptedIndirectProxyHandler::getOwnEnumerablePropertyKeys(JSContext *cx, HandleObject proxy,
+ AutoIdVector &props) const
{
RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy));
RootedValue value(cx);
if (!GetDerivedTrap(cx, handler, cx->names().keys, &value))
return false;
if (!IsCallable(value))
- return BaseProxyHandler::keys(cx, proxy, props);
+ return BaseProxyHandler::getOwnEnumerablePropertyKeys(cx, proxy, props);
return Trap(cx, handler, value, 0, nullptr, &value) &&
ArrayToIdVector(cx, value, props);
}
bool
ScriptedIndirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags,
MutableHandleValue vp) const
{
--- a/js/src/proxy/ScriptedIndirectProxyHandler.h
+++ b/js/src/proxy/ScriptedIndirectProxyHandler.h
@@ -35,17 +35,18 @@ class ScriptedIndirectProxyHandler : pub
MutableHandleValue vp) const MOZ_OVERRIDE;
virtual bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id,
bool strict, MutableHandleValue vp) const MOZ_OVERRIDE;
/* SpiderMonkey extensions. */
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE;
- virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE;
+ virtual bool getOwnEnumerablePropertyKeys(JSContext *cx, HandleObject proxy,
+ AutoIdVector &props) const MOZ_OVERRIDE;
virtual bool iterate(JSContext *cx, HandleObject proxy, unsigned flags,
MutableHandleValue vp) const MOZ_OVERRIDE;
virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl,
CallArgs args) const MOZ_OVERRIDE;
virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const MOZ_OVERRIDE;
virtual bool isScripted() const MOZ_OVERRIDE { return true; }
static const char family;
--- a/js/xpconnect/src/Sandbox.cpp
+++ b/js/xpconnect/src/Sandbox.cpp
@@ -710,20 +710,21 @@ xpc::SandboxProxyHandler::set(JSContext
JS::Handle<jsid> id,
bool strict,
JS::MutableHandle<Value> vp) const
{
return BaseProxyHandler::set(cx, proxy, receiver, id, strict, vp);
}
bool
-xpc::SandboxProxyHandler::keys(JSContext *cx, JS::Handle<JSObject*> proxy,
- AutoIdVector &props) const
+xpc::SandboxProxyHandler::getOwnEnumerablePropertyKeys(JSContext *cx,
+ JS::Handle<JSObject*> proxy,
+ AutoIdVector &props) const
{
- return BaseProxyHandler::keys(cx, proxy, props);
+ return BaseProxyHandler::getOwnEnumerablePropertyKeys(cx, proxy, props);
}
bool
xpc::SandboxProxyHandler::iterate(JSContext *cx, JS::Handle<JSObject*> proxy,
unsigned flags, JS::MutableHandle<Value> vp) const
{
return BaseProxyHandler::iterate(cx, proxy, flags, vp);
}
--- a/js/xpconnect/wrappers/ChromeObjectWrapper.h
+++ b/js/xpconnect/wrappers/ChromeObjectWrapper.h
@@ -47,22 +47,23 @@ class ChromeObjectWrapper : public Chrom
const JS::CallArgs &args) const MOZ_OVERRIDE;
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
virtual bool objectClassIs(JS::Handle<JSObject*> obj, js::ESClassValue classValue,
JSContext *cx) const MOZ_OVERRIDE;
- // NB: One might think we'd need to implement enumerate(), keys(), iterate(),
- // and getPropertyKeys() here. However, ES5 built-in properties aren't
- // enumerable (and SpiderMonkey's implementation seems to match the spec
- // modulo Error.prototype.fileName and Error.prototype.lineNumber). Since
- // we're only remapping the prototypes of standard objects, there would
- // never be anything more to enumerate up the prototype chain. So we can
- // actually skip these.
+ // NB: One might think we'd need to implement enumerate(),
+ // getOwnEnumerablePropertyKeys(), iterate(), and ownPropertyKeys()
+ // here. However, ES5 built-in properties aren't enumerable (and
+ // SpiderMonkey's implementation seems to match the spec modulo
+ // Error.prototype.fileName and Error.prototype.lineNumber). Since we're
+ // only remapping the prototypes of standard objects, there would never be
+ // anything more to enumerate up the prototype chain. So we can actually
+ // skip these.
static const ChromeObjectWrapper singleton;
};
} /* namespace xpc */
#endif /* __ChromeObjectWrapper_h__ */
--- a/js/xpconnect/wrappers/FilteringWrapper.cpp
+++ b/js/xpconnect/wrappers/FilteringWrapper.cpp
@@ -107,21 +107,22 @@ FilteringWrapper<Base, Policy>::enumerat
{
assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE);
return Base::enumerate(cx, wrapper, props) &&
Filter<Policy>(cx, wrapper, props);
}
template <typename Base, typename Policy>
bool
-FilteringWrapper<Base, Policy>::keys(JSContext *cx, HandleObject wrapper,
- AutoIdVector &props) const
+FilteringWrapper<Base, Policy>::getOwnEnumerablePropertyKeys(JSContext *cx,
+ HandleObject wrapper,
+ AutoIdVector &props) const
{
assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE);
- return Base::keys(cx, wrapper, props) &&
+ return Base::getOwnEnumerablePropertyKeys(cx, wrapper, props) &&
Filter<Policy>(cx, wrapper, props);
}
template <typename Base, typename Policy>
bool
FilteringWrapper<Base, Policy>::iterate(JSContext *cx, HandleObject wrapper,
unsigned flags, MutableHandleValue vp) const
{
--- a/js/xpconnect/wrappers/FilteringWrapper.h
+++ b/js/xpconnect/wrappers/FilteringWrapper.h
@@ -34,18 +34,18 @@ class FilteringWrapper : public Base {
virtual bool ownPropertyKeys(JSContext *cx, JS::Handle<JSObject*> wrapper,
JS::AutoIdVector &props) const MOZ_OVERRIDE;
virtual bool enumerate(JSContext *cx, JS::Handle<JSObject*> wrapper,
JS::AutoIdVector &props) const MOZ_OVERRIDE;
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
- virtual bool keys(JSContext *cx, JS::Handle<JSObject*> wrapper,
- JS::AutoIdVector &props) const MOZ_OVERRIDE;
+ virtual bool getOwnEnumerablePropertyKeys(JSContext *cx, JS::Handle<JSObject*> wrapper,
+ JS::AutoIdVector &props) const MOZ_OVERRIDE;
virtual bool iterate(JSContext *cx, JS::Handle<JSObject*> wrapper, unsigned flags,
JS::MutableHandle<JS::Value> vp) const MOZ_OVERRIDE;
virtual bool nativeCall(JSContext *cx, JS::IsAcceptableThis test, JS::NativeImpl impl,
JS::CallArgs args) const MOZ_OVERRIDE;
virtual bool defaultValue(JSContext *cx, JS::Handle<JSObject*> obj, JSType hint,
JS::MutableHandleValue vp) const MOZ_OVERRIDE;
--- a/js/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/xpconnect/wrappers/XrayWrapper.cpp
@@ -2067,21 +2067,22 @@ XrayWrapper<Base, Traits>::hasOwn(JSCont
HandleId id, bool *bp) const
{
// Skip our Base if it isn't already ProxyHandler.
return js::BaseProxyHandler::hasOwn(cx, wrapper, id, bp);
}
template <typename Base, typename Traits>
bool
-XrayWrapper<Base, Traits>::keys(JSContext *cx, HandleObject wrapper,
- AutoIdVector &props) const
+XrayWrapper<Base, Traits>::getOwnEnumerablePropertyKeys(JSContext *cx,
+ HandleObject wrapper,
+ AutoIdVector &props) const
{
// Skip our Base if it isn't already ProxyHandler.
- return js::BaseProxyHandler::keys(cx, wrapper, props);
+ return js::BaseProxyHandler::getOwnEnumerablePropertyKeys(cx, wrapper, props);
}
template <typename Base, typename Traits>
bool
XrayWrapper<Base, Traits>::iterate(JSContext *cx, HandleObject wrapper,
unsigned flags, MutableHandleValue vp) const
{
// Skip our Base if it isn't already ProxyHandler.
--- a/js/xpconnect/wrappers/XrayWrapper.h
+++ b/js/xpconnect/wrappers/XrayWrapper.h
@@ -431,18 +431,18 @@ class XrayWrapper : public Base {
virtual bool construct(JSContext *cx, JS::Handle<JSObject*> wrapper,
const JS::CallArgs &args) const MOZ_OVERRIDE;
/* SpiderMonkey extensions. */
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
virtual bool hasOwn(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<jsid> id,
bool *bp) const MOZ_OVERRIDE;
- virtual bool keys(JSContext *cx, JS::Handle<JSObject*> wrapper,
- JS::AutoIdVector &props) const MOZ_OVERRIDE;
+ virtual bool getOwnEnumerablePropertyKeys(JSContext *cx, JS::Handle<JSObject*> wrapper,
+ JS::AutoIdVector &props) const MOZ_OVERRIDE;
virtual bool iterate(JSContext *cx, JS::Handle<JSObject*> wrapper, unsigned flags,
JS::MutableHandle<JS::Value> vp) const MOZ_OVERRIDE;
virtual const char *className(JSContext *cx, JS::HandleObject proxy) const MOZ_OVERRIDE;
virtual bool defaultValue(JSContext *cx, JS::HandleObject wrapper,
JSType hint, JS::MutableHandleValue vp)
const MOZ_OVERRIDE;
@@ -502,18 +502,18 @@ public:
virtual bool set(JSContext *cx, JS::Handle<JSObject*> proxy, JS::Handle<JSObject*> receiver,
JS::Handle<jsid> id, bool strict, JS::MutableHandle<JS::Value> vp) const MOZ_OVERRIDE;
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
virtual bool hasOwn(JSContext *cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id,
bool *bp) const MOZ_OVERRIDE;
- virtual bool keys(JSContext *cx, JS::Handle<JSObject*> proxy,
- JS::AutoIdVector &props) const MOZ_OVERRIDE;
+ virtual bool getOwnEnumerablePropertyKeys(JSContext *cx, JS::Handle<JSObject*> proxy,
+ JS::AutoIdVector &props) const MOZ_OVERRIDE;
virtual bool iterate(JSContext *cx, JS::Handle<JSObject*> proxy, unsigned flags,
JS::MutableHandle<JS::Value> vp) const MOZ_OVERRIDE;
};
extern const SandboxProxyHandler sandboxProxyHandler;
// A proxy handler that lets us wrap callables and invoke them with
// the correct this object, while forwarding all other operations down