Bug 547140, part 2 - Remove flags argument from JS_GetPropertyDescriptor and friends. r=Waldo.

This commit is contained in:
Jason Orendorff 2014-04-25 16:11:01 -05:00
parent 40e61296e0
commit d50e6f5a9b
36 changed files with 170 additions and 242 deletions

View File

@ -5850,7 +5850,7 @@ nsDocument::RegisterElement(JSContext* aCx, const nsAString& aType,
JS::Rooted<JSPropertyDescriptor> descRoot(aCx);
JS::MutableHandle<JSPropertyDescriptor> desc(&descRoot);
if(!JS_GetPropertyDescriptor(aCx, protoObject, "constructor", 0, desc)) {
if (!JS_GetPropertyDescriptor(aCx, protoObject, "constructor", desc)) {
rv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}

View File

@ -86,8 +86,7 @@ bool
WindowNamedPropertiesHandler::getOwnPropertyDescriptor(JSContext* aCx,
JS::Handle<JSObject*> aProxy,
JS::Handle<jsid> aId,
JS::MutableHandle<JSPropertyDescriptor> aDesc,
unsigned aFlags)
JS::MutableHandle<JSPropertyDescriptor> aDesc)
{
if (!JSID_IS_STRING(aId)) {
// Nothing to do if we're resolving a non-string property.

View File

@ -30,8 +30,7 @@ public:
virtual bool
getOwnPropertyDescriptor(JSContext* aCx, JS::Handle<JSObject*> aProxy,
JS::Handle<jsid> aId,
JS::MutableHandle<JSPropertyDescriptor> aDesc,
unsigned aFlags) MOZ_OVERRIDE;
JS::MutableHandle<JSPropertyDescriptor> aDesc) MOZ_OVERRIDE;
virtual bool
defineProperty(JSContext* aCx, JS::Handle<JSObject*> aProxy,
JS::Handle<jsid> aId,

View File

@ -615,13 +615,11 @@ public:
virtual bool getPropertyDescriptor(JSContext* cx,
JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
JS::MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyDescriptor(JSContext* cx,
JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
JS::MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool defineProperty(JSContext* cx,
JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id,
@ -748,14 +746,13 @@ bool
nsOuterWindowProxy::getPropertyDescriptor(JSContext* cx,
JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags)
JS::MutableHandle<JSPropertyDescriptor> desc)
{
// 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.
desc.object().set(nullptr);
if (!getOwnPropertyDescriptor(cx, proxy, id, desc, flags)) {
if (!getOwnPropertyDescriptor(cx, proxy, id, desc)) {
return false;
}
@ -763,15 +760,14 @@ nsOuterWindowProxy::getPropertyDescriptor(JSContext* cx,
return true;
}
return js::Wrapper::getPropertyDescriptor(cx, proxy, id, desc, flags);
return js::Wrapper::getPropertyDescriptor(cx, proxy, id, desc);
}
bool
nsOuterWindowProxy::getOwnPropertyDescriptor(JSContext* cx,
JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags)
JS::MutableHandle<JSPropertyDescriptor> desc)
{
bool found;
if (!GetSubframeWindow(cx, proxy, id, desc.value(), found)) {
@ -783,7 +779,7 @@ nsOuterWindowProxy::getOwnPropertyDescriptor(JSContext* cx,
}
// else fall through to js::Wrapper
return js::Wrapper::getOwnPropertyDescriptor(cx, proxy, id, desc, flags);
return js::Wrapper::getOwnPropertyDescriptor(cx, proxy, id, desc);
}
bool

View File

@ -8647,7 +8647,7 @@ class CGResolveOwnProperty(CGAbstractStaticMethod):
def definition_body(self):
# BOGUS extra blank line at end of function
return " return js::GetProxyHandler(obj)->getOwnPropertyDescriptor(cx, wrapper, id, desc, flags);\n\n"
return " return js::GetProxyHandler(obj)->getOwnPropertyDescriptor(cx, wrapper, id, desc);\n\n"
class CGResolveOwnPropertyViaNewresolve(CGAbstractBindingMethod):
@ -8661,8 +8661,7 @@ class CGResolveOwnPropertyViaNewresolve(CGAbstractBindingMethod):
Argument('JS::Handle<JSObject*>', 'obj'),
Argument('JS::Handle<jsid>', 'id'),
Argument('JS::MutableHandle<JSPropertyDescriptor>', 'desc'),
Argument('unsigned', 'flags'),
]
Argument('unsigned', 'flags')]
CGAbstractBindingMethod.__init__(self, descriptor,
"ResolveOwnPropertyViaNewresolve",
args, getThisObj="",
@ -9067,8 +9066,7 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(ClassMethod):
args = [Argument('JSContext*', 'cx'),
Argument('JS::Handle<JSObject*>', 'proxy'),
Argument('JS::Handle<jsid>', 'id'),
Argument('JS::MutableHandle<JSPropertyDescriptor>', 'desc'),
Argument('unsigned', 'flags')]
Argument('JS::MutableHandle<JSPropertyDescriptor>', 'desc')]
ClassMethod.__init__(self, "getOwnPropertyDescriptor", "bool", args,
virtual=True, override=True)
self.descriptor = descriptor
@ -9100,7 +9098,7 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(ClassMethod):
if UseHolderForUnforgeable(self.descriptor):
tryHolder = dedent("""
if (!JS_GetPropertyDescriptorById(cx, ${holder}, id, flags, desc)) {
if (!JS_GetPropertyDescriptorById(cx, ${holder}, id, desc)) {
return false;
}
MOZ_ASSERT_IF(desc.object(), desc.object() == ${holder});
@ -9155,7 +9153,7 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(ClassMethod):
$*{getUnforgeable}
JS::Rooted<JSObject*> expando(cx);
if (!isXray && (expando = GetExpandoObject(proxy))) {
if (!JS_GetPropertyDescriptorById(cx, expando, id, flags, desc)) {
if (!JS_GetPropertyDescriptorById(cx, expando, id, desc)) {
return false;
}
if (desc.object()) {

View File

@ -166,10 +166,9 @@ bool
BaseDOMProxyHandler::getPropertyDescriptor(JSContext* cx,
JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id,
MutableHandle<JSPropertyDescriptor> desc,
unsigned flags)
MutableHandle<JSPropertyDescriptor> desc)
{
if (!getOwnPropertyDescriptor(cx, proxy, id, desc, flags)) {
if (!getOwnPropertyDescriptor(cx, proxy, id, desc)) {
return false;
}
if (desc.object()) {
@ -185,7 +184,7 @@ BaseDOMProxyHandler::getPropertyDescriptor(JSContext* cx,
return true;
}
return JS_GetPropertyDescriptorById(cx, proto, id, 0, desc);
return JS_GetPropertyDescriptorById(cx, proto, id, desc);
}
bool

View File

@ -50,8 +50,7 @@ public:
JS::AutoIdVector& props) MOZ_OVERRIDE;
bool getPropertyDescriptor(JSContext* cx, JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
JS::MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
bool watch(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id,
JS::Handle<JSObject*> callable) MOZ_OVERRIDE;

View File

@ -233,7 +233,7 @@ nsXBLProtoImpl::LookupMember(JSContext* aCx, nsString& aName,
{
for (nsXBLProtoImplMember* m = mMembers; m; m = m->GetNext()) {
if (aName.Equals(m->GetName())) {
return JS_GetPropertyDescriptorById(aCx, aClassObject, aNameAsId, 0, aDesc);
return JS_GetPropertyDescriptorById(aCx, aClassObject, aNameAsId, aDesc);
}
}
return true;

View File

@ -174,8 +174,7 @@ EmptyDesc(PPropertyDescriptor *desc)
bool
JavaScriptChild::AnswerGetPropertyDescriptor(const ObjectId &objId, const nsString &id,
const uint32_t &flags, ReturnStatus *rs,
PPropertyDescriptor *out)
ReturnStatus *rs, PPropertyDescriptor *out)
{
AutoSafeJSContext cx;
JSAutoRequest request(cx);
@ -193,7 +192,7 @@ JavaScriptChild::AnswerGetPropertyDescriptor(const ObjectId &objId, const nsStri
return fail(cx, rs);
Rooted<JSPropertyDescriptor> desc(cx);
if (!JS_GetPropertyDescriptorById(cx, obj, internedId, flags, &desc))
if (!JS_GetPropertyDescriptorById(cx, obj, internedId, &desc))
return fail(cx, rs);
if (!desc.object())
@ -207,8 +206,7 @@ JavaScriptChild::AnswerGetPropertyDescriptor(const ObjectId &objId, const nsStri
bool
JavaScriptChild::AnswerGetOwnPropertyDescriptor(const ObjectId &objId, const nsString &id,
const uint32_t &flags, ReturnStatus *rs,
PPropertyDescriptor *out)
ReturnStatus *rs, PPropertyDescriptor *out)
{
AutoSafeJSContext cx;
JSAutoRequest request(cx);
@ -226,7 +224,7 @@ JavaScriptChild::AnswerGetOwnPropertyDescriptor(const ObjectId &objId, const nsS
return fail(cx, rs);
Rooted<JSPropertyDescriptor> desc(cx);
if (!JS_GetPropertyDescriptorById(cx, obj, internedId, flags, &desc))
if (!JS_GetPropertyDescriptorById(cx, obj, internedId, &desc))
return fail(cx, rs);
if (desc.object() != obj)
@ -344,7 +342,7 @@ JavaScriptChild::AnswerHasOwn(const ObjectId &objId, const nsString &id, ReturnS
return fail(cx, rs);
Rooted<JSPropertyDescriptor> desc(cx);
if (!JS_GetPropertyDescriptorById(cx, obj, internedId, 0, &desc))
if (!JS_GetPropertyDescriptorById(cx, obj, internedId, &desc))
return fail(cx, rs);
*bp = (desc.object() == obj);

View File

@ -29,11 +29,10 @@ class JavaScriptChild
bool AnswerPreventExtensions(const ObjectId &objId, ReturnStatus *rs) MOZ_OVERRIDE;
bool AnswerGetPropertyDescriptor(const ObjectId &objId, const nsString &id,
const uint32_t &flags, ReturnStatus *rs,
ReturnStatus *rs,
PPropertyDescriptor *out) MOZ_OVERRIDE;
bool AnswerGetOwnPropertyDescriptor(const ObjectId &objId,
const nsString &id,
const uint32_t &flags,
ReturnStatus *rs,
PPropertyDescriptor *out) MOZ_OVERRIDE;
bool AnswerDefineProperty(const ObjectId &objId, const nsString &id,

View File

@ -64,11 +64,9 @@ class CPOWProxyHandler : public BaseProxyHandler
virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE;
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy,
HandleId id, MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy,
@ -123,14 +121,14 @@ JavaScriptParent::preventExtensions(JSContext *cx, HandleObject proxy)
bool
CPOWProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<JSPropertyDescriptor> desc, unsigned flags)
MutableHandle<JSPropertyDescriptor> desc)
{
FORWARD(getPropertyDescriptor, (cx, proxy, id, desc, flags));
FORWARD(getPropertyDescriptor, (cx, proxy, id, desc));
}
bool
JavaScriptParent::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<JSPropertyDescriptor> desc, unsigned flags)
MutableHandle<JSPropertyDescriptor> desc)
{
ObjectId objId = idOf(proxy);
@ -140,7 +138,7 @@ JavaScriptParent::getPropertyDescriptor(JSContext *cx, HandleObject proxy, Handl
ReturnStatus status;
PPropertyDescriptor result;
if (!CallGetPropertyDescriptor(objId, idstr, flags, &status, &result))
if (!CallGetPropertyDescriptor(objId, idstr, &status, &result))
return ipcfail(cx);
if (!ok(cx, status))
return false;
@ -150,15 +148,14 @@ JavaScriptParent::getPropertyDescriptor(JSContext *cx, HandleObject proxy, Handl
bool
CPOWProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy,
HandleId id, MutableHandle<JSPropertyDescriptor> desc,
unsigned flags)
HandleId id, MutableHandle<JSPropertyDescriptor> desc)
{
FORWARD(getOwnPropertyDescriptor, (cx, proxy, id, desc, flags));
FORWARD(getOwnPropertyDescriptor, (cx, proxy, id, desc));
}
bool
JavaScriptParent::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<JSPropertyDescriptor> desc, unsigned flags)
MutableHandle<JSPropertyDescriptor> desc)
{
ObjectId objId = idOf(proxy);
@ -168,7 +165,7 @@ JavaScriptParent::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, Ha
ReturnStatus status;
PPropertyDescriptor result;
if (!CallGetOwnPropertyDescriptor(objId, idstr, flags, &status, &result))
if (!CallGetOwnPropertyDescriptor(objId, idstr, &status, &result))
return ipcfail(cx);
if (!ok(cx, status))
return false;

View File

@ -34,9 +34,9 @@ class JavaScriptParent
// (The traps should be in the same order like js/src/jsproxy.h)
bool preventExtensions(JSContext *cx, JS::HandleObject proxy);
bool getPropertyDescriptor(JSContext *cx, JS::HandleObject proxy, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc, unsigned flags);
JS::MutableHandle<JSPropertyDescriptor> desc);
bool getOwnPropertyDescriptor(JSContext *cx, JS::HandleObject proxy, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc, unsigned flags);
JS::MutableHandle<JSPropertyDescriptor> desc);
bool defineProperty(JSContext *cx, JS::HandleObject proxy, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc);
bool getOwnPropertyNames(JSContext *cx, JS::HandleObject proxy, JS::AutoIdVector &props);

View File

@ -24,8 +24,8 @@ child:
// These roughly map to the ProxyHandler hooks that CPOWs need.
rpc PreventExtensions(uint64_t objId) returns (ReturnStatus rs);
rpc GetPropertyDescriptor(uint64_t objId, nsString id, uint32_t flags) returns (ReturnStatus rs, PPropertyDescriptor result);
rpc GetOwnPropertyDescriptor(uint64_t objId, nsString id, uint32_t flags) returns (ReturnStatus rs, PPropertyDescriptor result);
rpc GetPropertyDescriptor(uint64_t objId, nsString id) returns (ReturnStatus rs, PPropertyDescriptor result);
rpc GetOwnPropertyDescriptor(uint64_t objId, nsString id) returns (ReturnStatus rs, PPropertyDescriptor result);
rpc DefineProperty(uint64_t objId, nsString id, PPropertyDescriptor descriptor) returns (ReturnStatus rs);
rpc Delete(uint64_t objId, nsString id) returns (ReturnStatus rs, bool successful);

View File

@ -515,7 +515,7 @@ jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* nameStr)
if(!JS_WrapId(cx, &id))
return nullptr;
if(!JS_GetOwnPropertyDescriptorById(cx, obj, id, 0, &desc))
if(!JS_GetOwnPropertyDescriptorById(cx, obj, id, &desc))
return nullptr;
if(!desc.object())
return nullptr;

View File

@ -442,7 +442,7 @@ obj_lookupGetter(JSContext *cx, unsigned argc, Value *vp)
// native. Handle proxies separately.
args.rval().setUndefined();
Rooted<PropertyDescriptor> desc(cx);
if (!Proxy::getPropertyDescriptor(cx, obj, id, &desc, 0))
if (!Proxy::getPropertyDescriptor(cx, obj, id, &desc))
return false;
if (desc.object() && desc.hasGetterObject() && desc.getterObject())
args.rval().setObject(*desc.getterObject());
@ -478,7 +478,7 @@ obj_lookupSetter(JSContext *cx, unsigned argc, Value *vp)
// native. Handle proxies separately.
args.rval().setUndefined();
Rooted<PropertyDescriptor> desc(cx);
if (!Proxy::getPropertyDescriptor(cx, obj, id, &desc, 0))
if (!Proxy::getPropertyDescriptor(cx, obj, id, &desc))
return false;
if (desc.object() && desc.hasSetterObject() && desc.setterObject())
args.rval().setObject(*desc.setterObject());

View File

@ -163,7 +163,7 @@ GetDataProperty(JSContext *cx, HandleValue objVal, HandlePropertyName field, Mut
Rooted<JSPropertyDescriptor> desc(cx);
RootedObject obj(cx, &objVal.toObject());
RootedId id(cx, NameToId(field));
if (!JS_GetPropertyDescriptorById(cx, obj, id, 0, &desc))
if (!JS_GetPropertyDescriptorById(cx, obj, id, &desc))
return false;
if (!desc.object())

View File

@ -46,7 +46,7 @@ BEGIN_TEST(testDefineGetterSetterNonEnumerable)
JS_DATA_TO_FUNC_PTR(JSStrictPropertyOp, (JSObject*) funSetObj)));
JS::Rooted<JSPropertyDescriptor> desc(cx);
CHECK(JS_GetOwnPropertyDescriptor(cx, vObject, PROPERTY_NAME, 0, &desc));
CHECK(JS_GetOwnPropertyDescriptor(cx, vObject, PROPERTY_NAME, &desc));
CHECK(desc.object());
CHECK(desc.hasGetterObject());
CHECK(desc.hasSetterObject());

View File

@ -2705,7 +2705,7 @@ LookupResult(JSContext *cx, HandleObject obj, HandleObject obj2, HandleId id,
if (!obj2->isNative()) {
if (obj2->is<ProxyObject>()) {
Rooted<PropertyDescriptor> desc(cx);
if (!Proxy::getPropertyDescriptor(cx, obj2, id, &desc, 0))
if (!Proxy::getPropertyDescriptor(cx, obj2, id, &desc))
return false;
if (!desc.isShared()) {
vp.set(desc.value());
@ -3295,17 +3295,17 @@ JS_DefineProperties(JSContext *cx, HandleObject obj, const JSPropertySpec *ps)
}
static bool
GetPropertyDescriptorById(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
bool own, MutableHandle<PropertyDescriptor> desc)
GetPropertyDescriptorById(JSContext *cx, HandleObject obj, HandleId id,
MutableHandle<PropertyDescriptor> desc)
{
RootedObject obj2(cx);
RootedShape shape(cx);
if (!LookupPropertyById(cx, obj, id, flags, &obj2, &shape))
if (!LookupPropertyById(cx, obj, id, 0, &obj2, &shape))
return false;
desc.clear();
if (!shape || (own && obj != obj2))
if (!shape)
return true;
desc.object().set(obj2);
@ -3323,10 +3323,8 @@ GetPropertyDescriptorById(JSContext *cx, HandleObject obj, HandleId id, unsigned
}
} else {
if (obj2->is<ProxyObject>()) {
JSAutoResolveFlags rf(cx, flags);
return own
? Proxy::getOwnPropertyDescriptor(cx, obj2, id, desc, 0)
: Proxy::getPropertyDescriptor(cx, obj2, id, desc, 0);
JSAutoResolveFlags rf(cx, 0);
return Proxy::getPropertyDescriptor(cx, obj2, id, desc);
}
if (!JSObject::getGenericAttributes(cx, obj2, id, &desc.attributesRef()))
return false;
@ -3338,42 +3336,42 @@ GetPropertyDescriptorById(JSContext *cx, HandleObject obj, HandleId id, unsigned
}
JS_PUBLIC_API(bool)
JS_GetOwnPropertyDescriptorById(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
JS_GetOwnPropertyDescriptorById(JSContext *cx, HandleObject obj, HandleId id,
MutableHandle<JSPropertyDescriptor> desc)
{
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
return GetPropertyDescriptorById(cx, obj, id, flags, true, desc);
return GetOwnPropertyDescriptor(cx, obj, id, desc);
}
JS_PUBLIC_API(bool)
JS_GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, const char *name, unsigned flags,
JS_GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, const char *name,
MutableHandle<JSPropertyDescriptor> desc)
{
JSAtom *atom = Atomize(cx, name, strlen(name));
if (!atom)
return false;
RootedId id(cx, AtomToId(atom));
return JS_GetOwnPropertyDescriptorById(cx, obj, id, flags, desc);
return JS_GetOwnPropertyDescriptorById(cx, obj, id, desc);
}
JS_PUBLIC_API(bool)
JS_GetPropertyDescriptorById(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
JS_GetPropertyDescriptorById(JSContext *cx, HandleObject obj, HandleId id,
MutableHandle<JSPropertyDescriptor> desc)
{
return GetPropertyDescriptorById(cx, obj, id, flags, false, desc);
return GetPropertyDescriptorById(cx, obj, id, desc);
}
JS_PUBLIC_API(bool)
JS_GetPropertyDescriptor(JSContext *cx, HandleObject obj, const char *name, unsigned flags,
JS_GetPropertyDescriptor(JSContext *cx, HandleObject obj, const char *name,
MutableHandle<JSPropertyDescriptor> desc)
{
JSAtom *atom = Atomize(cx, name, strlen(name));
if (!atom)
return false;
RootedId id(cx, AtomToId(atom));
return atom && JS_GetPropertyDescriptorById(cx, obj, id, flags, desc);
return atom && JS_GetPropertyDescriptorById(cx, obj, id, desc);
}
JS_PUBLIC_API(bool)

View File

@ -3022,10 +3022,10 @@ class MutableHandleBase<JSPropertyDescriptor>
extern JS_PUBLIC_API(bool)
JS_GetOwnPropertyDescriptorById(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
unsigned flags, JS::MutableHandle<JSPropertyDescriptor> desc);
JS::MutableHandle<JSPropertyDescriptor> desc);
extern JS_PUBLIC_API(bool)
JS_GetOwnPropertyDescriptor(JSContext *cx, JS::HandleObject obj, const char *name, unsigned flags,
JS_GetOwnPropertyDescriptor(JSContext *cx, JS::HandleObject obj, const char *name,
JS::MutableHandle<JSPropertyDescriptor> desc);
/*
@ -3034,11 +3034,11 @@ JS_GetOwnPropertyDescriptor(JSContext *cx, JS::HandleObject obj, const char *nam
* then this property was not found on the prototype chain.
*/
extern JS_PUBLIC_API(bool)
JS_GetPropertyDescriptorById(JSContext *cx, JS::HandleObject obj, JS::HandleId id, unsigned flags,
JS_GetPropertyDescriptorById(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc);
extern JS_PUBLIC_API(bool)
JS_GetPropertyDescriptor(JSContext *cx, JS::HandleObject obj, const char *name, unsigned flags,
JS_GetPropertyDescriptor(JSContext *cx, JS::HandleObject obj, const char *name,
JS::MutableHandle<JSPropertyDescriptor> desc);
extern JS_PUBLIC_API(bool)

View File

@ -220,7 +220,7 @@ js::GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id,
{
// FIXME: Call TrapGetOwnProperty directly once ScriptedIndirectProxies is removed
if (obj->is<ProxyObject>())
return Proxy::getOwnPropertyDescriptor(cx, obj, id, desc, 0);
return Proxy::getOwnPropertyDescriptor(cx, obj, id, desc);
RootedObject pobj(cx);
RootedShape shape(cx);
@ -4891,7 +4891,7 @@ baseops::SetPropertyHelper(typename ExecutionModeTraits<mode>::ContextType cxArg
JSContext *cx = cxArg->asJSContext();
Rooted<PropertyDescriptor> pd(cx);
if (!Proxy::getPropertyDescriptor(cx, pobj, id, &pd, 0))
if (!Proxy::getPropertyDescriptor(cx, pobj, id, &pd))
return false;
if ((pd.attributes() & (JSPROP_SHARED | JSPROP_SHADOWABLE)) == JSPROP_SHARED) {

View File

@ -103,7 +103,7 @@ BaseProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp)
{
assertEnteredPolicy(cx, proxy, id, GET);
Rooted<PropertyDescriptor> desc(cx);
if (!getPropertyDescriptor(cx, proxy, id, &desc, 0))
if (!getPropertyDescriptor(cx, proxy, id, &desc))
return false;
*bp = !!desc.object();
return true;
@ -116,7 +116,7 @@ BaseProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *b
// lives, so we allow SET operations to invoke us.
assertEnteredPolicy(cx, proxy, id, GET | SET);
Rooted<PropertyDescriptor> desc(cx);
if (!getOwnPropertyDescriptor(cx, proxy, id, &desc, 0))
if (!getOwnPropertyDescriptor(cx, proxy, id, &desc))
return false;
*bp = !!desc.object();
return true;
@ -129,7 +129,7 @@ BaseProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver,
assertEnteredPolicy(cx, proxy, id, GET);
Rooted<PropertyDescriptor> desc(cx);
if (!getPropertyDescriptor(cx, proxy, id, &desc, 0))
if (!getPropertyDescriptor(cx, proxy, id, &desc))
return false;
if (!desc.object()) {
vp.setUndefined();
@ -159,7 +159,7 @@ BaseProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver,
assertEnteredPolicy(cx, proxy, id, SET);
Rooted<PropertyDescriptor> desc(cx);
if (!getOwnPropertyDescriptor(cx, proxy, id, &desc, 0))
if (!getOwnPropertyDescriptor(cx, proxy, id, &desc))
return false;
/* The control-flow here differs from ::get() because of the fall-through case below. */
if (desc.object()) {
@ -187,7 +187,7 @@ BaseProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver,
desc.value().set(vp.get());
return defineProperty(cx, receiver, id, &desc);
}
if (!getPropertyDescriptor(cx, proxy, id, &desc, 0))
if (!getPropertyDescriptor(cx, proxy, id, &desc))
return false;
if (desc.object()) {
// Check for read-only properties.
@ -240,7 +240,7 @@ BaseProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props)
JS_ASSERT(i <= j);
id = props[j];
AutoWaivePolicy policy(cx, proxy, id, BaseProxyHandler::GET);
if (!getOwnPropertyDescriptor(cx, proxy, id, &desc, 0))
if (!getOwnPropertyDescriptor(cx, proxy, id, &desc))
return false;
if (desc.object() && desc.isEnumerable())
props[i++] = id;
@ -385,38 +385,21 @@ BaseProxyHandler::slice(JSContext *cx, HandleObject proxy, uint32_t begin, uint3
bool
DirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<PropertyDescriptor> desc, unsigned flags)
MutableHandle<PropertyDescriptor> desc)
{
assertEnteredPolicy(cx, proxy, id, GET | SET);
JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype.
RootedObject target(cx, proxy->as<ProxyObject>().target());
return JS_GetPropertyDescriptorById(cx, target, id, 0, desc);
}
static bool
GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
MutableHandle<PropertyDescriptor> desc)
{
// If obj is a proxy, we can do better than just guessing. This is
// important for certain types of wrappers that wrap other wrappers.
if (obj->is<ProxyObject>())
return Proxy::getOwnPropertyDescriptor(cx, obj, id, desc, flags);
if (!JS_GetPropertyDescriptorById(cx, obj, id, flags, desc))
return false;
if (desc.object() != obj)
desc.object().set(nullptr);
return true;
return JS_GetPropertyDescriptorById(cx, target, id, desc);
}
bool
DirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy,
HandleId id, MutableHandle<PropertyDescriptor> desc,
unsigned flags)
DirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<PropertyDescriptor> desc)
{
assertEnteredPolicy(cx, proxy, id, GET | SET);
RootedObject target(cx, proxy->as<ProxyObject>().target());
return GetOwnPropertyDescriptor(cx, target, id, 0, desc);
return js::GetOwnPropertyDescriptor(cx, target, id, desc);
}
bool
@ -578,7 +561,7 @@ DirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool
assertEnteredPolicy(cx, proxy, id, GET | SET);
RootedObject target(cx, proxy->as<ProxyObject>().target());
Rooted<PropertyDescriptor> desc(cx);
if (!JS_GetPropertyDescriptorById(cx, target, id, 0, &desc))
if (!JS_GetPropertyDescriptorById(cx, target, id, &desc))
return false;
*bp = (desc.object() == target);
return true;
@ -764,11 +747,9 @@ class ScriptedIndirectProxyHandler : public BaseProxyHandler
/* ES5 Harmony fundamental proxy traps. */
virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE;
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<PropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
MutableHandle<PropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<PropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
MutableHandle<PropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<PropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props);
@ -866,8 +847,7 @@ GetIndirectProxyHandlerObject(JSObject *proxy)
bool
ScriptedIndirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<PropertyDescriptor> desc,
unsigned flags)
MutableHandle<PropertyDescriptor> desc)
{
RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy));
RootedValue fval(cx), value(cx);
@ -880,8 +860,7 @@ ScriptedIndirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject
bool
ScriptedIndirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<PropertyDescriptor> desc,
unsigned flags)
MutableHandle<PropertyDescriptor> desc)
{
RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy));
RootedValue fval(cx), value(cx);
@ -1086,11 +1065,9 @@ class ScriptedDirectProxyHandler : public DirectProxyHandler {
/* ES5 Harmony fundamental proxy traps. */
virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE;
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<PropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
MutableHandle<PropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<PropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
MutableHandle<PropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<PropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props);
@ -1230,7 +1207,7 @@ ValidateProperty(JSContext *cx, HandleObject obj, HandleId id, PropDesc *desc, b
{
// step 1
Rooted<PropertyDescriptor> current(cx);
if (!GetOwnPropertyDescriptor(cx, obj, id, 0, &current))
if (!GetOwnPropertyDescriptor(cx, obj, id, &current))
return false;
/*
@ -1333,7 +1310,7 @@ IsSealed(JSContext* cx, HandleObject obj, HandleId id, bool *bp)
{
// step 1
Rooted<PropertyDescriptor> desc(cx);
if (!GetOwnPropertyDescriptor(cx, obj, id, 0, &desc))
if (!GetOwnPropertyDescriptor(cx, obj, id, &desc))
return false;
// steps 2-3
@ -1345,7 +1322,7 @@ static bool
HasOwn(JSContext *cx, HandleObject obj, HandleId id, bool *bp)
{
Rooted<PropertyDescriptor> desc(cx);
if (!JS_GetPropertyDescriptorById(cx, obj, id, 0, &desc))
if (!JS_GetPropertyDescriptorById(cx, obj, id, &desc))
return false;
*bp = (desc.object() == obj);
return true;
@ -1734,8 +1711,7 @@ ScriptedDirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy)
// FIXME: Move to Proxy::getPropertyDescriptor once ScriptedIndirectProxy is removed
bool
ScriptedDirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<PropertyDescriptor> desc,
unsigned flags)
MutableHandle<PropertyDescriptor> desc)
{
JS_CHECK_RECURSION(cx, return false);
@ -1750,13 +1726,12 @@ ScriptedDirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject pr
JS_ASSERT(!desc.object());
return true;
}
return JS_GetPropertyDescriptorById(cx, proto, id, 0, desc);
return JS_GetPropertyDescriptorById(cx, proto, id, desc);
}
bool
ScriptedDirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<PropertyDescriptor> desc,
unsigned flags)
MutableHandle<PropertyDescriptor> desc)
{
// step 1
RootedValue v(cx);
@ -2372,7 +2347,7 @@ ScriptedDirectProxyHandler ScriptedDirectProxyHandler::singleton;
bool
Proxy::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<PropertyDescriptor> desc, unsigned flags)
MutableHandle<PropertyDescriptor> desc)
{
JS_CHECK_RECURSION(cx, return false);
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
@ -2381,29 +2356,28 @@ Proxy::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
if (!policy.allowed())
return policy.returnValue();
if (!handler->hasPrototype())
return handler->getPropertyDescriptor(cx, proxy, id, desc, flags);
if (!handler->getOwnPropertyDescriptor(cx, proxy, id, desc, flags))
return handler->getPropertyDescriptor(cx, proxy, id, desc);
if (!handler->getOwnPropertyDescriptor(cx, proxy, id, desc))
return false;
if (desc.object())
return true;
INVOKE_ON_PROTOTYPE(cx, handler, proxy, JS_GetPropertyDescriptorById(cx, proto, id, 0, desc));
INVOKE_ON_PROTOTYPE(cx, handler, proxy, JS_GetPropertyDescriptorById(cx, proto, id, desc));
}
bool
Proxy::getPropertyDescriptor(JSContext *cx, HandleObject proxy, unsigned flags,
HandleId id, MutableHandleValue vp)
Proxy::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, MutableHandleValue vp)
{
JS_CHECK_RECURSION(cx, return false);
Rooted<PropertyDescriptor> desc(cx);
if (!Proxy::getPropertyDescriptor(cx, proxy, id, &desc, flags))
if (!Proxy::getPropertyDescriptor(cx, proxy, id, &desc))
return false;
return NewPropertyDescriptorObject(cx, desc, vp);
}
bool
Proxy::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<PropertyDescriptor> desc, unsigned flags)
MutableHandle<PropertyDescriptor> desc)
{
JS_CHECK_RECURSION(cx, return false);
@ -2412,17 +2386,17 @@ Proxy::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true);
if (!policy.allowed())
return policy.returnValue();
return handler->getOwnPropertyDescriptor(cx, proxy, id, desc, flags);
return handler->getOwnPropertyDescriptor(cx, proxy, id, desc);
}
bool
Proxy::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, unsigned flags, HandleId id,
Proxy::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandleValue vp)
{
JS_CHECK_RECURSION(cx, return false);
Rooted<PropertyDescriptor> desc(cx);
if (!Proxy::getOwnPropertyDescriptor(cx, proxy, id, &desc, flags))
if (!Proxy::getOwnPropertyDescriptor(cx, proxy, id, &desc))
return false;
return NewPropertyDescriptorObject(cx, desc, vp);
}
@ -2601,7 +2575,7 @@ Proxy::set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id
// If we have an existing (own or non-own) property with a setter, we want
// to invoke that.
Rooted<PropertyDescriptor> desc(cx);
if (!Proxy::getPropertyDescriptor(cx, proxy, id, &desc, 0))
if (!Proxy::getPropertyDescriptor(cx, proxy, id, &desc))
return false;
if (desc.object() && desc.setter() && desc.setter() != JS_StrictPropertyStub)
return CallSetter(cx, receiver, id, desc.setter(), desc.attributes(), strict, vp);
@ -2958,7 +2932,7 @@ bool
js::proxy_GetGenericAttributes(JSContext *cx, HandleObject obj, HandleId id, unsigned *attrsp)
{
Rooted<PropertyDescriptor> desc(cx);
if (!Proxy::getOwnPropertyDescriptor(cx, obj, id, &desc, 0))
if (!Proxy::getOwnPropertyDescriptor(cx, obj, id, &desc))
return false;
*attrsp = desc.attributes();
return true;
@ -2969,7 +2943,7 @@ js::proxy_SetGenericAttributes(JSContext *cx, HandleObject obj, HandleId id, uns
{
/* Lookup the current property descriptor so we have setter/getter/value. */
Rooted<PropertyDescriptor> desc(cx);
if (!Proxy::getOwnPropertyDescriptor(cx, obj, id, &desc, 0))
if (!Proxy::getOwnPropertyDescriptor(cx, obj, id, &desc))
return false;
desc.setAttributes(*attrsp);
return Proxy::defineProperty(cx, obj, id, &desc);

View File

@ -178,11 +178,9 @@ class JS_FRIEND_API(BaseProxyHandler)
/* ES5 Harmony fundamental proxy traps. */
virtual bool preventExtensions(JSContext *cx, HandleObject proxy) = 0;
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) = 0;
MutableHandle<JSPropertyDescriptor> desc) = 0;
virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy,
HandleId id, MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) = 0;
HandleId id, MutableHandle<JSPropertyDescriptor> desc) = 0;
virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) = 0;
virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy,
@ -248,10 +246,9 @@ class JS_PUBLIC_API(DirectProxyHandler) : public BaseProxyHandler
/* ES5 Harmony fundamental proxy traps. */
virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE;
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<JSPropertyDescriptor> desc, unsigned flags) MOZ_OVERRIDE;
virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy,
HandleId id, MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy,
@ -308,12 +305,12 @@ class Proxy
/* ES5 Harmony fundamental proxy traps. */
static bool preventExtensions(JSContext *cx, HandleObject proxy);
static bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<JSPropertyDescriptor> desc, unsigned flags);
static bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, unsigned flags, HandleId id,
MutableHandle<JSPropertyDescriptor> desc);
static bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandleValue vp);
static bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<JSPropertyDescriptor> desc, unsigned flags);
static bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, unsigned flags, HandleId id,
MutableHandle<JSPropertyDescriptor> desc);
static bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandleValue vp);
static bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<JSPropertyDescriptor> desc);

View File

@ -230,24 +230,23 @@ CrossCompartmentWrapper::preventExtensions(JSContext *cx, HandleObject wrapper)
bool
CrossCompartmentWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
MutableHandle<PropertyDescriptor> desc, unsigned flags)
MutableHandle<PropertyDescriptor> desc)
{
RootedId idCopy(cx, id);
PIERCE(cx, wrapper,
cx->compartment()->wrapId(cx, idCopy.address()),
Wrapper::getPropertyDescriptor(cx, wrapper, idCopy, desc, flags),
Wrapper::getPropertyDescriptor(cx, wrapper, idCopy, desc),
cx->compartment()->wrap(cx, desc));
}
bool
CrossCompartmentWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper,
HandleId id, MutableHandle<PropertyDescriptor> desc,
unsigned flags)
CrossCompartmentWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
MutableHandle<PropertyDescriptor> desc)
{
RootedId idCopy(cx, id);
PIERCE(cx, wrapper,
cx->compartment()->wrapId(cx, idCopy.address()),
Wrapper::getOwnPropertyDescriptor(cx, wrapper, idCopy, desc, flags),
Wrapper::getOwnPropertyDescriptor(cx, wrapper, idCopy, desc),
cx->compartment()->wrap(cx, desc));
}
@ -756,7 +755,7 @@ DeadObjectProxy::preventExtensions(JSContext *cx, HandleObject proxy)
bool
DeadObjectProxy::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
MutableHandle<PropertyDescriptor> desc, unsigned flags)
MutableHandle<PropertyDescriptor> desc)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
return false;
@ -764,7 +763,7 @@ DeadObjectProxy::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, Hand
bool
DeadObjectProxy::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
MutableHandle<PropertyDescriptor> desc, unsigned flags)
MutableHandle<PropertyDescriptor> desc)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
return false;

View File

@ -110,11 +110,9 @@ class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper
/* ES5 Harmony fundamental wrapper traps. */
virtual bool preventExtensions(JSContext *cx, HandleObject wrapper) MOZ_OVERRIDE;
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyNames(JSContext *cx, HandleObject wrapper,
@ -214,11 +212,9 @@ class JS_FRIEND_API(DeadObjectProxy) : public BaseProxyHandler
/* ES5 Harmony fundamental wrapper traps. */
virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE;
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id,
MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyNames(JSContext *cx, HandleObject wrapper,

View File

@ -3034,7 +3034,7 @@ CopyProperty(JSContext *cx, HandleObject obj, HandleObject referent, HandleId id
if (!desc.setter() && !desc.hasSetterObject())
desc.setSetter(JS_StrictPropertyStub);
} else if (referent->is<ProxyObject>()) {
if (!Proxy::getOwnPropertyDescriptor(cx, referent, id, &desc, 0))
if (!Proxy::getOwnPropertyDescriptor(cx, referent, id, &desc))
return false;
if (!desc.object())
return true;

View File

@ -1325,15 +1325,13 @@ class DebugScopeProxy : public BaseProxyHandler
}
bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<PropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE
MutableHandle<PropertyDescriptor> desc) MOZ_OVERRIDE
{
return getOwnPropertyDescriptor(cx, proxy, id, desc, flags);
return getOwnPropertyDescriptor(cx, proxy, id, desc);
}
bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
MutableHandle<PropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE
MutableHandle<PropertyDescriptor> desc) MOZ_OVERRIDE
{
Rooted<DebugScopeObject*> debugScope(cx, &proxy->as<DebugScopeObject>());
Rooted<ScopeObject*> scope(cx, &debugScope->scope());
@ -1361,7 +1359,7 @@ class DebugScopeProxy : public BaseProxyHandler
return true;
}
return JS_GetOwnPropertyDescriptorById(cx, scope, id, flags, desc);
return JS_GetOwnPropertyDescriptorById(cx, scope, id, desc);
}
bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id,

View File

@ -857,14 +857,12 @@ bool
xpc::SandboxProxyHandler::getPropertyDescriptor(JSContext *cx,
JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags)
JS::MutableHandle<JSPropertyDescriptor> desc)
{
JS::RootedObject obj(cx, wrappedObject(proxy));
MOZ_ASSERT(js::GetObjectCompartment(obj) == js::GetObjectCompartment(proxy));
if (!JS_GetPropertyDescriptorById(cx, obj, id,
flags, desc))
if (!JS_GetPropertyDescriptorById(cx, obj, id, desc))
return false;
if (!desc.object())
@ -905,10 +903,9 @@ bool
xpc::SandboxProxyHandler::getOwnPropertyDescriptor(JSContext *cx,
JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags)
JS::MutableHandle<JSPropertyDescriptor> desc)
{
if (!getPropertyDescriptor(cx, proxy, id, desc, flags))
if (!getPropertyDescriptor(cx, proxy, id, desc))
return false;
if (desc.object() != wrappedObject(proxy))

View File

@ -297,7 +297,7 @@ ExposedPropertiesOnly::check(JSContext *cx, JSObject *wrapperArg, jsid idArg, Wr
Access access = NO_ACCESS;
Rooted<JSPropertyDescriptor> desc(cx);
if (!JS_GetPropertyDescriptorById(cx, hallpass, id, 0, &desc)) {
if (!JS_GetPropertyDescriptorById(cx, hallpass, id, &desc)) {
return false; // Error
}
if (!desc.object() || !desc.isEnumerable())

View File

@ -52,7 +52,7 @@ PropIsFromStandardPrototype(JSContext *cx, HandleObject wrapper,
Rooted<JSPropertyDescriptor> desc(cx);
ChromeObjectWrapper *handler = &ChromeObjectWrapper::singleton;
if (!handler->ChromeObjectWrapperBase::getPropertyDescriptor(cx, wrapper, id,
&desc, 0) ||
&desc) ||
!desc.object())
{
return false;
@ -64,15 +64,14 @@ bool
ChromeObjectWrapper::getPropertyDescriptor(JSContext *cx,
HandleObject wrapper,
HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags)
JS::MutableHandle<JSPropertyDescriptor> desc)
{
assertEnteredPolicy(cx, wrapper, id, GET | SET);
// First, try a lookup on the base wrapper if permitted.
desc.object().set(nullptr);
if (AllowedByBase(cx, wrapper, id, Wrapper::GET) &&
!ChromeObjectWrapperBase::getPropertyDescriptor(cx, wrapper, id,
desc, flags)) {
desc)) {
return false;
}
@ -91,7 +90,7 @@ ChromeObjectWrapper::getPropertyDescriptor(JSContext *cx,
// If not, try doing the lookup on the prototype.
MOZ_ASSERT(js::IsObjectInContextCompartment(wrapper, cx));
return JS_GetPropertyDescriptorById(cx, wrapperProto, id, 0, desc);
return JS_GetPropertyDescriptorById(cx, wrapperProto, id, desc);
}
bool
@ -116,7 +115,7 @@ ChromeObjectWrapper::has(JSContext *cx, HandleObject wrapper,
// Try the prototype if that failed.
MOZ_ASSERT(js::IsObjectInContextCompartment(wrapper, cx));
Rooted<JSPropertyDescriptor> desc(cx);
if (!JS_GetPropertyDescriptorById(cx, wrapperProto, id, 0, &desc))
if (!JS_GetPropertyDescriptorById(cx, wrapperProto, id, &desc))
return false;
*bp = !!desc.object();
return true;

View File

@ -32,8 +32,7 @@ class ChromeObjectWrapper : public ChromeObjectWrapperBase
/* Custom traps. */
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
JS::MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool has(JSContext *cx, JS::Handle<JSObject*> wrapper,
JS::Handle<jsid> id, bool *bp) MOZ_OVERRIDE;
virtual bool get(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<JSObject*> receiver,

View File

@ -60,11 +60,10 @@ template <typename Base, typename Policy>
bool
FilteringWrapper<Base, Policy>::getPropertyDescriptor(JSContext *cx, HandleObject wrapper,
HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags)
JS::MutableHandle<JSPropertyDescriptor> desc)
{
assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::GET | BaseProxyHandler::SET);
if (!Base::getPropertyDescriptor(cx, wrapper, id, desc, flags))
if (!Base::getPropertyDescriptor(cx, wrapper, id, desc))
return false;
return FilterSetter<Policy>(cx, wrapper, id, desc);
}
@ -73,11 +72,10 @@ template <typename Base, typename Policy>
bool
FilteringWrapper<Base, Policy>::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper,
HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags)
JS::MutableHandle<JSPropertyDescriptor> desc)
{
assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::GET | BaseProxyHandler::SET);
if (!Base::getOwnPropertyDescriptor(cx, wrapper, id, desc, flags))
if (!Base::getOwnPropertyDescriptor(cx, wrapper, id, desc))
return false;
return FilterSetter<Policy>(cx, wrapper, id, desc);
}

View File

@ -28,12 +28,10 @@ class FilteringWrapper : public Base {
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
JS::MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
JS::MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyNames(JSContext *cx, JS::Handle<JSObject*> wrapper,
JS::AutoIdVector &props) MOZ_OVERRIDE;
virtual bool enumerate(JSContext *cx, JS::Handle<JSObject*> wrapper,

View File

@ -42,19 +42,17 @@ WaiveXrayWrapper::~WaiveXrayWrapper()
bool
WaiveXrayWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper,
HandleId id, JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags)
HandleId id, JS::MutableHandle<JSPropertyDescriptor> desc)
{
return CrossCompartmentWrapper::getPropertyDescriptor(cx, wrapper, id, desc, flags) &&
return CrossCompartmentWrapper::getPropertyDescriptor(cx, wrapper, id, desc) &&
WrapperFactory::WaiveXrayAndWrap(cx, desc.value()) && WaiveAccessors(cx, desc);
}
bool
WaiveXrayWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper,
HandleId id, JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags)
HandleId id, JS::MutableHandle<JSPropertyDescriptor> desc)
{
return CrossCompartmentWrapper::getOwnPropertyDescriptor(cx, wrapper, id, desc, flags) &&
return CrossCompartmentWrapper::getOwnPropertyDescriptor(cx, wrapper, id, desc) &&
WrapperFactory::WaiveXrayAndWrap(cx, desc.value()) && WaiveAccessors(cx, desc);
}

View File

@ -21,12 +21,10 @@ class WaiveXrayWrapper : public js::CrossCompartmentWrapper {
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
JS::MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
JS::MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool get(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<JSObject*> receiver,
JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp) MOZ_OVERRIDE;

View File

@ -415,7 +415,7 @@ JSXrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper,
// muddles through by only checking the holder for non-|own| lookups, but
// that doesn't work for us. So we do an explicit holder check here, and hope
// that this mess gets fixed up soon.
if (!JS_GetPropertyDescriptorById(cx, holder, id, 0, desc))
if (!JS_GetPropertyDescriptorById(cx, holder, id, desc))
return false;
if (desc.object()) {
desc.object().set(wrapper);
@ -482,7 +482,7 @@ JSXrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper,
return JS_DefinePropertyById(cx, holder, id,
ObjectValue(*JS_GetFunctionObject(fun)),
nullptr, nullptr, 0) &&
JS_GetPropertyDescriptorById(cx, holder, id, 0, desc);
JS_GetPropertyDescriptorById(cx, holder, id, desc);
}
bool
@ -952,7 +952,7 @@ XPCWrappedNativeXrayTraits::resolveDOMCollectionProperty(JSContext *cx, HandleOb
return false;
}
if (pobj && !JS_GetPropertyDescriptorById(cx, holder, id, 0, desc))
if (pobj && !JS_GetPropertyDescriptorById(cx, holder, id, desc))
return false;
return true;
@ -1138,7 +1138,7 @@ XrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper,
bool found = false;
if (expando) {
JSAutoCompartment ac(cx, expando);
if (!JS_GetPropertyDescriptorById(cx, expando, id, 0, desc))
if (!JS_GetPropertyDescriptorById(cx, expando, id, desc))
return false;
found = !!desc.object();
}
@ -1184,7 +1184,7 @@ XrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper,
JSPROP_ENUMERATE | JSPROP_SHARED)) {
return false;
}
if (!JS_GetPropertyDescriptorById(cx, holder, id, 0, desc))
if (!JS_GetPropertyDescriptorById(cx, holder, id, desc))
return false;
desc.object().set(wrapper);
return true;
@ -1280,7 +1280,7 @@ XPCWrappedNativeXrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper
// return non-|own| properties from Object.getOwnPropertyDescriptor if
// lookups are performed in a certain order, but we can probably live with
// that until XPCWN Xrays go away with the new DOM bindings.
return JS_GetPropertyDescriptorById(cx, holder, id, 0, desc);
return JS_GetPropertyDescriptorById(cx, holder, id, desc);
}
bool
@ -1778,8 +1778,7 @@ XrayWrapper<Base, Traits>::preventExtensions(JSContext *cx, HandleObject wrapper
template <typename Base, typename Traits>
bool
XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags)
JS::MutableHandle<JSPropertyDescriptor> desc)
{
assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::GET | BaseProxyHandler::SET);
RootedObject holder(cx, Traits::singleton.ensureHolder(cx, wrapper));
@ -1813,11 +1812,11 @@ XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, HandleObject wra
// and unconditionally caches what it finds on the holder.
// Check resolveOwnProperty.
if (!Traits::singleton.resolveOwnProperty(cx, *this, wrapper, holder, id, desc, flags))
if (!Traits::singleton.resolveOwnProperty(cx, *this, wrapper, holder, id, desc, 0))
return false;
// Check the holder.
if (!desc.object() && !JS_GetPropertyDescriptorById(cx, holder, id, 0, desc))
if (!desc.object() && !JS_GetPropertyDescriptorById(cx, holder, id, desc))
return false;
if (desc.object()) {
desc.object().set(wrapper);
@ -1825,7 +1824,7 @@ XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, HandleObject wra
}
// Nothing in the cache. Call through, and cache the result.
if (!Traits::singleton.resolveNativeProperty(cx, wrapper, holder, id, desc, flags))
if (!Traits::singleton.resolveNativeProperty(cx, wrapper, holder, id, desc, 0))
return false;
// We need to handle named access on the Window somewhere other than
@ -1897,7 +1896,7 @@ XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, HandleObject wra
if (!JS_DefinePropertyById(cx, holder, id, desc.value(), desc.getter(),
desc.setter(), desc.attributes()) ||
!JS_GetPropertyDescriptorById(cx, holder, id, flags, desc))
!JS_GetPropertyDescriptorById(cx, holder, id, desc))
{
return false;
}
@ -1909,8 +1908,7 @@ XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, HandleObject wra
template <typename Base, typename Traits>
bool
XrayWrapper<Base, Traits>::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags)
JS::MutableHandle<JSPropertyDescriptor> desc)
{
assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::GET | BaseProxyHandler::SET);
RootedObject holder(cx, Traits::singleton.ensureHolder(cx, wrapper));
@ -1924,7 +1922,7 @@ XrayWrapper<Base, Traits>::getOwnPropertyDescriptor(JSContext *cx, HandleObject
// NB: Nothing we do here acts on the wrapped native itself, so we don't
// enter our policy.
if (!Traits::singleton.resolveOwnProperty(cx, *this, wrapper, holder, id, desc, flags))
if (!Traits::singleton.resolveOwnProperty(cx, *this, wrapper, holder, id, desc, 0))
return false;
if (desc.object())
desc.object().set(wrapper);
@ -1996,7 +1994,7 @@ XrayWrapper<Base, Traits>::defineProperty(JSContext *cx, HandleObject wrapper,
assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::SET);
Rooted<JSPropertyDescriptor> existing_desc(cx);
if (!getOwnPropertyDescriptor(cx, wrapper, id, &existing_desc, 0))
if (!getOwnPropertyDescriptor(cx, wrapper, id, &existing_desc))
return false;
if (existing_desc.object() && existing_desc.isPermanent())

View File

@ -73,10 +73,9 @@ class XrayWrapper : public Base {
virtual bool isExtensible(JSContext *cx, JS::Handle<JSObject*> wrapper, bool *extensible) MOZ_OVERRIDE;
virtual bool preventExtensions(JSContext *cx, JS::Handle<JSObject*> wrapper) MOZ_OVERRIDE;
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc, unsigned flags);
JS::MutableHandle<JSPropertyDescriptor> desc);
virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags);
JS::MutableHandle<JSPropertyDescriptor> desc);
virtual bool defineProperty(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc);
virtual bool getOwnPropertyNames(JSContext *cx, JS::Handle<JSObject*> wrapper,
@ -156,12 +155,10 @@ public:
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
JS::MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
JS::MutableHandle<JSPropertyDescriptor> desc) MOZ_OVERRIDE;
// We just forward the derived traps to the BaseProxyHandler versions which
// implement them in terms of the fundamental traps.