mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset e737de5b209b (bug 1103368)
This commit is contained in:
parent
2d3d66f571
commit
1fb6419611
@ -2224,14 +2224,10 @@ IteratorResultShape(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned *shape)
|
||||
Rooted<jsid> done_id(cx, AtomToId(cx->names().done));
|
||||
if (!DefineNativeProperty(cx, obj, value_id, UndefinedHandleValue, nullptr, nullptr,
|
||||
JSPROP_ENUMERATE))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!DefineNativeProperty(cx, obj, done_id, UndefinedHandleValue, nullptr, nullptr,
|
||||
JSPROP_ENUMERATE))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ObjectBox *objbox = bce->parser->newObjectBox(obj);
|
||||
if (!objbox)
|
||||
@ -6499,8 +6495,8 @@ EmitObject(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
MOZ_ASSERT(!obj->inDictionaryMode());
|
||||
Rooted<jsid> id(cx, AtomToId(key->pn_atom));
|
||||
RootedValue undefinedValue(cx, UndefinedValue());
|
||||
if (!DefineNativeProperty(cx, obj, id, undefinedValue, nullptr, nullptr,
|
||||
JSPROP_ENUMERATE))
|
||||
if (!DefineNativeProperty(cx, obj, id, undefinedValue, nullptr,
|
||||
nullptr, JSPROP_ENUMERATE))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -7934,8 +7934,8 @@ DoSetPropFallback(JSContext *cx, BaselineFrame *frame, ICSetProp_Fallback *stub_
|
||||
|
||||
if (op == JSOP_INITPROP) {
|
||||
MOZ_ASSERT(obj->is<JSObject>());
|
||||
if (!DefineNativeProperty(cx, obj.as<NativeObject>(), id, rhs, nullptr, nullptr,
|
||||
JSPROP_ENUMERATE))
|
||||
if (!DefineNativeProperty(cx, obj.as<NativeObject>(), id, rhs,
|
||||
nullptr, nullptr, JSPROP_ENUMERATE))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -3013,7 +3013,7 @@ FinishDateClassInit(JSContext *cx, HandleObject ctor, HandleObject proto)
|
||||
RootedId toGMTStringId(cx, NameToId(cx->names().toGMTString));
|
||||
return baseops::GetProperty(cx, proto.as<NativeObject>(), toUTCStringId, &toUTCStringFun) &&
|
||||
baseops::DefineGeneric(cx, proto.as<NativeObject>(), toGMTStringId, toUTCStringFun,
|
||||
nullptr, nullptr, 0);
|
||||
JS_PropertyStub, JS_StrictPropertyStub, 0);
|
||||
}
|
||||
|
||||
const Class DateObject::class_ = {
|
||||
|
@ -499,7 +499,7 @@ js::fun_resolve(JSContext *cx, HandleObject obj, HandleId id, bool *resolvedp)
|
||||
v.setString(fun->atom() == nullptr ? cx->runtime()->emptyString : fun->atom());
|
||||
}
|
||||
|
||||
if (!DefineNativeProperty(cx, fun, id, v, nullptr, nullptr,
|
||||
if (!DefineNativeProperty(cx, fun, id, v, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JSPROP_PERMANENT | JSPROP_READONLY)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1212,9 +1212,11 @@ js_InitNumberClass(JSContext *cx, HandleObject obj)
|
||||
RootedValue valueInfinity(cx, cx->runtime()->positiveInfinityValue);
|
||||
|
||||
/* ES5 15.1.1.1, 15.1.1.2 */
|
||||
if (!DefineNativeProperty(cx, global, cx->names().NaN, valueNaN, nullptr, nullptr,
|
||||
if (!DefineNativeProperty(cx, global, cx->names().NaN, valueNaN,
|
||||
JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JSPROP_PERMANENT | JSPROP_READONLY) ||
|
||||
!DefineNativeProperty(cx, global, cx->names().Infinity, valueInfinity, nullptr, nullptr,
|
||||
!DefineNativeProperty(cx, global, cx->names().Infinity, valueInfinity,
|
||||
JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JSPROP_PERMANENT | JSPROP_READONLY))
|
||||
{
|
||||
return nullptr;
|
||||
|
@ -742,7 +742,9 @@ DefinePropertyOnObject(JSContext *cx, HandleNativeObject obj, HandleId id, const
|
||||
if (desc.isGenericDescriptor() || desc.isDataDescriptor()) {
|
||||
MOZ_ASSERT(!obj->getOps()->defineProperty);
|
||||
RootedValue v(cx, desc.hasValue() ? desc.value() : UndefinedValue());
|
||||
return baseops::DefineGeneric(cx, obj, id, v, nullptr, nullptr, desc.attributes());
|
||||
return baseops::DefineGeneric(cx, obj, id, v,
|
||||
JS_PropertyStub, JS_StrictPropertyStub,
|
||||
desc.attributes());
|
||||
}
|
||||
|
||||
MOZ_ASSERT(desc.isAccessorDescriptor());
|
||||
@ -949,8 +951,8 @@ DefinePropertyOnObject(JSContext *cx, HandleNativeObject obj, HandleId id, const
|
||||
changed |= JSPROP_ENUMERATE;
|
||||
|
||||
attrs = (shapeAttributes & ~changed) | (desc.attributes() & changed);
|
||||
getter = IsImplicitDenseOrTypedArrayElement(shape) ? nullptr : shape->getter();
|
||||
setter = IsImplicitDenseOrTypedArrayElement(shape) ? nullptr : shape->setter();
|
||||
getter = IsImplicitDenseOrTypedArrayElement(shape) ? JS_PropertyStub : shape->getter();
|
||||
setter = IsImplicitDenseOrTypedArrayElement(shape) ? JS_StrictPropertyStub : shape->setter();
|
||||
} else if (desc.isDataDescriptor()) {
|
||||
unsigned unchanged = 0;
|
||||
if (!desc.hasConfigurable())
|
||||
@ -964,8 +966,8 @@ DefinePropertyOnObject(JSContext *cx, HandleNativeObject obj, HandleId id, const
|
||||
if (desc.hasValue())
|
||||
v = desc.value();
|
||||
attrs = (desc.attributes() & ~unchanged) | (shapeAttributes & unchanged);
|
||||
getter = nullptr;
|
||||
setter = nullptr;
|
||||
getter = JS_PropertyStub;
|
||||
setter = JS_StrictPropertyStub;
|
||||
} else {
|
||||
MOZ_ASSERT(desc.isAccessorDescriptor());
|
||||
|
||||
@ -985,14 +987,14 @@ DefinePropertyOnObject(JSContext *cx, HandleNativeObject obj, HandleId id, const
|
||||
getter = desc.getter();
|
||||
} else {
|
||||
getter = (shapeHasDefaultGetter && !shapeHasGetterValue)
|
||||
? nullptr
|
||||
? JS_PropertyStub
|
||||
: shape->getter();
|
||||
}
|
||||
if (desc.hasSet()) {
|
||||
setter = desc.setter();
|
||||
} else {
|
||||
setter = (shapeHasDefaultSetter && !shapeHasSetterValue)
|
||||
? nullptr
|
||||
? JS_StrictPropertyStub
|
||||
: shape->setter();
|
||||
}
|
||||
}
|
||||
@ -2246,11 +2248,8 @@ js::XDRObjectLiteral(XDRState<mode> *xdr, MutableHandleNativeObject obj)
|
||||
return false;
|
||||
|
||||
if (mode == XDR_DECODE) {
|
||||
if (!DefineNativeProperty(cx, obj, id, tmpValue, nullptr, nullptr,
|
||||
JSPROP_ENUMERATE))
|
||||
{
|
||||
if (!DefineNativeProperty(cx, obj, id, tmpValue, NULL, NULL, JSPROP_ENUMERATE))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3029,15 +3028,6 @@ JSObject::defineGeneric(ExclusiveContext *cx, HandleObject obj,
|
||||
return false;
|
||||
return op(cx->asJSContext(), obj, id, value, getter, setter, attrs);
|
||||
}
|
||||
|
||||
if (getter == nullptr)
|
||||
getter = obj->getClass()->getProperty;
|
||||
if (setter == nullptr)
|
||||
setter = obj->getClass()->setProperty;
|
||||
if (getter == JS_PropertyStub)
|
||||
getter = nullptr;
|
||||
if (setter == JS_StrictPropertyStub)
|
||||
setter = nullptr;
|
||||
return baseops::DefineGeneric(cx, obj.as<NativeObject>(), id, value, getter, setter, attrs);
|
||||
}
|
||||
|
||||
@ -3061,15 +3051,6 @@ JSObject::defineElement(ExclusiveContext *cx, HandleObject obj,
|
||||
return false;
|
||||
return op(cx->asJSContext(), obj, index, value, getter, setter, attrs);
|
||||
}
|
||||
|
||||
if (!getter)
|
||||
getter = obj->getClass()->getProperty;
|
||||
if (!setter)
|
||||
setter = obj->getClass()->setProperty;
|
||||
if (getter == JS_PropertyStub)
|
||||
getter = nullptr;
|
||||
if (setter == JS_StrictPropertyStub)
|
||||
setter = nullptr;
|
||||
return baseops::DefineElement(cx, obj.as<NativeObject>(), index, value, getter, setter, attrs);
|
||||
}
|
||||
|
||||
|
@ -668,8 +668,11 @@ js_Stringify(JSContext *cx, MutableHandleValue vp, JSObject *replacer_, Value sp
|
||||
|
||||
/* Step 10. */
|
||||
RootedId emptyId(cx, NameToId(cx->names().empty));
|
||||
if (!DefineNativeProperty(cx, wrapper, emptyId, vp, nullptr, nullptr, JSPROP_ENUMERATE))
|
||||
if (!DefineNativeProperty(cx, wrapper, emptyId, vp, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JSPROP_ENUMERATE))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Step 11. */
|
||||
StringifyContext scx(cx, sb, gap, replacer, propertyList);
|
||||
|
@ -346,11 +346,12 @@ ArgSetter(JSContext *cx, HandleObject obj, HandleId id, bool strict, MutableHand
|
||||
}
|
||||
|
||||
/*
|
||||
* For simplicity we use delete/define to replace the property with a
|
||||
* simple data property. Note that we rely on args_delProperty to clear the
|
||||
* corresponding reserved slot so the GC can collect its value. Note also
|
||||
* that we must define the property instead of setting it in case the user
|
||||
* has changed the prototype to an object that has a setter for this id.
|
||||
* For simplicity we use delete/define to replace the property with one
|
||||
* backed by the default Object getter and setter. Note that we rely on
|
||||
* args_delProperty to clear the corresponding reserved slot so the GC can
|
||||
* collect its value. Note also that we must define the property instead
|
||||
* of setting it in case the user has changed the prototype to an object
|
||||
* that has a setter for this id.
|
||||
*/
|
||||
bool succeeded;
|
||||
return baseops::DeleteGeneric(cx, argsobj, id, &succeeded) &&
|
||||
@ -461,9 +462,10 @@ StrictArgSetter(JSContext *cx, HandleObject obj, HandleId id, bool strict, Mutab
|
||||
}
|
||||
|
||||
/*
|
||||
* For simplicity we use delete/define to replace the property with a
|
||||
* simple data property. Note that we rely on args_delProperty to clear the
|
||||
* corresponding reserved slot so the GC can collect its value.
|
||||
* For simplicity we use delete/define to replace the property with one
|
||||
* backed by the default Object getter and setter. Note that we rely on
|
||||
* args_delProperty to clear the corresponding reserved slot so the GC can
|
||||
* collect its value.
|
||||
*/
|
||||
bool succeeded;
|
||||
return baseops::DeleteGeneric(cx, argsobj, id, &succeeded) &&
|
||||
|
@ -1048,7 +1048,8 @@ Debugger::newCompletionValue(JSContext *cx, JSTrapStatus status, Value value_,
|
||||
RootedNativeObject obj(cx, NewNativeBuiltinClassInstance(cx, &JSObject::class_));
|
||||
if (!obj ||
|
||||
!wrapDebuggeeValue(cx, &value) ||
|
||||
!DefineNativeProperty(cx, obj, key, value, nullptr, nullptr, JSPROP_ENUMERATE))
|
||||
!DefineNativeProperty(cx, obj, key, value, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JSPROP_ENUMERATE))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -5437,7 +5438,8 @@ DebuggerFrame_getArguments(JSContext *cx, unsigned argc, Value *vp)
|
||||
MOZ_ASSERT(frame.numActualArgs() <= 0x7fffffff);
|
||||
unsigned fargc = frame.numActualArgs();
|
||||
RootedValue fargcVal(cx, Int32Value(fargc));
|
||||
if (!DefineNativeProperty(cx, argsobj, cx->names().length, fargcVal, nullptr, nullptr,
|
||||
if (!DefineNativeProperty(cx, argsobj, cx->names().length,
|
||||
fargcVal, nullptr, nullptr,
|
||||
JSPROP_PERMANENT | JSPROP_READONLY))
|
||||
{
|
||||
return false;
|
||||
|
@ -606,8 +606,10 @@ JSONParserBase::createFinishedObject(PropertyVector &properties)
|
||||
for (size_t i = 0; i < properties.length(); i++) {
|
||||
propid = properties[i].id;
|
||||
value = properties[i].value;
|
||||
if (!DefineNativeProperty(cx, obj, propid, value, nullptr, nullptr, JSPROP_ENUMERATE))
|
||||
if (!DefineNativeProperty(cx, obj, propid, value, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JSPROP_ENUMERATE)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -648,9 +648,6 @@ DefineNativeProperty(ExclusiveContext *cx, HandleNativeObject obj,
|
||||
PropertyName *name, HandleValue value,
|
||||
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
|
||||
{
|
||||
MOZ_ASSERT(getter != JS_PropertyStub);
|
||||
MOZ_ASSERT(setter != JS_StrictPropertyStub);
|
||||
|
||||
RootedId id(cx, NameToId(name));
|
||||
return DefineNativeProperty(cx, obj, id, value, getter, setter, attrs);
|
||||
}
|
||||
|
@ -1072,10 +1072,11 @@ NativeObject::addDataProperty(ExclusiveContext *cx, HandlePropertyName name,
|
||||
template <ExecutionMode mode>
|
||||
static inline bool
|
||||
CallAddPropertyHook(typename ExecutionModeTraits<mode>::ExclusiveContextType cxArg,
|
||||
HandleNativeObject obj, HandleShape shape, HandleValue nominal)
|
||||
const Class *clasp, HandleNativeObject obj, HandleShape shape,
|
||||
HandleValue nominal)
|
||||
{
|
||||
if (JSPropertyOp addProperty = obj->getClass()->addProperty) {
|
||||
MOZ_ASSERT(addProperty != JS_PropertyStub);
|
||||
if (clasp->addProperty) {
|
||||
MOZ_ASSERT(clasp->addProperty != JS_PropertyStub);
|
||||
|
||||
if (mode == ParallelExecution)
|
||||
return false;
|
||||
@ -1088,7 +1089,7 @@ CallAddPropertyHook(typename ExecutionModeTraits<mode>::ExclusiveContextType cxA
|
||||
RootedValue value(cx, nominal);
|
||||
|
||||
Rooted<jsid> id(cx, shape->propid());
|
||||
if (!CallJSPropertyOp(cx->asJSContext(), addProperty, obj, id, &value)) {
|
||||
if (!CallJSPropertyOp(cx->asJSContext(), clasp->addProperty, obj, id, &value)) {
|
||||
obj->removeProperty(cx, shape->propid());
|
||||
return false;
|
||||
}
|
||||
@ -1103,7 +1104,8 @@ CallAddPropertyHook(typename ExecutionModeTraits<mode>::ExclusiveContextType cxA
|
||||
template <ExecutionMode mode>
|
||||
static inline bool
|
||||
CallAddPropertyHookDense(typename ExecutionModeTraits<mode>::ExclusiveContextType cxArg,
|
||||
HandleNativeObject obj, uint32_t index, HandleValue nominal)
|
||||
const Class *clasp, HandleNativeObject obj, uint32_t index,
|
||||
HandleValue nominal)
|
||||
{
|
||||
/* Inline addProperty for array objects. */
|
||||
if (obj->is<ArrayObject>()) {
|
||||
@ -1122,8 +1124,8 @@ CallAddPropertyHookDense(typename ExecutionModeTraits<mode>::ExclusiveContextTyp
|
||||
return true;
|
||||
}
|
||||
|
||||
if (JSPropertyOp addProperty = obj->getClass()->addProperty) {
|
||||
MOZ_ASSERT(addProperty != JS_PropertyStub);
|
||||
if (clasp->addProperty) {
|
||||
MOZ_ASSERT(clasp->addProperty != JS_PropertyStub);
|
||||
|
||||
if (mode == ParallelExecution)
|
||||
return false;
|
||||
@ -1139,7 +1141,7 @@ CallAddPropertyHookDense(typename ExecutionModeTraits<mode>::ExclusiveContextTyp
|
||||
RootedValue value(cx, nominal);
|
||||
|
||||
Rooted<jsid> id(cx, INT_TO_JSID(index));
|
||||
if (!CallJSPropertyOp(cx->asJSContext(), addProperty, obj, id, &value)) {
|
||||
if (!CallJSPropertyOp(cx->asJSContext(), clasp->addProperty, obj, id, &value)) {
|
||||
obj->setDenseElementHole(cx, index);
|
||||
return false;
|
||||
}
|
||||
@ -1205,13 +1207,10 @@ DefinePropertyOrElement(typename ExecutionModeTraits<mode>::ExclusiveContextType
|
||||
unsigned attrs, HandleValue value,
|
||||
bool callSetterAfterwards, bool setterIsStrict)
|
||||
{
|
||||
MOZ_ASSERT(getter != JS_PropertyStub);
|
||||
MOZ_ASSERT(setter != JS_StrictPropertyStub);
|
||||
|
||||
/* Use dense storage for new indexed properties where possible. */
|
||||
if (JSID_IS_INT(id) &&
|
||||
!getter &&
|
||||
!setter &&
|
||||
getter == JS_PropertyStub &&
|
||||
setter == JS_StrictPropertyStub &&
|
||||
attrs == JSPROP_ENUMERATE &&
|
||||
(!obj->isIndexed() || !obj->containsPure(id)) &&
|
||||
!IsAnyTypedArray(obj))
|
||||
@ -1241,7 +1240,7 @@ DefinePropertyOrElement(typename ExecutionModeTraits<mode>::ExclusiveContextType
|
||||
} else {
|
||||
obj->setDenseElementWithType(cx->asExclusiveContext(), index, value);
|
||||
}
|
||||
return CallAddPropertyHookDense<mode>(cx, obj, index, value);
|
||||
return CallAddPropertyHookDense<mode>(cx, obj->getClass(), obj, index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1272,6 +1271,11 @@ DefinePropertyOrElement(typename ExecutionModeTraits<mode>::ExclusiveContextType
|
||||
}
|
||||
|
||||
AutoRooterGetterSetter gsRoot(cx, attrs, &getter, &setter);
|
||||
|
||||
if (getter == JS_PropertyStub)
|
||||
getter = nullptr;
|
||||
if (setter == JS_StrictPropertyStub)
|
||||
setter = nullptr;
|
||||
RootedShape shape(cx, NativeObject::putProperty<mode>(cx, obj, id, getter, setter,
|
||||
SHAPE_INVALID_SLOT, attrs, 0));
|
||||
if (!shape)
|
||||
@ -1299,11 +1303,11 @@ DefinePropertyOrElement(typename ExecutionModeTraits<mode>::ExclusiveContextType
|
||||
return false;
|
||||
if (result == NativeObject::ED_OK) {
|
||||
MOZ_ASSERT(!setter);
|
||||
return CallAddPropertyHookDense<mode>(cx, obj, index, value);
|
||||
return CallAddPropertyHookDense<mode>(cx, obj->getClass(), obj, index, value);
|
||||
}
|
||||
}
|
||||
|
||||
if (!CallAddPropertyHook<mode>(cx, obj, shape, value))
|
||||
if (!CallAddPropertyHook<mode>(cx, obj->getClass(), obj, shape, value))
|
||||
return false;
|
||||
|
||||
if (callSetterAfterwards && setter) {
|
||||
@ -1401,8 +1405,6 @@ bool
|
||||
js::DefineNativeProperty(ExclusiveContext *cx, HandleNativeObject obj, HandleId id, HandleValue value,
|
||||
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
|
||||
{
|
||||
MOZ_ASSERT(getter != JS_PropertyStub);
|
||||
MOZ_ASSERT(setter != JS_StrictPropertyStub);
|
||||
MOZ_ASSERT(!(attrs & JSPROP_PROPOP_ACCESSORS));
|
||||
|
||||
AutoRooterGetterSetter gsRoot(cx, attrs, &getter, &setter);
|
||||
@ -1435,6 +1437,10 @@ js::DefineNativeProperty(ExclusiveContext *cx, HandleNativeObject obj, HandleId
|
||||
}
|
||||
if (shape->isAccessorDescriptor()) {
|
||||
attrs = ApplyOrDefaultAttributes(attrs, shape);
|
||||
if (getter == JS_PropertyStub)
|
||||
getter = nullptr;
|
||||
if (setter == JS_StrictPropertyStub)
|
||||
setter = nullptr;
|
||||
shape = NativeObject::changeProperty<SequentialExecution>(cx, obj, shape, attrs,
|
||||
JSPROP_GETTER | JSPROP_SETTER,
|
||||
(attrs & JSPROP_GETTER)
|
||||
@ -1508,6 +1514,13 @@ js::DefineNativeProperty(ExclusiveContext *cx, HandleNativeObject obj, HandleId
|
||||
if (!PurgeScopeChain(cx, obj, id))
|
||||
return false;
|
||||
|
||||
/* Use the object's class getter and setter by default. */
|
||||
const Class *clasp = obj->getClass();
|
||||
if (!getter && !(attrs & JSPROP_GETTER))
|
||||
getter = clasp->getProperty;
|
||||
if (!setter && !(attrs & JSPROP_SETTER))
|
||||
setter = clasp->setProperty;
|
||||
|
||||
if (shouldDefine) {
|
||||
// Handle the default cases here. Anyone that wanted to set non-default attributes has
|
||||
// cleared the IGNORE flags by now. Since we can never get here with JSPROP_IGNORE_VALUE
|
||||
@ -1521,7 +1534,7 @@ js::DefineNativeProperty(ExclusiveContext *cx, HandleNativeObject obj, HandleId
|
||||
|
||||
JS_ALWAYS_TRUE(UpdateShapeTypeAndValue<SequentialExecution>(cx, obj, shape, updateValue));
|
||||
|
||||
return CallAddPropertyHook<SequentialExecution>(cx, obj, shape, updateValue);
|
||||
return CallAddPropertyHook<SequentialExecution>(cx, clasp, obj, shape, updateValue);
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -1995,13 +2008,8 @@ SetPropertyByDefining(typename ExecutionModeTraits<mode>::ContextType cxArg,
|
||||
clasp->getProperty, clasp->setProperty, JSPROP_ENUMERATE);
|
||||
}
|
||||
Rooted<NativeObject*> nativeReceiver(cxArg, &receiver->as<NativeObject>());
|
||||
JSPropertyOp getter = clasp->getProperty;
|
||||
if (getter == JS_PropertyStub)
|
||||
getter = nullptr;
|
||||
JSStrictPropertyOp setter = clasp->setProperty;
|
||||
if (setter == JS_StrictPropertyStub)
|
||||
setter = nullptr;
|
||||
return DefinePropertyOrElement<mode>(cxArg, nativeReceiver, id, getter, setter,
|
||||
return DefinePropertyOrElement<mode>(cxArg, nativeReceiver, id,
|
||||
clasp->getProperty, clasp->setProperty,
|
||||
JSPROP_ENUMERATE, v, true, strict);
|
||||
}
|
||||
|
||||
|
@ -719,19 +719,15 @@ RegExpCompartment::createMatchResultTemplateObject(JSContext *cx)
|
||||
|
||||
/* Set dummy index property */
|
||||
RootedValue index(cx, Int32Value(0));
|
||||
if (!baseops::DefineProperty(cx, templateObject, cx->names().index, index, nullptr, nullptr,
|
||||
JSPROP_ENUMERATE))
|
||||
{
|
||||
if (!baseops::DefineProperty(cx, templateObject, cx->names().index, index,
|
||||
JS_PropertyStub, JS_StrictPropertyStub, JSPROP_ENUMERATE))
|
||||
return matchResultTemplateObject_; // = nullptr
|
||||
}
|
||||
|
||||
/* Set dummy input property */
|
||||
RootedValue inputVal(cx, StringValue(cx->runtime()->emptyString));
|
||||
if (!baseops::DefineProperty(cx, templateObject, cx->names().input, inputVal, nullptr, nullptr,
|
||||
JSPROP_ENUMERATE))
|
||||
{
|
||||
if (!baseops::DefineProperty(cx, templateObject, cx->names().input, inputVal,
|
||||
JS_PropertyStub, JS_StrictPropertyStub, JSPROP_ENUMERATE))
|
||||
return matchResultTemplateObject_; // = nullptr
|
||||
}
|
||||
|
||||
// Make sure that the properties are in the right slots.
|
||||
DebugOnly<Shape *> shape = templateObject->lastProperty();
|
||||
|
Loading…
Reference in New Issue
Block a user