diff options
author | Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> | 2011-02-08 21:19:32 (GMT) |
---|---|---|
committer | Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> | 2011-02-09 11:50:43 (GMT) |
commit | e8abc416f07f74dd12e75b61be0aeac297b7a1f8 (patch) | |
tree | 46147a4346490d166ba3d0924a5508c3002ce675 /src/script | |
parent | ebfbc5c03f689304fdd250fba46bbbfffb9af254 (diff) | |
download | Qt-e8abc416f07f74dd12e75b61be0aeac297b7a1f8.zip Qt-e8abc416f07f74dd12e75b61be0aeac297b7a1f8.tar.gz Qt-e8abc416f07f74dd12e75b61be0aeac297b7a1f8.tar.bz2 |
QScriptEngine: fix property flags for native functions
Fix the tests and implementation to conform with ECMA-262, property
"prototype" of the function and "constructor" of the prototype object
associated with the function.
Reviewed-by: Kent Hansen
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 004e3a5..8e45589 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -2078,10 +2078,10 @@ QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionSignature fun, JSC::ExecState* exec = d->currentFrame; JSC::JSValue function = new (exec)QScript::FunctionWrapper(exec, length, JSC::Identifier(exec, ""), fun); QScriptValue result = d->scriptValueFromJSCValue(function); - result.setProperty(QLatin1String("prototype"), prototype, QScriptValue::Undeletable); + result.setProperty(QLatin1String("prototype"), prototype, + QScriptValue::Undeletable | QScriptValue::SkipInEnumeration); const_cast<QScriptValue&>(prototype) - .setProperty(QLatin1String("constructor"), result, - QScriptValue::Undeletable | QScriptValue::SkipInEnumeration); + .setProperty(QLatin1String("constructor"), result, QScriptValue::SkipInEnumeration); return result; } @@ -2347,9 +2347,9 @@ QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionSignature fun, in JSC::JSValue function = new (exec)QScript::FunctionWrapper(exec, length, JSC::Identifier(exec, ""), fun); QScriptValue result = d->scriptValueFromJSCValue(function); QScriptValue proto = newObject(); - result.setProperty(QLatin1String("prototype"), proto, QScriptValue::Undeletable); - proto.setProperty(QLatin1String("constructor"), result, - QScriptValue::Undeletable | QScriptValue::SkipInEnumeration); + result.setProperty(QLatin1String("prototype"), proto, + QScriptValue::Undeletable | QScriptValue::SkipInEnumeration); + proto.setProperty(QLatin1String("constructor"), result, QScriptValue::SkipInEnumeration); return result; } @@ -2365,9 +2365,9 @@ QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionWithArgSignature JSC::JSValue function = new (exec)QScript::FunctionWithArgWrapper(exec, /*length=*/0, JSC::Identifier(exec, ""), fun, arg); QScriptValue result = d->scriptValueFromJSCValue(function); QScriptValue proto = newObject(); - result.setProperty(QLatin1String("prototype"), proto, QScriptValue::Undeletable); - proto.setProperty(QLatin1String("constructor"), result, - QScriptValue::Undeletable | QScriptValue::SkipInEnumeration); + result.setProperty(QLatin1String("prototype"), proto, + QScriptValue::Undeletable | QScriptValue::SkipInEnumeration); + proto.setProperty(QLatin1String("constructor"), result, QScriptValue::SkipInEnumeration); return result; } |