diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-07-28 12:39:29 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-07-28 12:39:29 (GMT) |
commit | 9e6407ac53ffa62439a52beb1adc8169664c569a (patch) | |
tree | a81a8b5ef865e343437f0e47929d7a0bf1dd663c /src/script/api/qscriptvalue.cpp | |
parent | e7a986d9348062297471c2f15b2e577154ebf19c (diff) | |
download | Qt-9e6407ac53ffa62439a52beb1adc8169664c569a.zip Qt-9e6407ac53ffa62439a52beb1adc8169664c569a.tar.gz Qt-9e6407ac53ffa62439a52beb1adc8169664c569a.tar.bz2 |
don't allow defining getter/setter for __proto__ property
Diffstat (limited to 'src/script/api/qscriptvalue.cpp')
-rw-r--r-- | src/script/api/qscriptvalue.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index d410973..848b319 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -1880,10 +1880,15 @@ void QScriptValue::setProperty(const QScriptString &name, } else { if (jscValue.isObject()) { // ### should check if it has callData() // defining getter/setter - if (flags & QScriptValue::PropertyGetter) - thisObject->defineGetter(exec, id, JSC::asObject(jscValue)); - if (flags & QScriptValue::PropertySetter) - thisObject->defineSetter(exec, id, JSC::asObject(jscValue)); + if (id == exec->propertyNames().underscoreProto) { + qWarning("QScriptValue::setProperty() failed: " + "cannot set getter or setter of native property `__proto__'"); + } else { + if (flags & QScriptValue::PropertyGetter) + thisObject->defineGetter(exec, id, JSC::asObject(jscValue)); + if (flags & QScriptValue::PropertySetter) + thisObject->defineSetter(exec, id, JSC::asObject(jscValue)); + } } else { qWarning("QScriptValue::setProperty(): getter/setter must be a function"); } |