From 9bd0895c277150aa51ee0ce55ce492c41346b18e Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 9 Apr 2013 15:33:26 +0200 Subject: Small fix to PropertyAttributes Change-Id: I9fc8b291c434dc6552eba2a39623a4fe75291e0f Reviewed-by: Simon Hausmann --- src/v4/qv4global.h | 6 ++++-- src/v4/qv4object.cpp | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/v4/qv4global.h b/src/v4/qv4global.h index 0e0a4f0f26..928664de0a 100644 --- a/src/v4/qv4global.h +++ b/src/v4/qv4global.h @@ -102,13 +102,15 @@ struct PropertyAttributes PropertyAttributes() : m_all(0) {} PropertyAttributes(PropertyFlag f) : m_all(0) { setType(f & Attr_Accessor ? Accessor : Data); - setWritable(!(f & Attr_NotWritable)); + if (!(f & Attr_Accessor)) + setWritable(!(f & Attr_NotWritable)); setEnumerable(!(f & Attr_NotEnumerable)); setConfigurable(!(f & Attr_NotConfigurable)); } PropertyAttributes(PropertyFlags f) : m_all(0) { setType(f & Attr_Accessor ? Accessor : Data); - setWritable(!(f & Attr_NotWritable)); + if (!(f & Attr_Accessor)) + setWritable(!(f & Attr_NotWritable)); setEnumerable(!(f & Attr_NotEnumerable)); setConfigurable(!(f & Attr_NotConfigurable)); } diff --git a/src/v4/qv4object.cpp b/src/v4/qv4object.cpp index 68f7c9ac0e..105af27517 100644 --- a/src/v4/qv4object.cpp +++ b/src/v4/qv4object.cpp @@ -192,7 +192,7 @@ void Object::inplaceBinOp(ExecutionContext *ctx, BinOp op, const Value &index, c void Object::defineDefaultProperty(String *name, Value value) { - PropertyDescriptor *pd = insertMember(name, Attr_Data); + PropertyDescriptor *pd = insertMember(name, Attr_Data|Attr_NotEnumerable); pd->attrs = Attr_Data|Attr_NotEnumerable; pd->value = value; } @@ -658,8 +658,8 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, String *name, const Pr ctx->throwRangeError(desc->value); succeeded = setArrayLength(l); } - if (desc->attrs.hasWritable()) - lp->attrs.setWritable(desc->attrs.isWritable()); + if (desc->attrs.hasWritable() && !desc->attrs.isWritable()) + lp->attrs.setWritable(false); if (!succeeded) goto reject; return true; -- cgit v1.2.3