summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/script/api/qscriptvalue.cpp6
-rw-r--r--src/script/bridge/qscriptobject.cpp10
-rw-r--r--src/script/bridge/qscriptobject_p.h2
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp8
4 files changed, 10 insertions, 16 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp
index 4d5361e..9fe9041 100644
--- a/src/script/api/qscriptvalue.cpp
+++ b/src/script/api/qscriptvalue.cpp
@@ -1821,13 +1821,13 @@ QScriptValue::PropertyFlags QScriptValue::propertyFlags(const QString &name,
result |= QScriptValue::SkipInEnumeration;
if (attribs & JSC::DontDelete)
result |= QScriptValue::Undeletable;
- if (attribs & JSC::Getter)
+ //We cannot rely on attribs JSC::Setter/Getter because they are not necesserly set by JSC (bug?)
+ if (attribs & JSC::Getter || !JSC::asObject(d->jscValue)->lookupGetter(exec, id).isUndefinedOrNull())
result |= QScriptValue::PropertyGetter;
- if (attribs & JSC::Setter)
+ if (attribs & JSC::Setter || !JSC::asObject(d->jscValue)->lookupSetter(exec, id).isUndefinedOrNull())
result |= QScriptValue::PropertySetter;
if (attribs & QScript::QObjectMemberAttribute)
result |= QScriptValue::QObjectMember;
-
result |= QScriptValue::PropertyFlag(attribs & QScriptValue::UserRange);
return result;
}
diff --git a/src/script/bridge/qscriptobject.cpp b/src/script/bridge/qscriptobject.cpp
index 5cf415a..da31579 100644
--- a/src/script/bridge/qscriptobject.cpp
+++ b/src/script/bridge/qscriptobject.cpp
@@ -144,16 +144,6 @@ bool QScriptObject::hasInstance(JSC::ExecState* exec, JSC::JSValue value, JSC::J
return d->delegate->hasInstance(this, exec, value, proto);
}
-JSC::JSValue QScriptObject::lookupGetter(JSC::ExecState*, const JSC::Identifier& propertyName)
-{
- Q_ASSERT_X(false, Q_FUNC_INFO, "implement me");
-}
-
-JSC::JSValue QScriptObject::lookupSetter(JSC::ExecState*, const JSC::Identifier& propertyName)
-{
- Q_ASSERT_X(false, Q_FUNC_INFO, "implement me");
-}
-
QScriptObjectPrototype::QScriptObjectPrototype(JSC::ExecState*, WTF::PassRefPtr<JSC::Structure> structure,
JSC::Structure* /*prototypeFunctionStructure*/)
: QScriptObject(structure)
diff --git a/src/script/bridge/qscriptobject_p.h b/src/script/bridge/qscriptobject_p.h
index a4ed94c..eaa89b2 100644
--- a/src/script/bridge/qscriptobject_p.h
+++ b/src/script/bridge/qscriptobject_p.h
@@ -59,8 +59,6 @@ public:
virtual bool getPropertyAttributes(JSC::ExecState*, const JSC::Identifier&,
unsigned&) const;
virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&);
- virtual JSC::JSValue lookupGetter(JSC::ExecState*, const JSC::Identifier& propertyName);
- virtual JSC::JSValue lookupSetter(JSC::ExecState*, const JSC::Identifier& propertyName);
virtual void mark();
virtual JSC::CallType getCallData(JSC::CallData&);
virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index 0986fd3..f29fa82 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -1832,6 +1832,9 @@ void tst_QScriptValue::getSetProperty()
// getter() returns this.x
object4.setProperty("foo", eng.newFunction(getter),
QScriptValue::PropertyGetter | QScriptValue::UserRange);
+ QCOMPARE(object4.propertyFlags("foo") & ~QScriptValue::UserRange,
+ QScriptValue::PropertyGetter );
+
QEXPECT_FAIL("", "User-range flags are not retained", Continue);
QCOMPARE(object4.propertyFlags("foo"),
QScriptValue::PropertyGetter | QScriptValue::UserRange);
@@ -1841,9 +1844,12 @@ void tst_QScriptValue::getSetProperty()
// setter() sets this.x
object4.setProperty("foo", eng.newFunction(setter),
QScriptValue::PropertySetter | QScriptValue::UserRange);
+ QCOMPARE(object4.propertyFlags("foo") & ~QScriptValue::UserRange,
+ QScriptValue::PropertySetter | QScriptValue::PropertyGetter);
+
QEXPECT_FAIL("", "User-range flags are not retained", Continue);
QCOMPARE(object4.propertyFlags("foo"),
- QScriptValue::PropertySetter | QScriptValue::UserRange);
+ QScriptValue::PropertySetter | QScriptValue::PropertyGetter | QScriptValue::UserRange);
object4.setProperty("foo", str);
QCOMPARE(object4.property("x").strictlyEquals(str), true);
QCOMPARE(object4.property("foo").strictlyEquals(str), true);