зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1153592 part 2 - Remove JSPROP_SHARED; ensure accessor props don't have slots. r=evilpie
This commit is contained in:
Родитель
c6ddca339e
Коммит
dbca189324
|
@ -2732,8 +2732,7 @@ class AttrDefiner(PropertyDefiner):
|
||||||
|
|
||||||
def flags(attr):
|
def flags(attr):
|
||||||
unforgeable = " | JSPROP_PERMANENT" if self.unforgeable else ""
|
unforgeable = " | JSPROP_PERMANENT" if self.unforgeable else ""
|
||||||
enumerable = " | %s" % EnumerabilityFlags(attr)
|
return EnumerabilityFlags(attr) + unforgeable
|
||||||
return ("JSPROP_SHARED" + enumerable + unforgeable)
|
|
||||||
|
|
||||||
def getter(attr):
|
def getter(attr):
|
||||||
if self.static:
|
if self.static:
|
||||||
|
|
|
@ -1660,7 +1660,7 @@ Console::PopulateConsoleNotificationInTheTargetScope(JSContext* aCx,
|
||||||
if (NS_WARN_IF(!JS_DefineProperty(aCx, eventObj, "stacktrace",
|
if (NS_WARN_IF(!JS_DefineProperty(aCx, eventObj, "stacktrace",
|
||||||
JS_DATA_TO_FUNC_PTR(JSNative, funObj.get()),
|
JS_DATA_TO_FUNC_PTR(JSNative, funObj.get()),
|
||||||
nullptr,
|
nullptr,
|
||||||
JSPROP_ENUMERATE | JSPROP_SHARED |
|
JSPROP_ENUMERATE |
|
||||||
JSPROP_GETTER | JSPROP_SETTER))) {
|
JSPROP_GETTER | JSPROP_SETTER))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public:
|
||||||
const char16_t* GetName() const { return mName; }
|
const char16_t* GetName() const { return mName; }
|
||||||
|
|
||||||
unsigned AccessorAttributes() const {
|
unsigned AccessorAttributes() const {
|
||||||
return JSPROP_SHARED | JSPROP_GETTER | JSPROP_SETTER |
|
return JSPROP_GETTER | JSPROP_SETTER |
|
||||||
(mJSAttributes & (JSPROP_ENUMERATE | JSPROP_PERMANENT));
|
(mJSAttributes & (JSPROP_ENUMERATE | JSPROP_PERMANENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ nsXBLProtoImplProperty::CompileMember(AutoJSAPI& jsapi, const nsString& aClassSt
|
||||||
mGetter.SetJSFunction(getterObject);
|
mGetter.SetJSFunction(getterObject);
|
||||||
|
|
||||||
if (mGetter.GetJSFunction() && NS_SUCCEEDED(rv)) {
|
if (mGetter.GetJSFunction() && NS_SUCCEEDED(rv)) {
|
||||||
mJSAttributes |= JSPROP_GETTER | JSPROP_SHARED;
|
mJSAttributes |= JSPROP_GETTER;
|
||||||
}
|
}
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
mGetter.SetJSFunction(nullptr);
|
mGetter.SetJSFunction(nullptr);
|
||||||
|
@ -259,7 +259,7 @@ nsXBLProtoImplProperty::CompileMember(AutoJSAPI& jsapi, const nsString& aClassSt
|
||||||
mSetter.SetJSFunction(setterObject);
|
mSetter.SetJSFunction(setterObject);
|
||||||
|
|
||||||
if (mSetter.GetJSFunction() && NS_SUCCEEDED(rv)) {
|
if (mSetter.GetJSFunction() && NS_SUCCEEDED(rv)) {
|
||||||
mJSAttributes |= JSPROP_SETTER | JSPROP_SHARED;
|
mJSAttributes |= JSPROP_SETTER;
|
||||||
}
|
}
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
mSetter.SetJSFunction(nullptr);
|
mSetter.SetJSFunction(nullptr);
|
||||||
|
@ -308,7 +308,7 @@ nsXBLProtoImplProperty::Read(nsIObjectInputStream* aStream,
|
||||||
nsresult rv = XBL_DeserializeFunction(aStream, &getterObject);
|
nsresult rv = XBL_DeserializeFunction(aStream, &getterObject);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
mJSAttributes |= JSPROP_GETTER | JSPROP_SHARED;
|
mJSAttributes |= JSPROP_GETTER;
|
||||||
}
|
}
|
||||||
mGetter.SetJSFunction(getterObject);
|
mGetter.SetJSFunction(getterObject);
|
||||||
|
|
||||||
|
@ -318,7 +318,7 @@ nsXBLProtoImplProperty::Read(nsIObjectInputStream* aStream,
|
||||||
nsresult rv = XBL_DeserializeFunction(aStream, &setterObject);
|
nsresult rv = XBL_DeserializeFunction(aStream, &setterObject);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
mJSAttributes |= JSPROP_SETTER | JSPROP_SHARED;
|
mJSAttributes |= JSPROP_SETTER;
|
||||||
}
|
}
|
||||||
mSetter.SetJSFunction(setterObject);
|
mSetter.SetJSFunction(setterObject);
|
||||||
|
|
||||||
|
|
|
@ -6120,7 +6120,7 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsOb
|
||||||
nameChars.twoByteChars(), name->length(),
|
nameChars.twoByteChars(), name->length(),
|
||||||
JS_DATA_TO_FUNC_PTR(JSNative, getterObj.get()),
|
JS_DATA_TO_FUNC_PTR(JSNative, getterObj.get()),
|
||||||
JS_DATA_TO_FUNC_PTR(JSNative, setterObj.get()),
|
JS_DATA_TO_FUNC_PTR(JSNative, setterObj.get()),
|
||||||
JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_GETTER | JSPROP_SETTER))
|
JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_GETTER | JSPROP_SETTER))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,12 +36,12 @@ BEGIN_TEST(testDefineGetterSetterNonEnumerable)
|
||||||
CHECK(JS_DefineProperty(cx, vObject, PROPERTY_NAME,
|
CHECK(JS_DefineProperty(cx, vObject, PROPERTY_NAME,
|
||||||
JS_DATA_TO_FUNC_PTR(JSNative, (JSObject*) funGetObj),
|
JS_DATA_TO_FUNC_PTR(JSNative, (JSObject*) funGetObj),
|
||||||
JS_DATA_TO_FUNC_PTR(JSNative, (JSObject*) funSetObj),
|
JS_DATA_TO_FUNC_PTR(JSNative, (JSObject*) funSetObj),
|
||||||
JSPROP_GETTER | JSPROP_SETTER | JSPROP_SHARED | JSPROP_ENUMERATE));
|
JSPROP_GETTER | JSPROP_SETTER | JSPROP_ENUMERATE));
|
||||||
|
|
||||||
CHECK(JS_DefineProperty(cx, vObject, PROPERTY_NAME,
|
CHECK(JS_DefineProperty(cx, vObject, PROPERTY_NAME,
|
||||||
JS_DATA_TO_FUNC_PTR(JSNative, (JSObject*) funGetObj),
|
JS_DATA_TO_FUNC_PTR(JSNative, (JSObject*) funGetObj),
|
||||||
JS_DATA_TO_FUNC_PTR(JSNative, (JSObject*) funSetObj),
|
JS_DATA_TO_FUNC_PTR(JSNative, (JSObject*) funSetObj),
|
||||||
JSPROP_GETTER | JSPROP_SETTER | JSPROP_SHARED | JSPROP_PERMANENT));
|
JSPROP_GETTER | JSPROP_SETTER | JSPROP_PERMANENT));
|
||||||
|
|
||||||
JS::Rooted<JS::PropertyDescriptor> desc(cx);
|
JS::Rooted<JS::PropertyDescriptor> desc(cx);
|
||||||
CHECK(JS_GetOwnPropertyDescriptor(cx, vObject, PROPERTY_NAME, &desc));
|
CHECK(JS_GetOwnPropertyDescriptor(cx, vObject, PROPERTY_NAME, &desc));
|
||||||
|
|
|
@ -17,7 +17,7 @@ BEGIN_TEST(testDefineProperty_bug564344)
|
||||||
|
|
||||||
JS::RootedObject obj(cx, x.toObjectOrNull());
|
JS::RootedObject obj(cx, x.toObjectOrNull());
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
CHECK(JS_DefineProperty(cx, obj, "q", JS::UndefinedHandleValue, JSPROP_SHARED));
|
CHECK(JS_DefineProperty(cx, obj, "q", JS::UndefinedHandleValue, 0));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
END_TEST(testDefineProperty_bug564344)
|
END_TEST(testDefineProperty_bug564344)
|
||||||
|
|
|
@ -47,7 +47,7 @@ BEGIN_TEST(testDefinePropertyIgnoredAttributes)
|
||||||
// aren't passing it.
|
// aren't passing it.
|
||||||
CHECK(JS_DefineProperty(cx, obj, "foo",
|
CHECK(JS_DefineProperty(cx, obj, "foo",
|
||||||
Getter, nullptr,
|
Getter, nullptr,
|
||||||
JSPROP_IGNORE_ENUMERATE | JSPROP_IGNORE_PERMANENT | JSPROP_SHARED));
|
JSPROP_IGNORE_ENUMERATE | JSPROP_IGNORE_PERMANENT));
|
||||||
|
|
||||||
CHECK(JS_GetOwnPropertyDescriptor(cx, obj, "foo", &desc));
|
CHECK(JS_GetOwnPropertyDescriptor(cx, obj, "foo", &desc));
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ BEGIN_TEST(testDefinePropertyIgnoredAttributes)
|
||||||
// Install another configurable property, so we can futz with it.
|
// Install another configurable property, so we can futz with it.
|
||||||
CHECK(JS_DefineProperty(cx, obj, "bar",
|
CHECK(JS_DefineProperty(cx, obj, "bar",
|
||||||
Getter, nullptr,
|
Getter, nullptr,
|
||||||
JSPROP_IGNORE_ENUMERATE | JSPROP_SHARED));
|
JSPROP_IGNORE_ENUMERATE));
|
||||||
CHECK(JS_GetOwnPropertyDescriptor(cx, obj, "bar", &desc));
|
CHECK(JS_GetOwnPropertyDescriptor(cx, obj, "bar", &desc));
|
||||||
CHECK(CheckDescriptor(desc, AccessorDescriptor, false, true, true));
|
CHECK(CheckDescriptor(desc, AccessorDescriptor, false, true, true));
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ BEGIN_TEST(testDefinePropertyIgnoredAttributes)
|
||||||
// unchanged.
|
// unchanged.
|
||||||
CHECK(JS_DefineProperty(cx, obj, "bar",
|
CHECK(JS_DefineProperty(cx, obj, "bar",
|
||||||
Getter, nullptr,
|
Getter, nullptr,
|
||||||
JSPROP_IGNORE_PERMANENT | JSPROP_ENUMERATE | JSPROP_SHARED));
|
JSPROP_IGNORE_PERMANENT | JSPROP_ENUMERATE));
|
||||||
CHECK(JS_GetOwnPropertyDescriptor(cx, obj, "bar", &desc));
|
CHECK(JS_GetOwnPropertyDescriptor(cx, obj, "bar", &desc));
|
||||||
CHECK(CheckDescriptor(desc, AccessorDescriptor, true, true, true));
|
CHECK(CheckDescriptor(desc, AccessorDescriptor, true, true, true));
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ BEGIN_TEST(testSetProperty_NativeGetterStubSetter)
|
||||||
|
|
||||||
CHECK(JS_DefineProperty(cx, obj, "prop",
|
CHECK(JS_DefineProperty(cx, obj, "prop",
|
||||||
JS_PROPERTYOP_GETTER(NativeGet), nullptr,
|
JS_PROPERTYOP_GETTER(NativeGet), nullptr,
|
||||||
JSPROP_SHARED | JSPROP_PROPOP_ACCESSORS));
|
JSPROP_PROPOP_ACCESSORS));
|
||||||
|
|
||||||
EXEC("'use strict'; \n"
|
EXEC("'use strict'; \n"
|
||||||
"var error, passed = false; \n"
|
"var error, passed = false; \n"
|
||||||
|
|
|
@ -875,11 +875,6 @@ static const uint8_t JSPROP_GETTER = 0x10;
|
||||||
/* property holds setter function */
|
/* property holds setter function */
|
||||||
static const uint8_t JSPROP_SETTER = 0x20;
|
static const uint8_t JSPROP_SETTER = 0x20;
|
||||||
|
|
||||||
/* don't allocate a value slot for this property; don't copy the property on set
|
|
||||||
of the same-named property in an object that delegates to a prototype
|
|
||||||
containing this property */
|
|
||||||
static const uint8_t JSPROP_SHARED = 0x40;
|
|
||||||
|
|
||||||
/* internal JS engine use only */
|
/* internal JS engine use only */
|
||||||
static const uint8_t JSPROP_INTERNAL_USE_BIT = 0x80;
|
static const uint8_t JSPROP_INTERNAL_USE_BIT = 0x80;
|
||||||
|
|
||||||
|
@ -2278,23 +2273,23 @@ inline int CheckIsSetterOp(JSSetterOp op);
|
||||||
*/
|
*/
|
||||||
#define JS_PSG(name, getter, flags) \
|
#define JS_PSG(name, getter, flags) \
|
||||||
JS_PS_ACCESSOR_SPEC(name, JSNATIVE_WRAPPER(getter), JSNATIVE_WRAPPER(nullptr), flags, \
|
JS_PS_ACCESSOR_SPEC(name, JSNATIVE_WRAPPER(getter), JSNATIVE_WRAPPER(nullptr), flags, \
|
||||||
JSPROP_SHARED)
|
0)
|
||||||
#define JS_PSGS(name, getter, setter, flags) \
|
#define JS_PSGS(name, getter, setter, flags) \
|
||||||
JS_PS_ACCESSOR_SPEC(name, JSNATIVE_WRAPPER(getter), JSNATIVE_WRAPPER(setter), flags, \
|
JS_PS_ACCESSOR_SPEC(name, JSNATIVE_WRAPPER(getter), JSNATIVE_WRAPPER(setter), flags, \
|
||||||
JSPROP_SHARED)
|
0)
|
||||||
#define JS_SYM_GET(symbol, getter, flags) \
|
#define JS_SYM_GET(symbol, getter, flags) \
|
||||||
JS_PS_ACCESSOR_SPEC(reinterpret_cast<const char*>(uint32_t(::JS::SymbolCode::symbol) + 1), \
|
JS_PS_ACCESSOR_SPEC(reinterpret_cast<const char*>(uint32_t(::JS::SymbolCode::symbol) + 1), \
|
||||||
JSNATIVE_WRAPPER(getter), JSNATIVE_WRAPPER(nullptr), flags, JSPROP_SHARED)
|
JSNATIVE_WRAPPER(getter), JSNATIVE_WRAPPER(nullptr), flags, 0)
|
||||||
#define JS_SELF_HOSTED_GET(name, getterName, flags) \
|
#define JS_SELF_HOSTED_GET(name, getterName, flags) \
|
||||||
JS_PS_ACCESSOR_SPEC(name, SELFHOSTED_WRAPPER(getterName), JSNATIVE_WRAPPER(nullptr), flags, \
|
JS_PS_ACCESSOR_SPEC(name, SELFHOSTED_WRAPPER(getterName), JSNATIVE_WRAPPER(nullptr), flags, \
|
||||||
JSPROP_SHARED | JSPROP_GETTER)
|
JSPROP_GETTER)
|
||||||
#define JS_SELF_HOSTED_GETSET(name, getterName, setterName, flags) \
|
#define JS_SELF_HOSTED_GETSET(name, getterName, setterName, flags) \
|
||||||
JS_PS_ACCESSOR_SPEC(name, SELFHOSTED_WRAPPER(getterName), SELFHOSTED_WRAPPER(setterName), \
|
JS_PS_ACCESSOR_SPEC(name, SELFHOSTED_WRAPPER(getterName), SELFHOSTED_WRAPPER(setterName), \
|
||||||
flags, JSPROP_SHARED | JSPROP_GETTER | JSPROP_SETTER)
|
flags, JSPROP_GETTER | JSPROP_SETTER)
|
||||||
#define JS_SELF_HOSTED_SYM_GET(symbol, getterName, flags) \
|
#define JS_SELF_HOSTED_SYM_GET(symbol, getterName, flags) \
|
||||||
JS_PS_ACCESSOR_SPEC(reinterpret_cast<const char*>(uint32_t(::JS::SymbolCode::symbol) + 1), \
|
JS_PS_ACCESSOR_SPEC(reinterpret_cast<const char*>(uint32_t(::JS::SymbolCode::symbol) + 1), \
|
||||||
SELFHOSTED_WRAPPER(getterName), JSNATIVE_WRAPPER(nullptr), flags, \
|
SELFHOSTED_WRAPPER(getterName), JSNATIVE_WRAPPER(nullptr), flags, \
|
||||||
JSPROP_SHARED | JSPROP_GETTER)
|
JSPROP_GETTER)
|
||||||
#define JS_STRING_PS(name, string, flags) \
|
#define JS_STRING_PS(name, string, flags) \
|
||||||
JS_PS_VALUE_SPEC(name, STRINGVALUE_WRAPPER(string), flags)
|
JS_PS_VALUE_SPEC(name, STRINGVALUE_WRAPPER(string), flags)
|
||||||
#define JS_STRING_SYM_PS(symbol, string, flags) \
|
#define JS_STRING_SYM_PS(symbol, string, flags) \
|
||||||
|
@ -2864,7 +2859,6 @@ class WrappedPtrOperations<JS::PropertyDescriptor, Wrapper>
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasGetterOrSetter() const { return desc().getter || desc().setter; }
|
bool hasGetterOrSetter() const { return desc().getter || desc().setter; }
|
||||||
bool isShared() const { return has(JSPROP_SHARED); }
|
|
||||||
|
|
||||||
JS::HandleObject object() const {
|
JS::HandleObject object() const {
|
||||||
return JS::HandleObject::fromMarkedLocation(&desc().obj);
|
return JS::HandleObject::fromMarkedLocation(&desc().obj);
|
||||||
|
@ -2881,14 +2875,12 @@ class WrappedPtrOperations<JS::PropertyDescriptor, Wrapper>
|
||||||
JSPROP_IGNORE_VALUE |
|
JSPROP_IGNORE_VALUE |
|
||||||
JSPROP_GETTER |
|
JSPROP_GETTER |
|
||||||
JSPROP_SETTER |
|
JSPROP_SETTER |
|
||||||
JSPROP_SHARED |
|
|
||||||
JSPROP_REDEFINE_NONCONFIGURABLE |
|
JSPROP_REDEFINE_NONCONFIGURABLE |
|
||||||
JSPROP_RESOLVING |
|
JSPROP_RESOLVING |
|
||||||
SHADOWABLE)) == 0);
|
SHADOWABLE)) == 0);
|
||||||
MOZ_ASSERT(!hasAll(JSPROP_IGNORE_ENUMERATE | JSPROP_ENUMERATE));
|
MOZ_ASSERT(!hasAll(JSPROP_IGNORE_ENUMERATE | JSPROP_ENUMERATE));
|
||||||
MOZ_ASSERT(!hasAll(JSPROP_IGNORE_PERMANENT | JSPROP_PERMANENT));
|
MOZ_ASSERT(!hasAll(JSPROP_IGNORE_PERMANENT | JSPROP_PERMANENT));
|
||||||
if (isAccessorDescriptor()) {
|
if (isAccessorDescriptor()) {
|
||||||
MOZ_ASSERT(has(JSPROP_SHARED));
|
|
||||||
MOZ_ASSERT(!has(JSPROP_READONLY));
|
MOZ_ASSERT(!has(JSPROP_READONLY));
|
||||||
MOZ_ASSERT(!has(JSPROP_IGNORE_READONLY));
|
MOZ_ASSERT(!has(JSPROP_IGNORE_READONLY));
|
||||||
MOZ_ASSERT(!has(JSPROP_IGNORE_VALUE));
|
MOZ_ASSERT(!has(JSPROP_IGNORE_VALUE));
|
||||||
|
@ -2917,7 +2909,6 @@ class WrappedPtrOperations<JS::PropertyDescriptor, Wrapper>
|
||||||
JSPROP_READONLY |
|
JSPROP_READONLY |
|
||||||
JSPROP_GETTER |
|
JSPROP_GETTER |
|
||||||
JSPROP_SETTER |
|
JSPROP_SETTER |
|
||||||
JSPROP_SHARED |
|
|
||||||
JSPROP_REDEFINE_NONCONFIGURABLE |
|
JSPROP_REDEFINE_NONCONFIGURABLE |
|
||||||
JSPROP_RESOLVING |
|
JSPROP_RESOLVING |
|
||||||
SHADOWABLE)) == 0);
|
SHADOWABLE)) == 0);
|
||||||
|
@ -3018,12 +3009,12 @@ class MutableWrappedPtrOperations<JS::PropertyDescriptor, Wrapper>
|
||||||
void setGetterObject(JSObject* obj) {
|
void setGetterObject(JSObject* obj) {
|
||||||
desc().getter = reinterpret_cast<JSGetterOp>(obj);
|
desc().getter = reinterpret_cast<JSGetterOp>(obj);
|
||||||
desc().attrs &= ~(JSPROP_IGNORE_VALUE | JSPROP_IGNORE_READONLY | JSPROP_READONLY);
|
desc().attrs &= ~(JSPROP_IGNORE_VALUE | JSPROP_IGNORE_READONLY | JSPROP_READONLY);
|
||||||
desc().attrs |= JSPROP_GETTER | JSPROP_SHARED;
|
desc().attrs |= JSPROP_GETTER;
|
||||||
}
|
}
|
||||||
void setSetterObject(JSObject* obj) {
|
void setSetterObject(JSObject* obj) {
|
||||||
desc().setter = reinterpret_cast<JSSetterOp>(obj);
|
desc().setter = reinterpret_cast<JSSetterOp>(obj);
|
||||||
desc().attrs &= ~(JSPROP_IGNORE_VALUE | JSPROP_IGNORE_READONLY | JSPROP_READONLY);
|
desc().attrs &= ~(JSPROP_IGNORE_VALUE | JSPROP_IGNORE_READONLY | JSPROP_READONLY);
|
||||||
desc().attrs |= JSPROP_SETTER | JSPROP_SHARED;
|
desc().attrs |= JSPROP_SETTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
JS::MutableHandleObject getterObject() {
|
JS::MutableHandleObject getterObject() {
|
||||||
|
|
|
@ -1047,7 +1047,7 @@ AddLengthProperty(JSContext* cx, HandleArrayObject obj)
|
||||||
|
|
||||||
return NativeObject::addProperty(cx, obj, lengthId, array_length_getter, array_length_setter,
|
return NativeObject::addProperty(cx, obj, lengthId, array_length_getter, array_length_setter,
|
||||||
SHAPE_INVALID_SLOT,
|
SHAPE_INVALID_SLOT,
|
||||||
JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_SHADOWABLE,
|
JSPROP_PERMANENT | JSPROP_SHADOWABLE,
|
||||||
0, /* allowDictionary = */ false);
|
0, /* allowDictionary = */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8657,7 +8657,7 @@ NewMemoryInfoObject(JSContext* cx)
|
||||||
#endif
|
#endif
|
||||||
if (!JS_DefineProperty(cx, obj, pair.name,
|
if (!JS_DefineProperty(cx, obj, pair.name,
|
||||||
getter, nullptr,
|
getter, nullptr,
|
||||||
JSPROP_ENUMERATE | JSPROP_SHARED))
|
JSPROP_ENUMERATE))
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -8692,7 +8692,7 @@ NewMemoryInfoObject(JSContext* cx)
|
||||||
#endif
|
#endif
|
||||||
if (!JS_DefineProperty(cx, zoneObj, pair.name,
|
if (!JS_DefineProperty(cx, zoneObj, pair.name,
|
||||||
getter, nullptr,
|
getter, nullptr,
|
||||||
JSPROP_ENUMERATE | JSPROP_SHARED))
|
JSPROP_ENUMERATE))
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,7 +361,7 @@ js::ToPropertyDescriptor(JSContext* cx, HandleValue descval, bool checkAccessors
|
||||||
js_getter_str);
|
js_getter_str);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
attrs |= JSPROP_GETTER | JSPROP_SHARED;
|
attrs |= JSPROP_GETTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
// step 9
|
// step 9
|
||||||
|
@ -379,7 +379,7 @@ js::ToPropertyDescriptor(JSContext* cx, HandleValue descval, bool checkAccessors
|
||||||
js_setter_str);
|
js_setter_str);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
attrs |= JSPROP_SETTER | JSPROP_SHARED;
|
attrs |= JSPROP_SETTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
// step 10
|
// step 10
|
||||||
|
@ -395,7 +395,6 @@ js::ToPropertyDescriptor(JSContext* cx, HandleValue descval, bool checkAccessors
|
||||||
|
|
||||||
desc.setAttributes(attrs);
|
desc.setAttributes(attrs);
|
||||||
MOZ_ASSERT_IF(attrs & JSPROP_READONLY, !(attrs & (JSPROP_GETTER | JSPROP_SETTER)));
|
MOZ_ASSERT_IF(attrs & JSPROP_READONLY, !(attrs & (JSPROP_GETTER | JSPROP_SETTER)));
|
||||||
MOZ_ASSERT_IF(attrs & (JSPROP_GETTER | JSPROP_SETTER), attrs & JSPROP_SHARED);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,7 +424,7 @@ js::CompletePropertyDescriptor(MutableHandle<PropertyDescriptor> desc)
|
||||||
desc.setGetterObject(nullptr);
|
desc.setGetterObject(nullptr);
|
||||||
if (!desc.hasSetterObject())
|
if (!desc.hasSetterObject())
|
||||||
desc.setSetterObject(nullptr);
|
desc.setSetterObject(nullptr);
|
||||||
desc.attributesRef() |= JSPROP_GETTER | JSPROP_SETTER | JSPROP_SHARED;
|
desc.attributesRef() |= JSPROP_GETTER | JSPROP_SETTER;
|
||||||
}
|
}
|
||||||
if (!desc.hasConfigurable())
|
if (!desc.hasConfigurable())
|
||||||
desc.attributesRef() |= JSPROP_PERMANENT;
|
desc.attributesRef() |= JSPROP_PERMANENT;
|
||||||
|
@ -3526,7 +3525,6 @@ DumpProperty(const NativeObject* obj, Shape& shape, js::GenericPrinter& out)
|
||||||
if (attrs & JSPROP_ENUMERATE) out.put("enumerate ");
|
if (attrs & JSPROP_ENUMERATE) out.put("enumerate ");
|
||||||
if (attrs & JSPROP_READONLY) out.put("readonly ");
|
if (attrs & JSPROP_READONLY) out.put("readonly ");
|
||||||
if (attrs & JSPROP_PERMANENT) out.put("permanent ");
|
if (attrs & JSPROP_PERMANENT) out.put("permanent ");
|
||||||
if (attrs & JSPROP_SHARED) out.put("shared ");
|
|
||||||
|
|
||||||
if (shape.hasGetterValue())
|
if (shape.hasGetterValue())
|
||||||
out.printf("getterValue=%p ", (void*) shape.getterObject());
|
out.printf("getterValue=%p ", (void*) shape.getterObject());
|
||||||
|
|
|
@ -7273,7 +7273,7 @@ static const JSJitInfo doFoo_methodinfo = {
|
||||||
|
|
||||||
static const JSPropertySpec dom_props[] = {
|
static const JSPropertySpec dom_props[] = {
|
||||||
{"x",
|
{"x",
|
||||||
JSPROP_SHARED | JSPROP_ENUMERATE,
|
JSPROP_ENUMERATE,
|
||||||
{ {
|
{ {
|
||||||
{ { dom_genericGetter, &dom_x_getterinfo } },
|
{ { dom_genericGetter, &dom_x_getterinfo } },
|
||||||
{ { dom_genericSetter, &dom_x_setterinfo } }
|
{ { dom_genericSetter, &dom_x_setterinfo } }
|
||||||
|
|
|
@ -576,7 +576,7 @@ MappedArgumentsObject::obj_resolve(JSContext* cx, HandleObject obj, HandleId id,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned attrs = JSPROP_SHARED | JSPROP_SHADOWABLE | JSPROP_RESOLVING;
|
unsigned attrs = JSPROP_SHADOWABLE | JSPROP_RESOLVING;
|
||||||
if (JSID_IS_INT(id)) {
|
if (JSID_IS_INT(id)) {
|
||||||
uint32_t arg = uint32_t(JSID_TO_INT(id));
|
uint32_t arg = uint32_t(JSID_TO_INT(id));
|
||||||
if (arg >= argsobj->initialLength() || argsobj->isElementDeleted(arg))
|
if (arg >= argsobj->initialLength() || argsobj->isElementDeleted(arg))
|
||||||
|
@ -776,7 +776,7 @@ UnmappedArgumentsObject::obj_resolve(JSContext* cx, HandleObject obj, HandleId i
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned attrs = JSPROP_SHARED | JSPROP_SHADOWABLE;
|
unsigned attrs = JSPROP_SHADOWABLE;
|
||||||
GetterOp getter = UnmappedArgGetter;
|
GetterOp getter = UnmappedArgGetter;
|
||||||
SetterOp setter = UnmappedArgSetter;
|
SetterOp setter = UnmappedArgSetter;
|
||||||
|
|
||||||
|
@ -793,7 +793,7 @@ UnmappedArgumentsObject::obj_resolve(JSContext* cx, HandleObject obj, HandleId i
|
||||||
if (!JSID_IS_ATOM(id, cx->names().callee))
|
if (!JSID_IS_ATOM(id, cx->names().callee))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
attrs = JSPROP_PERMANENT | JSPROP_GETTER | JSPROP_SETTER | JSPROP_SHARED;
|
attrs = JSPROP_PERMANENT | JSPROP_GETTER | JSPROP_SETTER;
|
||||||
getter = CastAsGetterOp(argsobj->global().getThrowTypeError());
|
getter = CastAsGetterOp(argsobj->global().getThrowTypeError());
|
||||||
setter = CastAsSetterOp(argsobj->global().getThrowTypeError());
|
setter = CastAsSetterOp(argsobj->global().getThrowTypeError());
|
||||||
}
|
}
|
||||||
|
|
|
@ -8484,7 +8484,7 @@ DebuggerArguments::create(JSContext* cx, HandleObject proto, HandleDebuggerFrame
|
||||||
if (!getobj ||
|
if (!getobj ||
|
||||||
!NativeDefineAccessorProperty(cx, obj, id,
|
!NativeDefineAccessorProperty(cx, obj, id,
|
||||||
JS_DATA_TO_FUNC_PTR(GetterOp, getobj.get()), nullptr,
|
JS_DATA_TO_FUNC_PTR(GetterOp, getobj.get()), nullptr,
|
||||||
JSPROP_ENUMERATE | JSPROP_SHARED | JSPROP_GETTER))
|
JSPROP_ENUMERATE | JSPROP_GETTER))
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4805,10 +4805,10 @@ js::InitGetterSetterOperation(JSContext* cx, jsbytecode* pc, HandleObject obj, H
|
||||||
MOZ_ASSERT(val->isCallable());
|
MOZ_ASSERT(val->isCallable());
|
||||||
GetterOp getter;
|
GetterOp getter;
|
||||||
SetterOp setter;
|
SetterOp setter;
|
||||||
unsigned attrs = JSPROP_SHARED;
|
|
||||||
|
|
||||||
JSOp op = JSOp(*pc);
|
JSOp op = JSOp(*pc);
|
||||||
|
|
||||||
|
unsigned attrs = 0;
|
||||||
if (!IsHiddenInitOp(op))
|
if (!IsHiddenInitOp(op))
|
||||||
attrs |= JSPROP_ENUMERATE;
|
attrs |= JSPROP_ENUMERATE;
|
||||||
|
|
||||||
|
|
|
@ -2064,8 +2064,6 @@ js::NativeGetOwnPropertyDescriptor(JSContext* cx, HandleNativeObject obj, Handle
|
||||||
|
|
||||||
desc.setAttributes(GetPropertyAttributes(obj, prop));
|
desc.setAttributes(GetPropertyAttributes(obj, prop));
|
||||||
if (desc.isAccessorDescriptor()) {
|
if (desc.isAccessorDescriptor()) {
|
||||||
MOZ_ASSERT(desc.isShared());
|
|
||||||
|
|
||||||
// The result of GetOwnPropertyDescriptor() must be either undefined or
|
// The result of GetOwnPropertyDescriptor() must be either undefined or
|
||||||
// a complete property descriptor (per ES6 draft rev 32 (2015 Feb 2)
|
// a complete property descriptor (per ES6 draft rev 32 (2015 Feb 2)
|
||||||
// 6.1.7.3, Invariants of the Essential Internal Methods).
|
// 6.1.7.3, Invariants of the Essential Internal Methods).
|
||||||
|
@ -2095,7 +2093,6 @@ js::NativeGetOwnPropertyDescriptor(JSContext* cx, HandleNativeObject obj, Handle
|
||||||
// desc.getter/setter, and mask away the SHARED bit.
|
// desc.getter/setter, and mask away the SHARED bit.
|
||||||
desc.setGetter(nullptr);
|
desc.setGetter(nullptr);
|
||||||
desc.setSetter(nullptr);
|
desc.setSetter(nullptr);
|
||||||
desc.attributesRef() &= ~JSPROP_SHARED;
|
|
||||||
|
|
||||||
if (prop.isDenseOrTypedArrayElement()) {
|
if (prop.isDenseOrTypedArrayElement()) {
|
||||||
desc.value().set(obj->getDenseOrTypedArrayElement(JSID_TO_INT(id)));
|
desc.value().set(obj->getDenseOrTypedArrayElement(JSID_TO_INT(id)));
|
||||||
|
|
|
@ -624,14 +624,14 @@ intrinsic_DefineProperty(JSContext* cx, unsigned argc, Value* vp)
|
||||||
if (getter.isObject())
|
if (getter.isObject())
|
||||||
desc.setGetterObject(&getter.toObject());
|
desc.setGetterObject(&getter.toObject());
|
||||||
if (!getter.isNull())
|
if (!getter.isNull())
|
||||||
attrs |= JSPROP_GETTER | JSPROP_SHARED;
|
attrs |= JSPROP_GETTER;
|
||||||
|
|
||||||
Value setter = args[4];
|
Value setter = args[4];
|
||||||
MOZ_ASSERT(setter.isObject() || setter.isNullOrUndefined());
|
MOZ_ASSERT(setter.isObject() || setter.isNullOrUndefined());
|
||||||
if (setter.isObject())
|
if (setter.isObject())
|
||||||
desc.setSetterObject(&setter.toObject());
|
desc.setSetterObject(&setter.toObject());
|
||||||
if (!setter.isNull())
|
if (!setter.isNull())
|
||||||
attrs |= JSPROP_SETTER | JSPROP_SHARED;
|
attrs |= JSPROP_SETTER;
|
||||||
|
|
||||||
// By convention, these bits are not used on accessor descriptors.
|
// By convention, these bits are not used on accessor descriptors.
|
||||||
attrs &= ~(JSPROP_IGNORE_READONLY | JSPROP_IGNORE_VALUE);
|
attrs &= ~(JSPROP_IGNORE_READONLY | JSPROP_IGNORE_VALUE);
|
||||||
|
|
|
@ -681,7 +681,7 @@ AssertCanChangeAttrs(Shape* shape, unsigned attrs)
|
||||||
|
|
||||||
/* Reject attempts to remove a slot from the permanent data property. */
|
/* Reject attempts to remove a slot from the permanent data property. */
|
||||||
MOZ_ASSERT_IF(shape->isDataDescriptor() && shape->hasSlot(),
|
MOZ_ASSERT_IF(shape->isDataDescriptor() && shape->hasSlot(),
|
||||||
!(attrs & (JSPROP_GETTER | JSPROP_SETTER | JSPROP_SHARED)));
|
!(attrs & (JSPROP_GETTER | JSPROP_SETTER)));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -745,7 +745,8 @@ NativeObject::putProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
|
||||||
*/
|
*/
|
||||||
bool hadSlot = shape->hasSlot();
|
bool hadSlot = shape->hasSlot();
|
||||||
uint32_t oldSlot = shape->maybeSlot();
|
uint32_t oldSlot = shape->maybeSlot();
|
||||||
if (!(attrs & JSPROP_SHARED) && slot == SHAPE_INVALID_SLOT && hadSlot)
|
bool needSlot = !getter && !setter;
|
||||||
|
if (needSlot && slot == SHAPE_INVALID_SLOT && hadSlot)
|
||||||
slot = oldSlot;
|
slot = oldSlot;
|
||||||
|
|
||||||
Rooted<UnownedBaseShape*> nbase(cx);
|
Rooted<UnownedBaseShape*> nbase(cx);
|
||||||
|
@ -777,7 +778,7 @@ NativeObject::putProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
|
||||||
shape = entry->shape();
|
shape = entry->shape();
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT_IF(shape->hasSlot() && !(attrs & JSPROP_SHARED), shape->slot() == slot);
|
MOZ_ASSERT_IF(shape->hasSlot() && needSlot, shape->slot() == slot);
|
||||||
|
|
||||||
if (obj->inDictionaryMode()) {
|
if (obj->inDictionaryMode()) {
|
||||||
/*
|
/*
|
||||||
|
@ -799,7 +800,7 @@ NativeObject::putProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
|
||||||
* FIXME bug 593129 -- slot allocation and NativeObject *this must move
|
* FIXME bug 593129 -- slot allocation and NativeObject *this must move
|
||||||
* out of here!
|
* out of here!
|
||||||
*/
|
*/
|
||||||
if (slot == SHAPE_INVALID_SLOT && !(attrs & JSPROP_SHARED)) {
|
if (slot == SHAPE_INVALID_SLOT && needSlot) {
|
||||||
if (!allocDictionarySlot(cx, obj, &slot))
|
if (!allocDictionarySlot(cx, obj, &slot))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -809,8 +810,6 @@ NativeObject::putProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
|
||||||
else
|
else
|
||||||
shape->base_ = nbase;
|
shape->base_ = nbase;
|
||||||
|
|
||||||
MOZ_ASSERT_IF(attrs & (JSPROP_GETTER | JSPROP_SETTER), attrs & JSPROP_SHARED);
|
|
||||||
|
|
||||||
shape->setSlot(slot);
|
shape->setSlot(slot);
|
||||||
shape->attrs = uint8_t(attrs);
|
shape->attrs = uint8_t(attrs);
|
||||||
shape->flags = flags | Shape::IN_DICTIONARY | (accessorShape ? Shape::ACCESSOR_SHAPE : 0);
|
shape->flags = flags | Shape::IN_DICTIONARY | (accessorShape ? Shape::ACCESSOR_SHAPE : 0);
|
||||||
|
@ -874,11 +873,12 @@ NativeObject::changeProperty(JSContext* cx, HandleNativeObject obj, HandleShape
|
||||||
unsigned attrs, GetterOp getter, SetterOp setter)
|
unsigned attrs, GetterOp getter, SetterOp setter)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(obj->containsPure(shape));
|
MOZ_ASSERT(obj->containsPure(shape));
|
||||||
MOZ_ASSERT_IF(attrs & (JSPROP_GETTER | JSPROP_SETTER), attrs & JSPROP_SHARED);
|
|
||||||
|
|
||||||
/* Allow only shared (slotless) => unshared (slotful) transition. */
|
/* Allow only shared (slotless) => unshared (slotful) transition. */
|
||||||
MOZ_ASSERT(!((attrs ^ shape->attrs) & JSPROP_SHARED) ||
|
#ifdef DEBUG
|
||||||
!(attrs & JSPROP_SHARED));
|
bool needSlot = !getter && !setter;
|
||||||
|
MOZ_ASSERT_IF(shape->hasSlot() != needSlot, needSlot);
|
||||||
|
#endif
|
||||||
|
|
||||||
MarkTypePropertyNonData(cx, obj, shape->propid());
|
MarkTypePropertyNonData(cx, obj, shape->propid());
|
||||||
|
|
||||||
|
@ -1800,7 +1800,6 @@ Shape::dump(js::GenericPrinter& out) const
|
||||||
DUMP_ATTR(PERMANENT, permanent);
|
DUMP_ATTR(PERMANENT, permanent);
|
||||||
DUMP_ATTR(GETTER, getter);
|
DUMP_ATTR(GETTER, getter);
|
||||||
DUMP_ATTR(SETTER, setter);
|
DUMP_ATTR(SETTER, setter);
|
||||||
DUMP_ATTR(SHARED, shared);
|
|
||||||
#undef DUMP_ATTR
|
#undef DUMP_ATTR
|
||||||
out.putChar(')');
|
out.putChar(')');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1013,7 +1013,7 @@ class Shape : public gc::TenuredCell
|
||||||
BaseShape* base() const { return base_.get(); }
|
BaseShape* base() const { return base_.get(); }
|
||||||
|
|
||||||
bool hasSlot() const {
|
bool hasSlot() const {
|
||||||
return (attrs & JSPROP_SHARED) == 0;
|
return !isEmptyShape() && !getter() && !setter();
|
||||||
}
|
}
|
||||||
uint32_t slot() const { MOZ_ASSERT(hasSlot() && !hasMissingSlot()); return maybeSlot(); }
|
uint32_t slot() const { MOZ_ASSERT(hasSlot() && !hasMissingSlot()); return maybeSlot(); }
|
||||||
uint32_t maybeSlot() const {
|
uint32_t maybeSlot() const {
|
||||||
|
@ -1450,7 +1450,6 @@ struct StackShape
|
||||||
MOZ_ASSERT(base);
|
MOZ_ASSERT(base);
|
||||||
MOZ_ASSERT(!JSID_IS_VOID(propid));
|
MOZ_ASSERT(!JSID_IS_VOID(propid));
|
||||||
MOZ_ASSERT(slot <= SHAPE_INVALID_SLOT);
|
MOZ_ASSERT(slot <= SHAPE_INVALID_SLOT);
|
||||||
MOZ_ASSERT_IF(attrs & (JSPROP_GETTER | JSPROP_SETTER), attrs & JSPROP_SHARED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit StackShape(Shape* shape)
|
explicit StackShape(Shape* shape)
|
||||||
|
@ -1473,7 +1472,10 @@ struct StackShape
|
||||||
this->rawSetter = rawSetter;
|
this->rawSetter = rawSetter;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasSlot() const { return (attrs & JSPROP_SHARED) == 0; }
|
bool hasSlot() const {
|
||||||
|
MOZ_ASSERT(!JSID_IS_EMPTY(propid));
|
||||||
|
return !rawGetter && !rawSetter;
|
||||||
|
}
|
||||||
bool hasMissingSlot() const { return maybeSlot() == SHAPE_INVALID_SLOT; }
|
bool hasMissingSlot() const { return maybeSlot() == SHAPE_INVALID_SLOT; }
|
||||||
|
|
||||||
uint32_t slot() const { MOZ_ASSERT(hasSlot() && !hasMissingSlot()); return slot_; }
|
uint32_t slot() const { MOZ_ASSERT(hasSlot() && !hasMissingSlot()); return slot_; }
|
||||||
|
@ -1546,7 +1548,6 @@ Shape::Shape(const StackShape& other, uint32_t nfixed)
|
||||||
|
|
||||||
MOZ_ASSERT_IF(!isEmptyShape(), AtomIsMarked(zone(), propid()));
|
MOZ_ASSERT_IF(!isEmptyShape(), AtomIsMarked(zone(), propid()));
|
||||||
|
|
||||||
MOZ_ASSERT_IF(attrs & (JSPROP_GETTER | JSPROP_SETTER), attrs & JSPROP_SHARED);
|
|
||||||
kids.setNull();
|
kids.setNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1567,7 +1568,7 @@ Shape::Shape(UnownedBaseShape* base, uint32_t nfixed)
|
||||||
: base_(base),
|
: base_(base),
|
||||||
propid_(JSID_EMPTY),
|
propid_(JSID_EMPTY),
|
||||||
slotInfo(SHAPE_INVALID_SLOT | (nfixed << FIXED_SLOTS_SHIFT)),
|
slotInfo(SHAPE_INVALID_SLOT | (nfixed << FIXED_SLOTS_SHIFT)),
|
||||||
attrs(JSPROP_SHARED),
|
attrs(0),
|
||||||
flags(0),
|
flags(0),
|
||||||
parent(nullptr)
|
parent(nullptr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1370,7 +1370,7 @@ XRE_XPCShellMain(int argc, char** argv, char** envp,
|
||||||
|
|
||||||
JS_DefineProperty(cx, glob, "__LOCATION__",
|
JS_DefineProperty(cx, glob, "__LOCATION__",
|
||||||
GetLocationProperty, nullptr,
|
GetLocationProperty, nullptr,
|
||||||
JSPROP_SHARED);
|
0);
|
||||||
|
|
||||||
{
|
{
|
||||||
// We are almost certainly going to run script here, so we need an
|
// We are almost certainly going to run script here, so we need an
|
||||||
|
|
|
@ -350,7 +350,7 @@ DefinePropertyIfFound(XPCCallContext& ccx,
|
||||||
if (!funobj)
|
if (!funobj)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
propFlags |= JSPROP_GETTER | JSPROP_SHARED;
|
propFlags |= JSPROP_GETTER;
|
||||||
propFlags &= ~JSPROP_ENUMERATE;
|
propFlags &= ~JSPROP_ENUMERATE;
|
||||||
|
|
||||||
AutoResolveName arn(ccx, id);
|
AutoResolveName arn(ccx, id);
|
||||||
|
@ -434,7 +434,7 @@ DefinePropertyIfFound(XPCCallContext& ccx,
|
||||||
|
|
||||||
MOZ_ASSERT(member->IsAttribute(), "way broken!");
|
MOZ_ASSERT(member->IsAttribute(), "way broken!");
|
||||||
|
|
||||||
propFlags |= JSPROP_GETTER | JSPROP_SHARED;
|
propFlags |= JSPROP_GETTER;
|
||||||
propFlags &= ~JSPROP_READONLY;
|
propFlags &= ~JSPROP_READONLY;
|
||||||
JSObject* funobj = funval.toObjectOrNull();
|
JSObject* funobj = funval.toObjectOrNull();
|
||||||
JSNative getter = JS_DATA_TO_FUNC_PTR(JSNative, funobj);
|
JSNative getter = JS_DATA_TO_FUNC_PTR(JSNative, funobj);
|
||||||
|
|
|
@ -1543,9 +1543,6 @@ XPCWrappedNativeXrayTraits::resolveNativeProperty(JSContext* cx, HandleObject wr
|
||||||
if (member->IsWritableAttribute())
|
if (member->IsWritableAttribute())
|
||||||
attrs |= JSPROP_SETTER;
|
attrs |= JSPROP_SETTER;
|
||||||
|
|
||||||
// Make the property shared on the holder so no slot is allocated
|
|
||||||
// for it. This avoids keeping garbage alive through that slot.
|
|
||||||
attrs |= JSPROP_SHARED;
|
|
||||||
desc.setAttributes(attrs);
|
desc.setAttributes(attrs);
|
||||||
} else {
|
} else {
|
||||||
// This is a method. Clone a function for it.
|
// This is a method. Clone a function for it.
|
||||||
|
@ -1651,7 +1648,7 @@ XrayTraits::resolveOwnProperty(JSContext* cx, HandleObject wrapper, HandleObject
|
||||||
if (!JS_AlreadyHasOwnPropertyById(cx, holder, id, &found))
|
if (!JS_AlreadyHasOwnPropertyById(cx, holder, id, &found))
|
||||||
return false;
|
return false;
|
||||||
if (!found && !JS_DefinePropertyById(cx, holder, id, wrappedJSObject_getter, nullptr,
|
if (!found && !JS_DefinePropertyById(cx, holder, id, wrappedJSObject_getter, nullptr,
|
||||||
JSPROP_ENUMERATE | JSPROP_SHARED)) {
|
JSPROP_ENUMERATE)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!JS_GetOwnPropertyDescriptorById(cx, holder, id, desc))
|
if (!JS_GetOwnPropertyDescriptorById(cx, holder, id, desc))
|
||||||
|
|
Загрузка…
Ссылка в новой задаче