зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1713465 - Rename hasGetterObject and hasSetterObject. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D116312
This commit is contained in:
Родитель
682bd47c13
Коммит
054394fdf4
|
@ -164,7 +164,7 @@ bool MaybeCrossOriginObjectMixins::CrossOriginGet(
|
|||
|
||||
// Step 5.
|
||||
JS::Rooted<JSObject*> getter(cx);
|
||||
if (!desc->hasGetterObject() || !(getter = desc->getterObject())) {
|
||||
if (!desc->hasGetter() || !(getter = desc->getterObject())) {
|
||||
// Step 6.
|
||||
return ReportCrossOriginDenial(cx, id, "get"_ns);
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ bool MaybeCrossOriginObjectMixins::CrossOriginSet(
|
|||
|
||||
// Step 3.
|
||||
JS::Rooted<JSObject*> setter(cx);
|
||||
if (desc->hasSetterObject() && (setter = desc->setterObject())) {
|
||||
if (desc->hasSetter() && (setter = desc->setterObject())) {
|
||||
JS::Rooted<JS::Value> ignored(cx);
|
||||
// Step 3.1.
|
||||
if (!JS::Call(cx, receiver, setter, JS::HandleValueArray(v), &ignored)) {
|
||||
|
|
|
@ -220,8 +220,8 @@ class JS_PUBLIC_API PropertyDescriptor {
|
|||
PropertyDescriptor desc;
|
||||
desc.assertValid();
|
||||
MOZ_ASSERT(!desc.hasConfigurable() && !desc.hasEnumerable() &&
|
||||
!desc.hasWritable() && !desc.hasValue() &&
|
||||
!desc.hasGetterObject() && !desc.hasSetterObject());
|
||||
!desc.hasWritable() && !desc.hasValue() && !desc.hasGetter() &&
|
||||
!desc.hasSetter());
|
||||
return desc;
|
||||
}
|
||||
|
||||
|
@ -280,9 +280,9 @@ class JS_PUBLIC_API PropertyDescriptor {
|
|||
writable_ = writable;
|
||||
}
|
||||
|
||||
bool hasGetterObject() const { return hasGetter_; }
|
||||
bool hasGetter() const { return hasGetter_; }
|
||||
JSObject* getterObject() const {
|
||||
MOZ_ASSERT(hasGetterObject());
|
||||
MOZ_ASSERT(hasGetter());
|
||||
return getter_;
|
||||
}
|
||||
void setGetterObject(JSObject* obj) {
|
||||
|
@ -291,9 +291,9 @@ class JS_PUBLIC_API PropertyDescriptor {
|
|||
getter_ = obj;
|
||||
}
|
||||
|
||||
bool hasSetterObject() const { return hasSetter_; }
|
||||
bool hasSetter() const { return hasSetter_; }
|
||||
JSObject* setterObject() const {
|
||||
MOZ_ASSERT(hasSetterObject());
|
||||
MOZ_ASSERT(hasSetter());
|
||||
return setter_;
|
||||
}
|
||||
void setSetterObject(JSObject* obj) {
|
||||
|
@ -344,8 +344,7 @@ class JS_PUBLIC_API PropertyDescriptor {
|
|||
MOZ_ASSERT(hasEnumerable());
|
||||
MOZ_ASSERT(!isGenericDescriptor());
|
||||
MOZ_ASSERT_IF(isDataDescriptor(), hasValue() && hasWritable());
|
||||
MOZ_ASSERT_IF(isAccessorDescriptor(),
|
||||
hasGetterObject() && hasSetterObject());
|
||||
MOZ_ASSERT_IF(isAccessorDescriptor(), hasGetter() && hasSetter());
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
@ -380,14 +379,14 @@ class WrappedPtrOperations<JS::PropertyDescriptor, Wrapper> {
|
|||
bool hasWritable() const { return desc().hasWritable(); }
|
||||
bool writable() const { return desc().writable(); }
|
||||
|
||||
bool hasGetterObject() const { return desc().hasGetterObject(); }
|
||||
bool hasGetter() const { return desc().hasGetter(); }
|
||||
JS::Handle<JSObject*> getterObject() const {
|
||||
MOZ_ASSERT(hasGetterObject());
|
||||
MOZ_ASSERT(hasGetter());
|
||||
return JS::Handle<JSObject*>::fromMarkedLocation(desc().getterDoNotUse());
|
||||
}
|
||||
bool hasSetterObject() const { return desc().hasSetterObject(); }
|
||||
bool hasSetter() const { return desc().hasSetter(); }
|
||||
JS::Handle<JSObject*> setterObject() const {
|
||||
MOZ_ASSERT(hasSetterObject());
|
||||
MOZ_ASSERT(hasSetter());
|
||||
return JS::Handle<JSObject*>::fromMarkedLocation(desc().setterDoNotUse());
|
||||
}
|
||||
|
||||
|
@ -420,12 +419,12 @@ class MutableWrappedPtrOperations<JS::PropertyDescriptor, Wrapper>
|
|||
void setSetterObject(JSObject* obj) { desc().setSetterObject(obj); }
|
||||
|
||||
JS::MutableHandle<JSObject*> getterObject() {
|
||||
MOZ_ASSERT(desc().hasGetterObject());
|
||||
MOZ_ASSERT(desc().hasGetter());
|
||||
return JS::MutableHandle<JSObject*>::fromMarkedLocation(
|
||||
desc().getterDoNotUse());
|
||||
}
|
||||
JS::MutableHandle<JSObject*> setterObject() {
|
||||
MOZ_ASSERT(desc().hasSetterObject());
|
||||
MOZ_ASSERT(desc().hasSetter());
|
||||
return JS::MutableHandle<JSObject*>::fromMarkedLocation(
|
||||
desc().setterDoNotUse());
|
||||
}
|
||||
|
|
|
@ -464,13 +464,13 @@ JSString* js::ObjectToSource(JSContext* cx, HandleObject obj) {
|
|||
}
|
||||
|
||||
if (desc->isAccessorDescriptor()) {
|
||||
if (desc->hasGetterObject() && desc->getterObject()) {
|
||||
if (desc->hasGetter() && desc->getterObject()) {
|
||||
val.setObject(*desc->getterObject());
|
||||
if (!AddProperty(id, val, PropertyKind::Getter)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
if (desc->hasSetterObject() && desc->setterObject()) {
|
||||
if (desc->hasSetter() && desc->setterObject()) {
|
||||
val.setObject(*desc->setterObject());
|
||||
if (!AddProperty(id, val, PropertyKind::Setter)) {
|
||||
return nullptr;
|
||||
|
|
|
@ -1557,7 +1557,7 @@ bool Debugger::unwrapPropertyDescriptor(
|
|||
desc.setValue(value);
|
||||
}
|
||||
|
||||
if (desc.hasGetterObject()) {
|
||||
if (desc.hasGetter()) {
|
||||
RootedObject get(cx, desc.getterObject());
|
||||
if (get) {
|
||||
if (!unwrapDebuggeeObject(cx, &get)) {
|
||||
|
@ -1570,7 +1570,7 @@ bool Debugger::unwrapPropertyDescriptor(
|
|||
desc.setGetterObject(get);
|
||||
}
|
||||
|
||||
if (desc.hasSetterObject()) {
|
||||
if (desc.hasSetter()) {
|
||||
RootedObject set(cx, desc.setterObject());
|
||||
if (set) {
|
||||
if (!unwrapDebuggeeObject(cx, &set)) {
|
||||
|
|
|
@ -2169,14 +2169,14 @@ bool DebuggerObject::getOwnPropertyDescriptor(
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if (desc.hasGetterObject()) {
|
||||
if (desc.hasGetter()) {
|
||||
RootedValue get(cx, ObjectOrNullValue(desc.getterObject()));
|
||||
if (!dbg->wrapDebuggeeValue(cx, &get)) {
|
||||
return false;
|
||||
}
|
||||
desc.setGetterObject(get.toObjectOrNull());
|
||||
}
|
||||
if (desc.hasSetterObject()) {
|
||||
if (desc.hasSetter()) {
|
||||
RootedValue set(cx, ObjectOrNullValue(desc.setterObject()));
|
||||
if (!dbg->wrapDebuggeeValue(cx, &set)) {
|
||||
return false;
|
||||
|
|
|
@ -39,8 +39,8 @@ BEGIN_TEST(testDefineGetterSetterNonEnumerable) {
|
|||
JS::Rooted<mozilla::Maybe<JS::PropertyDescriptor>> desc(cx);
|
||||
CHECK(JS_GetOwnPropertyDescriptor(cx, vObject, PROPERTY_NAME, &desc));
|
||||
CHECK(desc.isSome());
|
||||
CHECK(desc->hasGetterObject());
|
||||
CHECK(desc->hasSetterObject());
|
||||
CHECK(desc->hasGetter());
|
||||
CHECK(desc->hasSetter());
|
||||
CHECK(!desc->configurable());
|
||||
CHECK(!desc->enumerable());
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ bool js::SetPropertyIgnoringNamedGetter(
|
|||
// Step 6.
|
||||
MOZ_ASSERT(ownDesc.isAccessorDescriptor());
|
||||
RootedObject setter(cx);
|
||||
if (ownDesc.hasSetterObject()) {
|
||||
if (ownDesc.hasSetter()) {
|
||||
setter = ownDesc.setterObject();
|
||||
}
|
||||
if (!setter) {
|
||||
|
|
|
@ -81,7 +81,7 @@ static bool ProxyGetOnExpando(JSContext* cx, HandleObject proxy,
|
|||
MOZ_ASSERT(desc.isSome());
|
||||
|
||||
// If the private name has a getter, delegate to that.
|
||||
if (desc->hasGetterObject()) {
|
||||
if (desc->hasGetter()) {
|
||||
RootedValue getter(cx, JS::ObjectValue(*desc->getterObject()));
|
||||
return js::CallGetter(cx, receiver, getter, vp);
|
||||
}
|
||||
|
|
|
@ -53,21 +53,20 @@ static bool IsCompatiblePropertyDescriptor(
|
|||
}
|
||||
|
||||
// Step 3.
|
||||
if (!desc.hasValue() && !desc.hasWritable() && !desc.hasGetterObject() &&
|
||||
!desc.hasSetterObject() && !desc.hasEnumerable() &&
|
||||
!desc.hasConfigurable()) {
|
||||
if (!desc.hasValue() && !desc.hasWritable() && !desc.hasGetter() &&
|
||||
!desc.hasSetter() && !desc.hasEnumerable() && !desc.hasConfigurable()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Step 4.
|
||||
JSObject* currentGetter =
|
||||
current->hasGetterObject() ? current->getterObject() : nullptr;
|
||||
current->hasGetter() ? current->getterObject() : nullptr;
|
||||
JSObject* currentSetter =
|
||||
current->hasSetterObject() ? current->setterObject() : nullptr;
|
||||
current->hasSetter() ? current->setterObject() : nullptr;
|
||||
if ((!desc.hasWritable() ||
|
||||
(current->hasWritable() && desc.writable() == current->writable())) &&
|
||||
(!desc.hasGetterObject() || desc.getterObject() == currentGetter) &&
|
||||
(!desc.hasSetterObject() || desc.setterObject() == currentSetter) &&
|
||||
(!desc.hasGetter() || desc.getterObject() == currentGetter) &&
|
||||
(!desc.hasSetter() || desc.setterObject() == currentSetter) &&
|
||||
(!desc.hasEnumerable() || desc.enumerable() == current->enumerable()) &&
|
||||
(!desc.hasConfigurable() ||
|
||||
desc.configurable() == current->configurable())) {
|
||||
|
@ -162,12 +161,12 @@ static bool IsCompatiblePropertyDescriptor(
|
|||
if (current->configurable()) {
|
||||
return true;
|
||||
}
|
||||
if (desc.hasSetterObject() && desc.setterObject() != currentSetter) {
|
||||
if (desc.hasSetter() && desc.setterObject() != currentSetter) {
|
||||
static const char DETAILS_SETTERS_DIFFERENT[] =
|
||||
"proxy can't report different setters for a currently non-configurable "
|
||||
"property";
|
||||
*errorDetails = DETAILS_SETTERS_DIFFERENT;
|
||||
} else if (desc.hasGetterObject() && desc.getterObject() != currentGetter) {
|
||||
} else if (desc.hasGetter() && desc.getterObject() != currentGetter) {
|
||||
static const char DETAILS_GETTERS_DIFFERENT[] =
|
||||
"proxy can't report different getters for a currently non-configurable "
|
||||
"property";
|
||||
|
|
|
@ -407,12 +407,12 @@ bool Compartment::rewrap(JSContext* cx, MutableHandleObject obj,
|
|||
|
||||
bool Compartment::wrap(JSContext* cx,
|
||||
MutableHandle<JS::PropertyDescriptor> desc) {
|
||||
if (desc.hasGetterObject()) {
|
||||
if (desc.hasGetter()) {
|
||||
if (!wrap(cx, desc.getterObject())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (desc.hasSetterObject()) {
|
||||
if (desc.hasSetter()) {
|
||||
if (!wrap(cx, desc.setterObject())) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -181,10 +181,10 @@ class ContextChecks {
|
|||
void check(AbstractFramePtr frame, int argIndex);
|
||||
|
||||
void check(const PropertyDescriptor& desc, int argIndex) {
|
||||
if (desc.hasGetterObject()) {
|
||||
if (desc.hasGetter()) {
|
||||
check(desc.getterObject(), argIndex);
|
||||
}
|
||||
if (desc.hasSetterObject()) {
|
||||
if (desc.hasSetter()) {
|
||||
check(desc.setterObject(), argIndex);
|
||||
}
|
||||
if (desc.hasValue()) {
|
||||
|
|
|
@ -190,7 +190,7 @@ bool js::FromPropertyDescriptorToObject(JSContext* cx,
|
|||
}
|
||||
|
||||
// Step 6.
|
||||
if (desc.hasGetterObject()) {
|
||||
if (desc.hasGetter()) {
|
||||
if (JSObject* get = desc.getterObject()) {
|
||||
v.setObject(*get);
|
||||
} else {
|
||||
|
@ -202,7 +202,7 @@ bool js::FromPropertyDescriptorToObject(JSContext* cx,
|
|||
}
|
||||
|
||||
// Step 7.
|
||||
if (desc.hasSetterObject()) {
|
||||
if (desc.hasSetter()) {
|
||||
if (JSObject* set = desc.setterObject()) {
|
||||
v.setObject(*set);
|
||||
} else {
|
||||
|
@ -435,11 +435,11 @@ bool js::ToPropertyDescriptor(JSContext* cx, HandleValue descval,
|
|||
|
||||
Result<> js::CheckPropertyDescriptorAccessors(JSContext* cx,
|
||||
Handle<PropertyDescriptor> desc) {
|
||||
if (desc.hasGetterObject()) {
|
||||
if (desc.hasGetter()) {
|
||||
MOZ_TRY(CheckCallable(cx, desc.getterObject(), js_getter_str));
|
||||
}
|
||||
|
||||
if (desc.hasSetterObject()) {
|
||||
if (desc.hasSetter()) {
|
||||
MOZ_TRY(CheckCallable(cx, desc.setterObject(), js_setter_str));
|
||||
}
|
||||
|
||||
|
@ -468,11 +468,11 @@ void js::CompletePropertyDescriptor(MutableHandle<PropertyDescriptor> desc) {
|
|||
}
|
||||
} else {
|
||||
// Step 4.a.
|
||||
if (!desc.hasGetterObject()) {
|
||||
if (!desc.hasGetter()) {
|
||||
desc.setGetterObject(nullptr);
|
||||
}
|
||||
// Step 4.b.
|
||||
if (!desc.hasSetterObject()) {
|
||||
if (!desc.hasSetter()) {
|
||||
desc.setSetterObject(nullptr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1516,12 +1516,12 @@ static bool DefinePropertyIsRedundant(JSContext* cx, HandleNativeObject obj,
|
|||
return true;
|
||||
}
|
||||
PropertyInfo propInfo = prop.propertyInfo();
|
||||
if (desc.hasGetterObject() &&
|
||||
if (desc.hasGetter() &&
|
||||
(!propInfo.isAccessorProperty() ||
|
||||
desc.getterObject() != obj->getGetter(propInfo))) {
|
||||
return true;
|
||||
}
|
||||
if (desc.hasSetterObject() &&
|
||||
if (desc.hasSetter() &&
|
||||
(!propInfo.isAccessorProperty() ||
|
||||
desc.setterObject() != obj->getSetter(propInfo))) {
|
||||
return true;
|
||||
|
@ -1683,8 +1683,8 @@ bool js::NativeDefineProperty(JSContext* cx, HandleNativeObject obj,
|
|||
// everything from shape.
|
||||
MOZ_ASSERT(!desc.hasValue());
|
||||
MOZ_ASSERT(!desc.hasWritable());
|
||||
MOZ_ASSERT(!desc.hasGetterObject());
|
||||
MOZ_ASSERT(!desc.hasSetterObject());
|
||||
MOZ_ASSERT(!desc.hasGetter());
|
||||
MOZ_ASSERT(!desc.hasSetter());
|
||||
if (IsDataDescriptor(prop)) {
|
||||
RootedValue currentValue(cx);
|
||||
if (!GetExistingDataProperty(cx, obj, id, prop, ¤tValue)) {
|
||||
|
@ -1753,7 +1753,7 @@ bool js::NativeDefineProperty(JSContext* cx, HandleNativeObject obj,
|
|||
|
||||
// The spec says to use SameValue, but since the values in
|
||||
// question are objects, we can just compare pointers.
|
||||
if (desc.hasSetterObject()) {
|
||||
if (desc.hasSetter()) {
|
||||
// Step 8.a.i.
|
||||
if (!attrs.configurable() &&
|
||||
desc.setterObject() != obj->getSetter(propInfo)) {
|
||||
|
@ -1763,7 +1763,7 @@ bool js::NativeDefineProperty(JSContext* cx, HandleNativeObject obj,
|
|||
// Fill in desc.[[Set]] from shape.
|
||||
desc.setSetterObject(obj->getSetter(propInfo));
|
||||
}
|
||||
if (desc.hasGetterObject()) {
|
||||
if (desc.hasGetter()) {
|
||||
// Step 8.a.ii.
|
||||
if (!attrs.configurable() &&
|
||||
desc.getterObject() != obj->getGetter(propInfo)) {
|
||||
|
|
|
@ -722,11 +722,11 @@ bool SandboxProxyHandler::getPropertyDescriptorImpl(
|
|||
Rooted<PropertyDescriptor> desc(cx, *desc_);
|
||||
|
||||
// Now fix up the getter/setter/value as needed.
|
||||
if (desc.hasGetterObject() &&
|
||||
if (desc.hasGetter() &&
|
||||
!WrapAccessorFunction(cx, desc.getterObject(), proxy)) {
|
||||
return false;
|
||||
}
|
||||
if (desc.hasSetterObject() &&
|
||||
if (desc.hasSetter() &&
|
||||
!WrapAccessorFunction(cx, desc.setterObject(), proxy)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -30,14 +30,14 @@ bool WaiveXrayWrapper::getOwnPropertyDescriptor(
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if (desc_.hasGetterObject() && desc_.getterObject()) {
|
||||
if (desc_.hasGetter() && desc_.getterObject()) {
|
||||
RootedValue v(cx, JS::ObjectValue(*desc_.getterObject()));
|
||||
if (!WrapperFactory::WaiveXrayAndWrap(cx, &v)) {
|
||||
return false;
|
||||
}
|
||||
desc_.setGetterObject(&v.toObject());
|
||||
}
|
||||
if (desc_.hasSetterObject() && desc_.setterObject()) {
|
||||
if (desc_.hasSetter() && desc_.setterObject()) {
|
||||
RootedValue v(cx, JS::ObjectValue(*desc_.setterObject()));
|
||||
if (!WrapperFactory::WaiveXrayAndWrap(cx, &v)) {
|
||||
return false;
|
||||
|
|
|
@ -1881,9 +1881,9 @@ static bool RecreateLostWaivers(JSContext* cx, const PropertyDescriptor* orig,
|
|||
bool valueWasWaived =
|
||||
orig->hasValue() && orig->value().isObject() &&
|
||||
WrapperFactory::HasWaiveXrayFlag(&orig->value().toObject());
|
||||
bool getterWasWaived = orig->hasGetterObject() && orig->getterObject() &&
|
||||
bool getterWasWaived = orig->hasGetter() && orig->getterObject() &&
|
||||
WrapperFactory::HasWaiveXrayFlag(orig->getterObject());
|
||||
bool setterWasWaived = orig->hasSetterObject() && orig->setterObject() &&
|
||||
bool setterWasWaived = orig->hasSetter() && orig->setterObject() &&
|
||||
WrapperFactory::HasWaiveXrayFlag(orig->setterObject());
|
||||
|
||||
// Recreate waivers. Note that for value, we need an extra UncheckedUnwrap
|
||||
|
|
Загрузка…
Ссылка в новой задаче