mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 903352 - Handlify remaining PropertyDescriptor APIs r=terrence r=bholley r=smaug
This commit is contained in:
parent
6c7d61e401
commit
11678aa48c
@ -194,7 +194,7 @@ public:
|
|||||||
static bool IsImageSrcSetDisabled();
|
static bool IsImageSrcSetDisabled();
|
||||||
|
|
||||||
static bool LookupBindingMember(JSContext* aCx, nsIContent *aContent,
|
static bool LookupBindingMember(JSContext* aCx, nsIContent *aContent,
|
||||||
JS::HandleId aId, JSPropertyDescriptor* aDesc);
|
JS::HandleId aId, JS::MutableHandle<JSPropertyDescriptor> aDesc);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the parent node of aChild crossing document boundaries.
|
* Returns the parent node of aChild crossing document boundaries.
|
||||||
|
@ -1756,7 +1756,7 @@ nsContentUtils::IsImageSrcSetDisabled()
|
|||||||
// static
|
// static
|
||||||
bool
|
bool
|
||||||
nsContentUtils::LookupBindingMember(JSContext* aCx, nsIContent *aContent,
|
nsContentUtils::LookupBindingMember(JSContext* aCx, nsIContent *aContent,
|
||||||
JS::HandleId aId, JSPropertyDescriptor* aDesc)
|
JS::HandleId aId, JS::MutableHandle<JSPropertyDescriptor> aDesc)
|
||||||
{
|
{
|
||||||
nsXBLBinding* binding = aContent->GetXBLBinding();
|
nsXBLBinding* binding = aContent->GetXBLBinding();
|
||||||
if (!binding)
|
if (!binding)
|
||||||
|
@ -1105,10 +1105,10 @@ nsXBLBinding::ResolveAllFields(JSContext *cx, JS::Handle<JSObject*> obj) const
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
nsXBLBinding::LookupMember(JSContext* aCx, JS::HandleId aId,
|
nsXBLBinding::LookupMember(JSContext* aCx, JS::HandleId aId,
|
||||||
JSPropertyDescriptor* aDesc)
|
JS::MutableHandle<JSPropertyDescriptor> aDesc)
|
||||||
{
|
{
|
||||||
// We should never enter this function with a pre-filled property descriptor.
|
// We should never enter this function with a pre-filled property descriptor.
|
||||||
MOZ_ASSERT(!aDesc->obj);
|
MOZ_ASSERT(!aDesc.object());
|
||||||
|
|
||||||
// Get the string as an nsString before doing anything, so we can make
|
// Get the string as an nsString before doing anything, so we can make
|
||||||
// convenient comparisons during our search.
|
// convenient comparisons during our search.
|
||||||
@ -1148,7 +1148,7 @@ nsXBLBinding::LookupMember(JSContext* aCx, JS::HandleId aId,
|
|||||||
bool
|
bool
|
||||||
nsXBLBinding::LookupMemberInternal(JSContext* aCx, nsString& aName,
|
nsXBLBinding::LookupMemberInternal(JSContext* aCx, nsString& aName,
|
||||||
JS::HandleId aNameAsId,
|
JS::HandleId aNameAsId,
|
||||||
JSPropertyDescriptor* aDesc,
|
JS::MutableHandle<JSPropertyDescriptor> aDesc,
|
||||||
JS::Handle<JSObject*> aXBLScope)
|
JS::Handle<JSObject*> aXBLScope)
|
||||||
{
|
{
|
||||||
// First, see if we have a JSClass. If we don't, it means that this binding
|
// First, see if we have a JSClass. If we don't, it means that this binding
|
||||||
@ -1186,7 +1186,7 @@ nsXBLBinding::LookupMemberInternal(JSContext* aCx, nsString& aName,
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (aDesc->obj || !mNextBinding) {
|
if (aDesc.object() || !mNextBinding) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ public:
|
|||||||
* May only be called when XBL code is being run in a separate scope, because
|
* May only be called when XBL code is being run in a separate scope, because
|
||||||
* otherwise we don't have untainted data with which to do a proper lookup.
|
* otherwise we don't have untainted data with which to do a proper lookup.
|
||||||
*/
|
*/
|
||||||
bool LookupMember(JSContext* aCx, JS::HandleId aId, JSPropertyDescriptor* aDesc);
|
bool LookupMember(JSContext* aCx, JS::HandleId aId, JS::MutableHandle<JSPropertyDescriptor> aDesc);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determines whether the binding has a field with the given name.
|
* Determines whether the binding has a field with the given name.
|
||||||
@ -94,7 +94,8 @@ protected:
|
|||||||
* Internal version. Requires that aCx is in appropriate xbl scope.
|
* Internal version. Requires that aCx is in appropriate xbl scope.
|
||||||
*/
|
*/
|
||||||
bool LookupMemberInternal(JSContext* aCx, nsString& aName, JS::HandleId aNameAsId,
|
bool LookupMemberInternal(JSContext* aCx, nsString& aName, JS::HandleId aNameAsId,
|
||||||
JSPropertyDescriptor* aDesc, JS::Handle<JSObject*> aXBLScope);
|
JS::MutableHandle<JSPropertyDescriptor> aDesc,
|
||||||
|
JS::Handle<JSObject*> aXBLScope);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ nsXBLProtoImpl::CompilePrototypeMembers(nsXBLPrototypeBinding* aBinding)
|
|||||||
bool
|
bool
|
||||||
nsXBLProtoImpl::LookupMember(JSContext* aCx, nsString& aName,
|
nsXBLProtoImpl::LookupMember(JSContext* aCx, nsString& aName,
|
||||||
JS::HandleId aNameAsId,
|
JS::HandleId aNameAsId,
|
||||||
JSPropertyDescriptor* aDesc,
|
JS::MutableHandle<JSPropertyDescriptor> aDesc,
|
||||||
JSObject* aClassObject)
|
JSObject* aClassObject)
|
||||||
{
|
{
|
||||||
for (nsXBLProtoImplMember* m = mMembers; m; m = m->GetNext()) {
|
for (nsXBLProtoImplMember* m = mMembers; m; m = m->GetNext()) {
|
||||||
|
@ -46,7 +46,7 @@ public:
|
|||||||
nsresult CompilePrototypeMembers(nsXBLPrototypeBinding* aBinding);
|
nsresult CompilePrototypeMembers(nsXBLPrototypeBinding* aBinding);
|
||||||
|
|
||||||
bool LookupMember(JSContext* aCx, nsString& aName, JS::HandleId aNameAsId,
|
bool LookupMember(JSContext* aCx, nsString& aName, JS::HandleId aNameAsId,
|
||||||
JSPropertyDescriptor* aDesc, JSObject* aClassObject);
|
JS::MutableHandle<JSPropertyDescriptor> aDesc, JSObject* aClassObject);
|
||||||
|
|
||||||
void SetMemberList(nsXBLProtoImplMember* aMemberList)
|
void SetMemberList(nsXBLProtoImplMember* aMemberList)
|
||||||
{
|
{
|
||||||
|
@ -829,7 +829,7 @@ static bool
|
|||||||
XrayResolveAttribute(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
XrayResolveAttribute(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||||
JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
|
JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
|
||||||
const Prefable<const JSPropertySpec>* attributes, jsid* attributeIds,
|
const Prefable<const JSPropertySpec>* attributes, jsid* attributeIds,
|
||||||
const JSPropertySpec* attributeSpecs, JSPropertyDescriptor* desc)
|
const JSPropertySpec* attributeSpecs, JS::MutableHandle<JSPropertyDescriptor> desc)
|
||||||
{
|
{
|
||||||
for (; attributes->specs; ++attributes) {
|
for (; attributes->specs; ++attributes) {
|
||||||
if (attributes->isEnabled(cx, obj)) {
|
if (attributes->isEnabled(cx, obj)) {
|
||||||
@ -842,7 +842,7 @@ XrayResolveAttribute(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||||||
// Because of centralization, we need to make sure we fault in the
|
// Because of centralization, we need to make sure we fault in the
|
||||||
// JitInfos as well. At present, until the JSAPI changes, the easiest
|
// JitInfos as well. At present, until the JSAPI changes, the easiest
|
||||||
// way to do this is wrap them up as functions ourselves.
|
// way to do this is wrap them up as functions ourselves.
|
||||||
desc->attrs = attrSpec.flags & ~JSPROP_NATIVE_ACCESSORS;
|
desc.setAttributes(attrSpec.flags & ~JSPROP_NATIVE_ACCESSORS);
|
||||||
// They all have getters, so we can just make it.
|
// They all have getters, so we can just make it.
|
||||||
JS::Rooted<JSObject*> global(cx, JS_GetGlobalForObject(cx, wrapper));
|
JS::Rooted<JSObject*> global(cx, JS_GetGlobalForObject(cx, wrapper));
|
||||||
JS::Rooted<JSFunction*> fun(cx,
|
JS::Rooted<JSFunction*> fun(cx,
|
||||||
@ -852,8 +852,8 @@ XrayResolveAttribute(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||||||
return false;
|
return false;
|
||||||
SET_JITINFO(fun, attrSpec.getter.info);
|
SET_JITINFO(fun, attrSpec.getter.info);
|
||||||
JSObject *funobj = JS_GetFunctionObject(fun);
|
JSObject *funobj = JS_GetFunctionObject(fun);
|
||||||
desc->getter = js::CastAsJSPropertyOp(funobj);
|
desc.setGetterObject(funobj);
|
||||||
desc->attrs |= JSPROP_GETTER;
|
desc.attributesRef() |= JSPROP_GETTER;
|
||||||
if (attrSpec.setter.op) {
|
if (attrSpec.setter.op) {
|
||||||
// We have a setter! Make it.
|
// We have a setter! Make it.
|
||||||
fun = JS_NewFunctionById(cx, (JSNative)attrSpec.setter.op, 1, 0,
|
fun = JS_NewFunctionById(cx, (JSNative)attrSpec.setter.op, 1, 0,
|
||||||
@ -862,12 +862,12 @@ XrayResolveAttribute(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||||||
return false;
|
return false;
|
||||||
SET_JITINFO(fun, attrSpec.setter.info);
|
SET_JITINFO(fun, attrSpec.setter.info);
|
||||||
funobj = JS_GetFunctionObject(fun);
|
funobj = JS_GetFunctionObject(fun);
|
||||||
desc->setter = js::CastAsJSStrictPropertyOp(funobj);
|
desc.setSetterObject(funobj);
|
||||||
desc->attrs |= JSPROP_SETTER;
|
desc.attributesRef() |= JSPROP_SETTER;
|
||||||
} else {
|
} else {
|
||||||
desc->setter = nullptr;
|
desc.setSetter(nullptr);
|
||||||
}
|
}
|
||||||
desc->obj = wrapper;
|
desc.object().set(wrapper);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -879,7 +879,7 @@ XrayResolveAttribute(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||||||
static bool
|
static bool
|
||||||
XrayResolveProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
XrayResolveProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||||
JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
|
JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
|
||||||
JSPropertyDescriptor* desc, DOMObjectType type,
|
JS::MutableHandle<JSPropertyDescriptor> desc, DOMObjectType type,
|
||||||
const NativeProperties* nativeProperties)
|
const NativeProperties* nativeProperties)
|
||||||
{
|
{
|
||||||
const Prefable<const JSFunctionSpec>* methods;
|
const Prefable<const JSFunctionSpec>* methods;
|
||||||
@ -912,11 +912,11 @@ XrayResolveProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||||||
}
|
}
|
||||||
SET_JITINFO(fun, methodSpec.call.info);
|
SET_JITINFO(fun, methodSpec.call.info);
|
||||||
JSObject *funobj = JS_GetFunctionObject(fun);
|
JSObject *funobj = JS_GetFunctionObject(fun);
|
||||||
desc->value.setObject(*funobj);
|
desc.value().setObject(*funobj);
|
||||||
desc->attrs = methodSpec.flags;
|
desc.setAttributes(methodSpec.flags);
|
||||||
desc->obj = wrapper;
|
desc.object().set(wrapper);
|
||||||
desc->setter = nullptr;
|
desc.setSetter(nullptr);
|
||||||
desc->getter = nullptr;
|
desc.setGetter(nullptr);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -932,7 +932,7 @@ XrayResolveProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||||||
nativeProperties->staticAttributeSpecs, desc)) {
|
nativeProperties->staticAttributeSpecs, desc)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (desc->obj) {
|
if (desc.object()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -944,7 +944,7 @@ XrayResolveProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||||||
nativeProperties->attributeSpecs, desc)) {
|
nativeProperties->attributeSpecs, desc)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (desc->obj) {
|
if (desc.object()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -956,7 +956,7 @@ XrayResolveProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||||||
desc)) {
|
desc)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (desc->obj) {
|
if (desc.object()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -971,9 +971,9 @@ XrayResolveProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||||||
size_t i = constant->specs - nativeProperties->constantSpecs;
|
size_t i = constant->specs - nativeProperties->constantSpecs;
|
||||||
for ( ; nativeProperties->constantIds[i] != JSID_VOID; ++i) {
|
for ( ; nativeProperties->constantIds[i] != JSID_VOID; ++i) {
|
||||||
if (id == nativeProperties->constantIds[i]) {
|
if (id == nativeProperties->constantIds[i]) {
|
||||||
desc->attrs = JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT;
|
desc.setAttributes(JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT);
|
||||||
desc->obj = wrapper;
|
desc.object().set(wrapper);
|
||||||
desc->value = nativeProperties->constantSpecs[i].value;
|
desc.value().set(nativeProperties->constantSpecs[i].value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -988,7 +988,7 @@ static bool
|
|||||||
ResolvePrototypeOrConstructor(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
ResolvePrototypeOrConstructor(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||||
JS::Handle<JSObject*> obj,
|
JS::Handle<JSObject*> obj,
|
||||||
size_t protoAndIfaceArrayIndex, unsigned attrs,
|
size_t protoAndIfaceArrayIndex, unsigned attrs,
|
||||||
JSPropertyDescriptor* desc)
|
JS::MutableHandle<JSPropertyDescriptor> desc)
|
||||||
{
|
{
|
||||||
JS::Rooted<JSObject*> global(cx, js::GetGlobalForObjectCrossCompartment(obj));
|
JS::Rooted<JSObject*> global(cx, js::GetGlobalForObjectCrossCompartment(obj));
|
||||||
{
|
{
|
||||||
@ -998,12 +998,12 @@ ResolvePrototypeOrConstructor(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||||||
if (!protoOrIface) {
|
if (!protoOrIface) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
desc->obj = wrapper;
|
desc.object().set(wrapper);
|
||||||
desc->shortid = 0;
|
desc.setShortId(0);
|
||||||
desc->attrs = attrs;
|
desc.setAttributes(attrs);
|
||||||
desc->getter = JS_PropertyStub;
|
desc.setGetter(JS_PropertyStub);
|
||||||
desc->setter = JS_StrictPropertyStub;
|
desc.setSetter(JS_StrictPropertyStub);
|
||||||
desc->value = JS::ObjectValue(*protoOrIface);
|
desc.value().set(JS::ObjectValue(*protoOrIface));
|
||||||
}
|
}
|
||||||
return JS_WrapPropertyDescriptor(cx, desc);
|
return JS_WrapPropertyDescriptor(cx, desc);
|
||||||
}
|
}
|
||||||
@ -1013,7 +1013,7 @@ XrayResolveNativeProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||||||
const NativePropertyHooks* nativePropertyHooks,
|
const NativePropertyHooks* nativePropertyHooks,
|
||||||
DOMObjectType type, JS::Handle<JSObject*> obj,
|
DOMObjectType type, JS::Handle<JSObject*> obj,
|
||||||
JS::Handle<jsid> id,
|
JS::Handle<jsid> id,
|
||||||
JSPropertyDescriptor* desc)
|
JS::MutableHandle<JSPropertyDescriptor> desc)
|
||||||
{
|
{
|
||||||
if (type == eInterface && IdEquals(id, "prototype")) {
|
if (type == eInterface && IdEquals(id, "prototype")) {
|
||||||
return nativePropertyHooks->mPrototypeID == prototypes::id::_ID_Count ||
|
return nativePropertyHooks->mPrototypeID == prototypes::id::_ID_Count ||
|
||||||
@ -1039,7 +1039,7 @@ XrayResolveNativeProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!desc->obj &&
|
if (!desc.object() &&
|
||||||
nativeProperties.chromeOnly &&
|
nativeProperties.chromeOnly &&
|
||||||
xpc::AccessCheck::isChrome(js::GetObjectCompartment(wrapper)) &&
|
xpc::AccessCheck::isChrome(js::GetObjectCompartment(wrapper)) &&
|
||||||
!XrayResolveProperty(cx, wrapper, obj, id, desc, type,
|
!XrayResolveProperty(cx, wrapper, obj, id, desc, type,
|
||||||
@ -1053,7 +1053,7 @@ XrayResolveNativeProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||||||
bool
|
bool
|
||||||
XrayResolveNativeProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
XrayResolveNativeProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||||
JS::Handle<JSObject*> obj,
|
JS::Handle<JSObject*> obj,
|
||||||
JS::Handle<jsid> id, JSPropertyDescriptor* desc)
|
JS::Handle<jsid> id, JS::MutableHandle<JSPropertyDescriptor> desc)
|
||||||
{
|
{
|
||||||
DOMObjectType type;
|
DOMObjectType type;
|
||||||
const NativePropertyHooks* nativePropertyHooks =
|
const NativePropertyHooks* nativePropertyHooks =
|
||||||
@ -1072,7 +1072,7 @@ XrayResolveNativeProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desc->obj) {
|
if (desc.object()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} while ((nativePropertyHooks = nativePropertyHooks->mProtoHooks));
|
} while ((nativePropertyHooks = nativePropertyHooks->mProtoHooks));
|
||||||
@ -1459,8 +1459,7 @@ NativeToString(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||||||
toStringDesc.value().set(JS::UndefinedValue());
|
toStringDesc.value().set(JS::UndefinedValue());
|
||||||
JS::Rooted<jsid> id(cx,
|
JS::Rooted<jsid> id(cx,
|
||||||
nsXPConnect::GetRuntimeInstance()->GetStringID(XPCJSRuntime::IDX_TO_STRING));
|
nsXPConnect::GetRuntimeInstance()->GetStringID(XPCJSRuntime::IDX_TO_STRING));
|
||||||
if (!XrayResolveNativeProperty(cx, wrapper, obj, id,
|
if (!XrayResolveNativeProperty(cx, wrapper, obj, id, &toStringDesc)) {
|
||||||
toStringDesc.address())) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1924,7 +1924,7 @@ XrayResolveOwnProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||||||
bool
|
bool
|
||||||
XrayResolveNativeProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
XrayResolveNativeProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||||
JS::Handle<JSObject*> obj,
|
JS::Handle<JSObject*> obj,
|
||||||
JS::Handle<jsid> id, JSPropertyDescriptor* desc);
|
JS::Handle<jsid> id, JS::MutableHandle<JSPropertyDescriptor> desc);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define a property on obj through an Xray wrapper.
|
* Define a property on obj through an Xray wrapper.
|
||||||
|
@ -7125,7 +7125,7 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(ClassMethod):
|
|||||||
"}\n") % (self.descriptor.nativeType)
|
"}\n") % (self.descriptor.nativeType)
|
||||||
|
|
||||||
if UseHolderForUnforgeable(self.descriptor):
|
if UseHolderForUnforgeable(self.descriptor):
|
||||||
getUnforgeable = """if (!JS_GetPropertyDescriptorById(cx, ${holder}, id, flags, desc.address())) {
|
getUnforgeable = """if (!JS_GetPropertyDescriptorById(cx, ${holder}, id, flags, desc)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MOZ_ASSERT_IF(desc.object(), desc.object() == ${holder});"""
|
MOZ_ASSERT_IF(desc.object(), desc.object() == ${holder});"""
|
||||||
@ -7133,7 +7133,7 @@ MOZ_ASSERT_IF(desc.object(), desc.object() == ${holder});"""
|
|||||||
getUnforgeable, "isXray")
|
getUnforgeable, "isXray")
|
||||||
getUnforgeable += """if (desc.object()) {
|
getUnforgeable += """if (desc.object()) {
|
||||||
desc.object().set(proxy);
|
desc.object().set(proxy);
|
||||||
return !isXray || JS_WrapPropertyDescriptor(cx, desc.address());
|
return !isXray || JS_WrapPropertyDescriptor(cx, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -7202,7 +7202,7 @@ MOZ_ASSERT_IF(desc.object(), desc.object() == ${holder});"""
|
|||||||
|
|
||||||
return setOrIndexedGet + """JS::Rooted<JSObject*> expando(cx);
|
return setOrIndexedGet + """JS::Rooted<JSObject*> expando(cx);
|
||||||
if (!isXray && (expando = GetExpandoObject(proxy))) {
|
if (!isXray && (expando = GetExpandoObject(proxy))) {
|
||||||
if (!JS_GetPropertyDescriptorById(cx, expando, id, flags, desc.address())) {
|
if (!JS_GetPropertyDescriptorById(cx, expando, id, flags, desc)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (desc.object()) {
|
if (desc.object()) {
|
||||||
|
@ -182,7 +182,7 @@ BaseDOMProxyHandler::getPropertyDescriptor(JSContext* cx,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return JS_GetPropertyDescriptorById(cx, proto, id, 0, desc.address());
|
return JS_GetPropertyDescriptorById(cx, proto, id, 0, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -189,7 +189,7 @@ JavaScriptChild::AnswerGetPropertyDescriptor(const ObjectId &objId, const nsStri
|
|||||||
return fail(cx, rs);
|
return fail(cx, rs);
|
||||||
|
|
||||||
Rooted<JSPropertyDescriptor> desc(cx);
|
Rooted<JSPropertyDescriptor> desc(cx);
|
||||||
if (!JS_GetPropertyDescriptorById(cx, obj, internedId, flags, desc.address()))
|
if (!JS_GetPropertyDescriptorById(cx, obj, internedId, flags, &desc))
|
||||||
return fail(cx, rs);
|
return fail(cx, rs);
|
||||||
|
|
||||||
if (!desc.object())
|
if (!desc.object())
|
||||||
@ -222,7 +222,7 @@ JavaScriptChild::AnswerGetOwnPropertyDescriptor(const ObjectId &objId, const nsS
|
|||||||
return fail(cx, rs);
|
return fail(cx, rs);
|
||||||
|
|
||||||
Rooted<JSPropertyDescriptor> desc(cx);
|
Rooted<JSPropertyDescriptor> desc(cx);
|
||||||
if (!JS_GetPropertyDescriptorById(cx, obj, internedId, flags, desc.address()))
|
if (!JS_GetPropertyDescriptorById(cx, obj, internedId, flags, &desc))
|
||||||
return fail(cx, rs);
|
return fail(cx, rs);
|
||||||
|
|
||||||
if (desc.object() != obj)
|
if (desc.object() != obj)
|
||||||
@ -339,10 +339,10 @@ JavaScriptChild::AnswerHasOwn(const ObjectId &objId, const nsString &id, ReturnS
|
|||||||
if (!convertGeckoStringToId(cx, id, &internedId))
|
if (!convertGeckoStringToId(cx, id, &internedId))
|
||||||
return fail(cx, rs);
|
return fail(cx, rs);
|
||||||
|
|
||||||
JSPropertyDescriptor desc;
|
Rooted<JSPropertyDescriptor> desc(cx);
|
||||||
if (!JS_GetPropertyDescriptorById(cx, obj, internedId, 0, &desc))
|
if (!JS_GetPropertyDescriptorById(cx, obj, internedId, 0, &desc))
|
||||||
return fail(cx, rs);
|
return fail(cx, rs);
|
||||||
*bp = (desc.obj == obj);
|
*bp = (desc.object() == obj);
|
||||||
|
|
||||||
return ok(rs);
|
return ok(rs);
|
||||||
}
|
}
|
||||||
|
@ -46,17 +46,17 @@ GetDataProperty(JSContext *cx, const Value &objVal, HandlePropertyName field, Mu
|
|||||||
if (!objVal.isObject())
|
if (!objVal.isObject())
|
||||||
return LinkFail(cx, "accessing property of non-object");
|
return LinkFail(cx, "accessing property of non-object");
|
||||||
|
|
||||||
JSPropertyDescriptor desc;
|
Rooted<JSPropertyDescriptor> desc(cx);
|
||||||
if (!JS_GetPropertyDescriptorById(cx, &objVal.toObject(), NameToId(field), 0, &desc))
|
if (!JS_GetPropertyDescriptorById(cx, &objVal.toObject(), NameToId(field), 0, &desc))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!desc.obj)
|
if (!desc.object())
|
||||||
return LinkFail(cx, "property not present on object");
|
return LinkFail(cx, "property not present on object");
|
||||||
|
|
||||||
if (desc.attrs & (JSPROP_GETTER | JSPROP_SETTER))
|
if (desc.hasGetterOrSetterObject())
|
||||||
return LinkFail(cx, "property is not a data property");
|
return LinkFail(cx, "property is not a data property");
|
||||||
|
|
||||||
v.set(desc.value);
|
v.set(desc.value());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3601,7 +3601,7 @@ GetPropertyDescriptorById(JSContext *cx, HandleObject obj, HandleId id, unsigned
|
|||||||
if (!LookupPropertyById(cx, obj, id, flags, &obj2, &shape))
|
if (!LookupPropertyById(cx, obj, id, flags, &obj2, &shape))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
JS_ASSERT(desc.isClear());
|
desc.clear();
|
||||||
if (!shape || (own && obj != obj2))
|
if (!shape || (own && obj != obj2))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -3636,15 +3636,11 @@ GetPropertyDescriptorById(JSContext *cx, HandleObject obj, HandleId id, unsigned
|
|||||||
|
|
||||||
JS_PUBLIC_API(bool)
|
JS_PUBLIC_API(bool)
|
||||||
JS_GetPropertyDescriptorById(JSContext *cx, JSObject *objArg, jsid idArg, unsigned flags,
|
JS_GetPropertyDescriptorById(JSContext *cx, JSObject *objArg, jsid idArg, unsigned flags,
|
||||||
JSPropertyDescriptor *desc_)
|
MutableHandle<JSPropertyDescriptor> desc)
|
||||||
{
|
{
|
||||||
RootedObject obj(cx, objArg);
|
RootedObject obj(cx, objArg);
|
||||||
RootedId id(cx, idArg);
|
RootedId id(cx, idArg);
|
||||||
Rooted<PropertyDescriptor> desc(cx);
|
return GetPropertyDescriptorById(cx, obj, id, flags, false, desc);
|
||||||
if (!GetPropertyDescriptorById(cx, obj, id, flags, false, &desc))
|
|
||||||
return false;
|
|
||||||
*desc_ = desc;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_PUBLIC_API(bool)
|
JS_PUBLIC_API(bool)
|
||||||
|
@ -3478,11 +3478,6 @@ class PropertyDescriptorOperations
|
|||||||
JS::Handle<Value> value() const {
|
JS::Handle<Value> value() const {
|
||||||
return JS::Handle<Value>::fromMarkedLocation(&desc()->value);
|
return JS::Handle<Value>::fromMarkedLocation(&desc()->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isClear() const {
|
|
||||||
return desc()->obj == NULL && desc()->attrs == 0 && desc()->getter == NULL &&
|
|
||||||
desc()->setter == NULL && desc()->value.isUndefined();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Outer>
|
template <typename Outer>
|
||||||
@ -3491,6 +3486,16 @@ class MutablePropertyDescriptorOperations : public PropertyDescriptorOperations<
|
|||||||
JSPropertyDescriptor * desc() { return static_cast<Outer*>(this)->extractMutable(); }
|
JSPropertyDescriptor * desc() { return static_cast<Outer*>(this)->extractMutable(); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
void clear() {
|
||||||
|
object().set(NULL);
|
||||||
|
setAttributes(0);
|
||||||
|
setShortId(0);
|
||||||
|
setGetter(NULL);
|
||||||
|
setSetter(NULL);
|
||||||
|
value().setUndefined();
|
||||||
|
}
|
||||||
|
|
||||||
JS::MutableHandle<JSObject*> object() {
|
JS::MutableHandle<JSObject*> object() {
|
||||||
return JS::MutableHandle<JSObject*>::fromMarkedLocation(&desc()->obj);
|
return JS::MutableHandle<JSObject*>::fromMarkedLocation(&desc()->obj);
|
||||||
}
|
}
|
||||||
@ -3574,7 +3579,7 @@ class MutableHandleBase<JSPropertyDescriptor>
|
|||||||
*/
|
*/
|
||||||
extern JS_PUBLIC_API(bool)
|
extern JS_PUBLIC_API(bool)
|
||||||
JS_GetPropertyDescriptorById(JSContext *cx, JSObject *obj, jsid id, unsigned flags,
|
JS_GetPropertyDescriptorById(JSContext *cx, JSObject *obj, jsid id, unsigned flags,
|
||||||
JSPropertyDescriptor *desc);
|
JS::MutableHandle<JSPropertyDescriptor> desc);
|
||||||
|
|
||||||
extern JS_PUBLIC_API(bool)
|
extern JS_PUBLIC_API(bool)
|
||||||
JS_GetOwnPropertyDescriptor(JSContext *cx, JSObject *obj, jsid id, JS::MutableHandle<JS::Value> vp);
|
JS_GetOwnPropertyDescriptor(JSContext *cx, JSObject *obj, jsid id, JS::MutableHandle<JS::Value> vp);
|
||||||
|
@ -244,12 +244,9 @@ JS_SetCompartmentPrincipals(JSCompartment *compartment, JSPrincipals *principals
|
|||||||
}
|
}
|
||||||
|
|
||||||
JS_FRIEND_API(bool)
|
JS_FRIEND_API(bool)
|
||||||
JS_WrapPropertyDescriptor(JSContext *cx, js::PropertyDescriptor *descArg)
|
JS_WrapPropertyDescriptor(JSContext *cx, JS::MutableHandle<js::PropertyDescriptor> desc)
|
||||||
{
|
{
|
||||||
Rooted<PropertyDescriptor> desc(cx, *descArg);
|
return cx->compartment()->wrap(cx, desc);
|
||||||
bool status = cx->compartment()->wrap(cx, &desc);
|
|
||||||
*descArg = desc;
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_FRIEND_API(bool)
|
JS_FRIEND_API(bool)
|
||||||
@ -1092,11 +1089,10 @@ js::GetObjectMetadata(JSObject *obj)
|
|||||||
|
|
||||||
JS_FRIEND_API(bool)
|
JS_FRIEND_API(bool)
|
||||||
js_DefineOwnProperty(JSContext *cx, JSObject *objArg, jsid idArg,
|
js_DefineOwnProperty(JSContext *cx, JSObject *objArg, jsid idArg,
|
||||||
const js::PropertyDescriptor& descriptorArg, bool *bp)
|
JS::Handle<js::PropertyDescriptor> descriptor, bool *bp)
|
||||||
{
|
{
|
||||||
RootedObject obj(cx, objArg);
|
RootedObject obj(cx, objArg);
|
||||||
RootedId id(cx, idArg);
|
RootedId id(cx, idArg);
|
||||||
Rooted<PropertyDescriptor> descriptor(cx, descriptorArg);
|
|
||||||
JS_ASSERT(cx->runtime()->heapState == js::Idle);
|
JS_ASSERT(cx->runtime()->heapState == js::Idle);
|
||||||
CHECK_REQUEST(cx);
|
CHECK_REQUEST(cx);
|
||||||
assertSameCompartment(cx, obj, id, descriptor.value());
|
assertSameCompartment(cx, obj, id, descriptor.value());
|
||||||
|
@ -175,7 +175,7 @@ extern JS_FRIEND_API(bool)
|
|||||||
JS_CopyPropertiesFrom(JSContext *cx, JSObject *target, JSObject *obj);
|
JS_CopyPropertiesFrom(JSContext *cx, JSObject *target, JSObject *obj);
|
||||||
|
|
||||||
extern JS_FRIEND_API(bool)
|
extern JS_FRIEND_API(bool)
|
||||||
JS_WrapPropertyDescriptor(JSContext *cx, JSPropertyDescriptor *desc);
|
JS_WrapPropertyDescriptor(JSContext *cx, JS::MutableHandle<JSPropertyDescriptor> desc);
|
||||||
|
|
||||||
extern JS_FRIEND_API(bool)
|
extern JS_FRIEND_API(bool)
|
||||||
JS_WrapAutoIdVector(JSContext *cx, JS::AutoIdVector &props);
|
JS_WrapAutoIdVector(JSContext *cx, JS::AutoIdVector &props);
|
||||||
@ -575,18 +575,6 @@ AtomToLinearString(JSAtom *atom)
|
|||||||
return reinterpret_cast<JSLinearString *>(atom);
|
return reinterpret_cast<JSLinearString *>(atom);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline JSPropertyOp
|
|
||||||
CastAsJSPropertyOp(JSObject *object)
|
|
||||||
{
|
|
||||||
return JS_DATA_TO_FUNC_PTR(JSPropertyOp, object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline JSStrictPropertyOp
|
|
||||||
CastAsJSStrictPropertyOp(JSObject *object)
|
|
||||||
{
|
|
||||||
return JS_DATA_TO_FUNC_PTR(JSStrictPropertyOp, object);
|
|
||||||
}
|
|
||||||
|
|
||||||
JS_FRIEND_API(bool)
|
JS_FRIEND_API(bool)
|
||||||
GetPropertyNames(JSContext *cx, JSObject *obj, unsigned flags, js::AutoIdVector *props);
|
GetPropertyNames(JSContext *cx, JSObject *obj, unsigned flags, js::AutoIdVector *props);
|
||||||
|
|
||||||
@ -1816,7 +1804,7 @@ class AsmJSModuleSourceDesc
|
|||||||
|
|
||||||
extern JS_FRIEND_API(bool)
|
extern JS_FRIEND_API(bool)
|
||||||
js_DefineOwnProperty(JSContext *cx, JSObject *objArg, jsid idArg,
|
js_DefineOwnProperty(JSContext *cx, JSObject *objArg, jsid idArg,
|
||||||
const JSPropertyDescriptor& descriptor, bool *bp);
|
JS::Handle<JSPropertyDescriptor> descriptor, bool *bp);
|
||||||
|
|
||||||
extern JS_FRIEND_API(bool)
|
extern JS_FRIEND_API(bool)
|
||||||
js_ReportIsNotFunction(JSContext *cx, const JS::Value& v);
|
js_ReportIsNotFunction(JSContext *cx, const JS::Value& v);
|
||||||
|
@ -370,7 +370,7 @@ DirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, Han
|
|||||||
assertEnteredPolicy(cx, proxy, id);
|
assertEnteredPolicy(cx, proxy, id);
|
||||||
JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype.
|
JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype.
|
||||||
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
||||||
return JS_GetPropertyDescriptorById(cx, target, id, 0, desc.address());
|
return JS_GetPropertyDescriptorById(cx, target, id, 0, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@ -382,7 +382,7 @@ GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id, unsigned
|
|||||||
if (obj->is<ProxyObject>())
|
if (obj->is<ProxyObject>())
|
||||||
return Proxy::getOwnPropertyDescriptor(cx, obj, id, desc, flags);
|
return Proxy::getOwnPropertyDescriptor(cx, obj, id, desc, flags);
|
||||||
|
|
||||||
if (!JS_GetPropertyDescriptorById(cx, obj, id, flags, desc.address()))
|
if (!JS_GetPropertyDescriptorById(cx, obj, id, flags, desc))
|
||||||
return false;
|
return false;
|
||||||
if (desc.object() != obj)
|
if (desc.object() != obj)
|
||||||
desc.object().set(NULL);
|
desc.object().set(NULL);
|
||||||
@ -553,7 +553,7 @@ DirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool
|
|||||||
assertEnteredPolicy(cx, proxy, id);
|
assertEnteredPolicy(cx, proxy, id);
|
||||||
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
||||||
Rooted<PropertyDescriptor> desc(cx);
|
Rooted<PropertyDescriptor> desc(cx);
|
||||||
if (!JS_GetPropertyDescriptorById(cx, target, id, 0, desc.address()))
|
if (!JS_GetPropertyDescriptorById(cx, target, id, 0, &desc))
|
||||||
return false;
|
return false;
|
||||||
*bp = (desc.object() == target);
|
*bp = (desc.object() == target);
|
||||||
return true;
|
return true;
|
||||||
@ -1321,7 +1321,7 @@ static bool
|
|||||||
HasOwn(JSContext *cx, HandleObject obj, HandleId id, bool *bp)
|
HasOwn(JSContext *cx, HandleObject obj, HandleId id, bool *bp)
|
||||||
{
|
{
|
||||||
Rooted<PropertyDescriptor> desc(cx);
|
Rooted<PropertyDescriptor> desc(cx);
|
||||||
if (!JS_GetPropertyDescriptorById(cx, obj, id, 0, desc.address()))
|
if (!JS_GetPropertyDescriptorById(cx, obj, id, 0, &desc))
|
||||||
return false;
|
return false;
|
||||||
*bp = (desc.object() == obj);
|
*bp = (desc.object() == obj);
|
||||||
return true;
|
return true;
|
||||||
@ -1716,7 +1716,7 @@ ScriptedDirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject pr
|
|||||||
JS_ASSERT(!desc.object());
|
JS_ASSERT(!desc.object());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return JS_GetPropertyDescriptorById(cx, proto, id, 0, desc.address());
|
return JS_GetPropertyDescriptorById(cx, proto, id, 0, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -2310,8 +2310,7 @@ Proxy::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
|
|||||||
return false;
|
return false;
|
||||||
if (desc.object())
|
if (desc.object())
|
||||||
return true;
|
return true;
|
||||||
INVOKE_ON_PROTOTYPE(cx, handler, proxy,
|
INVOKE_ON_PROTOTYPE(cx, handler, proxy, JS_GetPropertyDescriptorById(cx, proto, id, 0, desc));
|
||||||
JS_GetPropertyDescriptorById(cx, proto, id, 0, desc.address()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -2544,7 +2543,7 @@ Proxy::set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id
|
|||||||
return false;
|
return false;
|
||||||
if (proto) {
|
if (proto) {
|
||||||
Rooted<PropertyDescriptor> desc(cx);
|
Rooted<PropertyDescriptor> desc(cx);
|
||||||
if (!JS_GetPropertyDescriptorById(cx, proto, id, 0, desc.address()))
|
if (!JS_GetPropertyDescriptorById(cx, proto, id, 0, &desc))
|
||||||
return false;
|
return false;
|
||||||
if (desc.object() && desc.setter())
|
if (desc.object() && desc.setter())
|
||||||
return JSObject::setGeneric(cx, proto, receiver, id, vp, strict);
|
return JSObject::setGeneric(cx, proto, receiver, id, vp, strict);
|
||||||
|
@ -1415,7 +1415,7 @@ class DebugScopeProxy : public BaseProxyHandler
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return JS_GetPropertyDescriptorById(cx, scope, id, 0, desc.address());
|
return JS_GetPropertyDescriptorById(cx, scope, id, 0, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id,
|
bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id,
|
||||||
|
@ -2693,7 +2693,7 @@ nsXPCComponents_Utils::LookupMethod(const JS::Value& object,
|
|||||||
// Alright, now do the lookup.
|
// Alright, now do the lookup.
|
||||||
*retval = UndefinedValue();
|
*retval = UndefinedValue();
|
||||||
Rooted<JSPropertyDescriptor> desc(cx);
|
Rooted<JSPropertyDescriptor> desc(cx);
|
||||||
if (!JS_GetPropertyDescriptorById(cx, xray, methodId, 0, desc.address()))
|
if (!JS_GetPropertyDescriptorById(cx, xray, methodId, 0, &desc))
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
// First look for a method value. If that's not there, try a getter,
|
// First look for a method value. If that's not there, try a getter,
|
||||||
@ -3141,7 +3141,7 @@ xpc::SandboxProxyHandler::getPropertyDescriptor(JSContext *cx,
|
|||||||
|
|
||||||
MOZ_ASSERT(js::GetObjectCompartment(obj) == js::GetObjectCompartment(proxy));
|
MOZ_ASSERT(js::GetObjectCompartment(obj) == js::GetObjectCompartment(proxy));
|
||||||
if (!JS_GetPropertyDescriptorById(cx, obj, id,
|
if (!JS_GetPropertyDescriptorById(cx, obj, id,
|
||||||
flags, desc.address()))
|
flags, desc))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!desc.object())
|
if (!desc.object())
|
||||||
|
@ -348,7 +348,7 @@ ExposedPropertiesOnly::check(JSContext *cx, JSObject *wrapperArg, jsid idArg, Wr
|
|||||||
Access access = NO_ACCESS;
|
Access access = NO_ACCESS;
|
||||||
|
|
||||||
Rooted<JSPropertyDescriptor> desc(cx);
|
Rooted<JSPropertyDescriptor> desc(cx);
|
||||||
if (!JS_GetPropertyDescriptorById(cx, hallpass, id, 0, desc.address())) {
|
if (!JS_GetPropertyDescriptorById(cx, hallpass, id, 0, &desc)) {
|
||||||
return false; // Error
|
return false; // Error
|
||||||
}
|
}
|
||||||
if (!desc.object() || !desc.isEnumerable())
|
if (!desc.object() || !desc.isEnumerable())
|
||||||
|
@ -90,7 +90,7 @@ ChromeObjectWrapper::getPropertyDescriptor(JSContext *cx,
|
|||||||
|
|
||||||
// If not, try doing the lookup on the prototype.
|
// If not, try doing the lookup on the prototype.
|
||||||
MOZ_ASSERT(js::IsObjectInContextCompartment(wrapper, cx));
|
MOZ_ASSERT(js::IsObjectInContextCompartment(wrapper, cx));
|
||||||
return JS_GetPropertyDescriptorById(cx, wrapperProto, id, 0, desc.address());
|
return JS_GetPropertyDescriptorById(cx, wrapperProto, id, 0, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -115,7 +115,7 @@ ChromeObjectWrapper::has(JSContext *cx, HandleObject wrapper,
|
|||||||
// Try the prototype if that failed.
|
// Try the prototype if that failed.
|
||||||
MOZ_ASSERT(js::IsObjectInContextCompartment(wrapper, cx));
|
MOZ_ASSERT(js::IsObjectInContextCompartment(wrapper, cx));
|
||||||
Rooted<JSPropertyDescriptor> desc(cx);
|
Rooted<JSPropertyDescriptor> desc(cx);
|
||||||
if (!JS_GetPropertyDescriptorById(cx, wrapperProto, id, 0, desc.address()))
|
if (!JS_GetPropertyDescriptorById(cx, wrapperProto, id, 0, &desc))
|
||||||
return false;
|
return false;
|
||||||
*bp = !!desc.object();
|
*bp = !!desc.object();
|
||||||
return true;
|
return true;
|
||||||
|
@ -207,7 +207,7 @@ public:
|
|||||||
|
|
||||||
static bool resolveDOMCollectionProperty(JSContext *cx, HandleObject wrapper,
|
static bool resolveDOMCollectionProperty(JSContext *cx, HandleObject wrapper,
|
||||||
HandleObject holder, HandleId id,
|
HandleObject holder, HandleId id,
|
||||||
JSPropertyDescriptor *desc, unsigned flags);
|
MutableHandle<JSPropertyDescriptor> desc, unsigned flags);
|
||||||
|
|
||||||
static XPCWrappedNative* getWN(JSObject *wrapper) {
|
static XPCWrappedNative* getWN(JSObject *wrapper) {
|
||||||
return XPCWrappedNative::Get(getTargetObject(wrapper));
|
return XPCWrappedNative::Get(getTargetObject(wrapper));
|
||||||
@ -615,7 +615,8 @@ private:
|
|||||||
bool
|
bool
|
||||||
XPCWrappedNativeXrayTraits::resolveDOMCollectionProperty(JSContext *cx, HandleObject wrapper,
|
XPCWrappedNativeXrayTraits::resolveDOMCollectionProperty(JSContext *cx, HandleObject wrapper,
|
||||||
HandleObject holder, HandleId id,
|
HandleObject holder, HandleId id,
|
||||||
JSPropertyDescriptor *desc, unsigned flags)
|
MutableHandle<JSPropertyDescriptor> desc,
|
||||||
|
unsigned flags)
|
||||||
{
|
{
|
||||||
// If we are not currently resolving this id and resolveNative is called
|
// If we are not currently resolving this id and resolveNative is called
|
||||||
// we don't do anything. (see defineProperty in case of shadowing is forbidden).
|
// we don't do anything. (see defineProperty in case of shadowing is forbidden).
|
||||||
@ -709,7 +710,7 @@ XPCWrappedNativeXrayTraits::resolveNativeProperty(JSContext *cx, HandleObject wr
|
|||||||
// check for those.
|
// check for those.
|
||||||
if (!JSID_IS_STRING(id)) {
|
if (!JSID_IS_STRING(id)) {
|
||||||
/* Not found */
|
/* Not found */
|
||||||
return resolveDOMCollectionProperty(cx, wrapper, holder, id, desc.address(), flags);
|
return resolveDOMCollectionProperty(cx, wrapper, holder, id, desc, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
XPCNativeInterface *iface;
|
XPCNativeInterface *iface;
|
||||||
@ -723,7 +724,7 @@ XPCWrappedNativeXrayTraits::resolveNativeProperty(JSContext *cx, HandleObject wr
|
|||||||
} else if (!(iface = ccx.GetInterface()) ||
|
} else if (!(iface = ccx.GetInterface()) ||
|
||||||
!(member = ccx.GetMember())) {
|
!(member = ccx.GetMember())) {
|
||||||
/* Not found */
|
/* Not found */
|
||||||
return resolveDOMCollectionProperty(cx, wrapper, holder, id, desc.address(), flags);
|
return resolveDOMCollectionProperty(cx, wrapper, holder, id, desc, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
desc.object().set(holder);
|
desc.object().set(holder);
|
||||||
@ -809,11 +810,11 @@ XrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper,
|
|||||||
// in the target compartment.
|
// in the target compartment.
|
||||||
if (expando) {
|
if (expando) {
|
||||||
JSAutoCompartment ac(cx, expando);
|
JSAutoCompartment ac(cx, expando);
|
||||||
if (!JS_GetPropertyDescriptorById(cx, expando, id, 0, desc.address()))
|
if (!JS_GetPropertyDescriptorById(cx, expando, id, 0, desc))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (desc.object()) {
|
if (desc.object()) {
|
||||||
if (!JS_WrapPropertyDescriptor(cx, desc.address()))
|
if (!JS_WrapPropertyDescriptor(cx, desc))
|
||||||
return false;
|
return false;
|
||||||
// Pretend the property lives on the wrapper.
|
// Pretend the property lives on the wrapper.
|
||||||
desc.object().set(wrapper);
|
desc.object().set(wrapper);
|
||||||
@ -853,7 +854,7 @@ XPCWrappedNativeXrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper
|
|||||||
}
|
}
|
||||||
desc.value().setObject(*obj);
|
desc.value().setObject(*obj);
|
||||||
mozilla::dom::FillPropertyDescriptor(desc, wrapper, true);
|
mozilla::dom::FillPropertyDescriptor(desc, wrapper, true);
|
||||||
return JS_WrapPropertyDescriptor(cx, desc.address());
|
return JS_WrapPropertyDescriptor(cx, desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -901,7 +902,7 @@ XPCWrappedNativeXrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper
|
|||||||
// return non-|own| properties from Object.getOwnPropertyDescriptor if
|
// return non-|own| properties from Object.getOwnPropertyDescriptor if
|
||||||
// lookups are performed in a certain order, but we can probably live with
|
// lookups are performed in a certain order, but we can probably live with
|
||||||
// that until XPCWN Xrays go away with the new DOM bindings.
|
// that until XPCWN Xrays go away with the new DOM bindings.
|
||||||
return JS_GetPropertyDescriptorById(cx, holder, id, 0, desc.address());
|
return JS_GetPropertyDescriptorById(cx, holder, id, 0, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -1031,7 +1032,7 @@ DOMXrayTraits::resolveNativeProperty(JSContext *cx, HandleObject wrapper,
|
|||||||
MutableHandle<JSPropertyDescriptor> desc, unsigned flags)
|
MutableHandle<JSPropertyDescriptor> desc, unsigned flags)
|
||||||
{
|
{
|
||||||
RootedObject obj(cx, getTargetObject(wrapper));
|
RootedObject obj(cx, getTargetObject(wrapper));
|
||||||
if (!XrayResolveNativeProperty(cx, wrapper, obj, id, desc.address()))
|
if (!XrayResolveNativeProperty(cx, wrapper, obj, id, desc))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
NS_ASSERTION(!desc.object() || desc.object() == wrapper,
|
NS_ASSERTION(!desc.object() || desc.object() == wrapper,
|
||||||
@ -1393,7 +1394,7 @@ XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, HandleObject wra
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Check the holder.
|
// Check the holder.
|
||||||
if (!desc.object() && !JS_GetPropertyDescriptorById(cx, holder, id, 0, desc.address()))
|
if (!desc.object() && !JS_GetPropertyDescriptorById(cx, holder, id, 0, desc))
|
||||||
return false;
|
return false;
|
||||||
if (desc.object()) {
|
if (desc.object()) {
|
||||||
desc.object().set(wrapper);
|
desc.object().set(wrapper);
|
||||||
@ -1424,7 +1425,7 @@ XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, HandleObject wra
|
|||||||
mozilla::dom::FillPropertyDescriptor(desc, wrapper,
|
mozilla::dom::FillPropertyDescriptor(desc, wrapper,
|
||||||
ObjectValue(*childObj),
|
ObjectValue(*childObj),
|
||||||
/* readOnly = */ true);
|
/* readOnly = */ true);
|
||||||
return JS_WrapPropertyDescriptor(cx, desc.address());
|
return JS_WrapPropertyDescriptor(cx, desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1463,7 +1464,7 @@ XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, HandleObject wra
|
|||||||
EnsureCompartmentPrivate(wrapper)->scope->IsXBLScope() &&
|
EnsureCompartmentPrivate(wrapper)->scope->IsXBLScope() &&
|
||||||
(content = do_QueryInterfaceNative(cx, wrapper)))
|
(content = do_QueryInterfaceNative(cx, wrapper)))
|
||||||
{
|
{
|
||||||
if (!nsContentUtils::LookupBindingMember(cx, content, id, desc.address()))
|
if (!nsContentUtils::LookupBindingMember(cx, content, id, desc))
|
||||||
return false;
|
return false;
|
||||||
DEBUG_CheckXBLLookup(cx, desc.address());
|
DEBUG_CheckXBLLookup(cx, desc.address());
|
||||||
}
|
}
|
||||||
@ -1474,7 +1475,7 @@ XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, HandleObject wra
|
|||||||
|
|
||||||
if (!JS_DefinePropertyById(cx, holder, id, desc.value(), desc.getter(),
|
if (!JS_DefinePropertyById(cx, holder, id, desc.value(), desc.getter(),
|
||||||
desc.setter(), desc.attributes()) ||
|
desc.setter(), desc.attributes()) ||
|
||||||
!JS_GetPropertyDescriptorById(cx, holder, id, flags, desc.address()))
|
!JS_GetPropertyDescriptorById(cx, holder, id, flags, desc))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1600,7 +1601,7 @@ XrayWrapper<Base, Traits>::defineProperty(JSContext *cx, HandleObject wrapper,
|
|||||||
|
|
||||||
// Wrap the property descriptor for the target compartment.
|
// Wrap the property descriptor for the target compartment.
|
||||||
Rooted<JSPropertyDescriptor> wrappedDesc(cx, desc);
|
Rooted<JSPropertyDescriptor> wrappedDesc(cx, desc);
|
||||||
if (!JS_WrapPropertyDescriptor(cx, wrappedDesc.address()))
|
if (!JS_WrapPropertyDescriptor(cx, &wrappedDesc))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Fix up Xray waivers.
|
// Fix up Xray waivers.
|
||||||
|
Loading…
Reference in New Issue
Block a user