зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1165722 - Replace JS_GetPropertyDescriptor usage in Xray code. r=bholley
This commit is contained in:
Родитель
8b3a3efd8b
Коммит
a65f7266fe
|
@ -459,7 +459,7 @@ JSXrayTraits::resolveOwnProperty(JSContext* cx, const Wrapper& jsWrapper,
|
||||||
// muddles through by only checking the holder for non-|own| lookups, but
|
// 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 doesn't work for us. So we do an explicit holder check here, and hope
|
||||||
// that this mess gets fixed up soon.
|
// that this mess gets fixed up soon.
|
||||||
if (!JS_GetPropertyDescriptorById(cx, holder, id, desc))
|
if (!JS_GetOwnPropertyDescriptorById(cx, holder, id, desc))
|
||||||
return false;
|
return false;
|
||||||
if (desc.object()) {
|
if (desc.object()) {
|
||||||
desc.object().set(wrapper);
|
desc.object().set(wrapper);
|
||||||
|
@ -521,13 +521,13 @@ JSXrayTraits::resolveOwnProperty(JSContext* cx, const Wrapper& jsWrapper,
|
||||||
if (!fun)
|
if (!fun)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// The generic Xray machinery only defines non-own properties on the holder.
|
// The generic Xray machinery only defines non-own properties of the target on
|
||||||
// This is broken, and will be fixed at some point, but for now we need to
|
// the holder. This is broken, and will be fixed at some point, but for now we
|
||||||
// cache the value explicitly. See the corresponding call to
|
// need to cache the value explicitly. See the corresponding call to
|
||||||
// JS_GetPropertyById at the top of this function.
|
// JS_GetOwnPropertyDescriptorById at the top of this function.
|
||||||
RootedObject funObj(cx, JS_GetFunctionObject(fun));
|
RootedObject funObj(cx, JS_GetFunctionObject(fun));
|
||||||
return JS_DefinePropertyById(cx, holder, id, funObj, 0) &&
|
return JS_DefinePropertyById(cx, holder, id, funObj, 0) &&
|
||||||
JS_GetPropertyDescriptorById(cx, holder, id, desc);
|
JS_GetOwnPropertyDescriptorById(cx, holder, id, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scan through the properties.
|
// Scan through the properties.
|
||||||
|
@ -580,7 +580,7 @@ JSXrayTraits::resolveOwnProperty(JSContext* cx, const Wrapper& jsWrapper,
|
||||||
desc.attributes(),
|
desc.attributes(),
|
||||||
JS_PROPERTYOP_GETTER(desc.getter()),
|
JS_PROPERTYOP_GETTER(desc.getter()),
|
||||||
JS_PROPERTYOP_SETTER(desc.setter())) &&
|
JS_PROPERTYOP_SETTER(desc.setter())) &&
|
||||||
JS_GetPropertyDescriptorById(cx, holder, id, desc);
|
JS_GetOwnPropertyDescriptorById(cx, holder, id, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1242,7 +1242,7 @@ XPCWrappedNativeXrayTraits::resolveNativeProperty(JSContext* cx, HandleObject wr
|
||||||
ObjectValue(*JS_GetFunctionObject(toString)));
|
ObjectValue(*JS_GetFunctionObject(toString)));
|
||||||
|
|
||||||
return JS_DefinePropertyById(cx, holder, id, desc) &&
|
return JS_DefinePropertyById(cx, holder, id, desc) &&
|
||||||
JS_GetPropertyDescriptorById(cx, holder, id, desc);
|
JS_GetOwnPropertyDescriptorById(cx, holder, id, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
desc.object().set(holder);
|
desc.object().set(holder);
|
||||||
|
@ -1335,7 +1335,7 @@ XrayTraits::resolveOwnProperty(JSContext* cx, const Wrapper& jsWrapper,
|
||||||
bool found = false;
|
bool found = false;
|
||||||
if (expando) {
|
if (expando) {
|
||||||
JSAutoCompartment ac(cx, expando);
|
JSAutoCompartment ac(cx, expando);
|
||||||
if (!JS_GetPropertyDescriptorById(cx, expando, id, desc))
|
if (!JS_GetOwnPropertyDescriptorById(cx, expando, id, desc))
|
||||||
return false;
|
return false;
|
||||||
found = !!desc.object();
|
found = !!desc.object();
|
||||||
}
|
}
|
||||||
|
@ -1381,7 +1381,7 @@ XrayTraits::resolveOwnProperty(JSContext* cx, const Wrapper& jsWrapper,
|
||||||
wrappedJSObject_getter)) {
|
wrappedJSObject_getter)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!JS_GetPropertyDescriptorById(cx, holder, id, desc))
|
if (!JS_GetOwnPropertyDescriptorById(cx, holder, id, desc))
|
||||||
return false;
|
return false;
|
||||||
desc.object().set(wrapper);
|
desc.object().set(wrapper);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1429,7 +1429,7 @@ XPCWrappedNativeXrayTraits::resolveOwnProperty(JSContext* cx, const Wrapper& jsW
|
||||||
// in the wrapper's compartment here, not the wrappee.
|
// in the wrapper's compartment here, not the wrappee.
|
||||||
MOZ_ASSERT(js::IsObjectInContextCompartment(wrapper, cx));
|
MOZ_ASSERT(js::IsObjectInContextCompartment(wrapper, cx));
|
||||||
|
|
||||||
return JS_GetPropertyDescriptorById(cx, holder, id, desc);
|
return JS_GetOwnPropertyDescriptorById(cx, holder, id, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -1572,7 +1572,7 @@ DOMXrayTraits::resolveOwnProperty(JSContext* cx, const Wrapper& jsWrapper, Handl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!JS_GetPropertyDescriptorById(cx, holder, id, desc))
|
if (!JS_GetOwnPropertyDescriptorById(cx, holder, id, desc))
|
||||||
return false;
|
return false;
|
||||||
if (desc.object()) {
|
if (desc.object()) {
|
||||||
desc.object().set(wrapper);
|
desc.object().set(wrapper);
|
||||||
|
@ -1590,7 +1590,7 @@ DOMXrayTraits::resolveOwnProperty(JSContext* cx, const Wrapper& jsWrapper, Handl
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return JS_DefinePropertyById(cx, holder, id, desc) &&
|
return JS_DefinePropertyById(cx, holder, id, desc) &&
|
||||||
JS_GetPropertyDescriptorById(cx, holder, id, desc);
|
JS_GetOwnPropertyDescriptorById(cx, holder, id, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -1866,7 +1866,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, desc))
|
if (!desc.object() && !JS_GetOwnPropertyDescriptorById(cx, holder, id, desc))
|
||||||
return false;
|
return false;
|
||||||
if (desc.object()) {
|
if (desc.object()) {
|
||||||
desc.object().set(wrapper);
|
desc.object().set(wrapper);
|
||||||
|
@ -1908,7 +1908,7 @@ XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext* cx, HandleObject wra
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!JS_DefinePropertyById(cx, holder, id, desc) ||
|
if (!JS_DefinePropertyById(cx, holder, id, desc) ||
|
||||||
!JS_GetPropertyDescriptorById(cx, holder, id, desc))
|
!JS_GetOwnPropertyDescriptorById(cx, holder, id, desc))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче