diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-07 06:57:21 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-07 06:57:21 (GMT) |
commit | a3a6e1622149654bc9e244e685e8e7dcbdf966b2 (patch) | |
tree | 1c4fe9feab63839213a0d97e9b24414c9585a227 /src/script | |
parent | 99573a8e81fcea38c5f68b340068fff266315c03 (diff) | |
parent | 8b0cac9179de4d1cb34b9f17932d34cef3cd4f5b (diff) | |
download | Qt-a3a6e1622149654bc9e244e685e8e7dcbdf966b2.zip Qt-a3a6e1622149654bc9e244e685e8e7dcbdf966b2.tar.gz Qt-a3a6e1622149654bc9e244e685e8e7dcbdf966b2.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into test
Conflicts:
demos/declarative/samegame/content/samegame.js
tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 13 | ||||
-rw-r--r-- | src/script/api/qscriptvalue.cpp | 6 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 785d80f..029d3a5 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -824,7 +824,6 @@ QScriptEnginePrivate::QScriptEnginePrivate() JSC::JSGlobalObject *globalObject = new (globalData)QScript::GlobalObject(); JSC::ExecState* exec = globalObject->globalExec(); - *thisRegisterForFrame(exec) = JSC::JSValue(); scriptObjectStructure = QScriptObject::createStructure(globalObject->objectPrototype()); @@ -1013,7 +1012,7 @@ void QScriptEnginePrivate::setDefaultPrototype(int metaTypeId, JSC::JSValue prot QScriptContext *QScriptEnginePrivate::contextForFrame(JSC::ExecState *frame) { - if (frame && frame->callerFrame()->hasHostCallFrameFlag() + if (frame && frame->callerFrame()->hasHostCallFrameFlag() && !frame->callee() && frame->callerFrame()->removeHostCallFrameFlag() == QScript::scriptEngineFromExec(frame)->globalExec()) { //skip the "fake" context created in Interpreter::execute. frame = frame->callerFrame()->removeHostCallFrameFlag(); @@ -1098,12 +1097,13 @@ JSC::JSValue QScriptEnginePrivate::toUsableValue(JSC::JSValue value) /*! \internal Return the 'this' value for a given context - The result may be null for the global context */ JSC::JSValue QScriptEnginePrivate::thisForContext(JSC::ExecState *frame) { if (frame->codeBlock() != 0) { return frame->thisValue(); + } else if(frame == frame->lexicalGlobalObject()->globalExec()) { + return frame->globalThisValue(); } else { JSC::Register *thisRegister = thisRegisterForFrame(frame); return thisRegister->jsValue(); @@ -1135,8 +1135,7 @@ uint QScriptEnginePrivate::contextFlags(JSC::ExecState *exec) void QScriptEnginePrivate::setContextFlags(JSC::ExecState *exec, uint flags) { Q_ASSERT(!exec->codeBlock()); - quintptr flag_ptr = flags; - exec->registers()[JSC::RegisterFile::ReturnValueRegister] = JSC::JSValue(reinterpret_cast<JSC::JSObject*>(flag_ptr)); + exec->registers()[JSC::RegisterFile::ReturnValueRegister] = JSC::Register::withInt(flags); } @@ -2212,7 +2211,7 @@ QScriptValue QScriptEngine::evaluate(const QScriptProgram &program) WTF::RefPtr<JSC::EvalNode> &evalNode = program.d->evalNode; - JSC::EvalExecutable executable(program.d->source); + JSC::EvalExecutable executable(exec, program.d->source); executable.compile(exec, evalNode, exec->scopeChain()); JSC::JSValue thisValue = d->thisForContext(exec); @@ -2301,7 +2300,7 @@ QScriptValue QScriptEngine::evaluate(const QString &program, const QString &file exec->clearException(); JSC::DynamicGlobalObjectScope dynamicGlobalObjectScope(exec, exec->scopeChain()->globalObject()); - JSC::EvalExecutable executable(source); + JSC::EvalExecutable executable(exec, source); JSC::JSObject* error = executable.compile(exec, exec->scopeChain()); if (error) { exec->setException(error); diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index d8b4822..7136a85 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -1743,7 +1743,7 @@ QScriptValue QScriptValue::property(quint32 arrayIndex, void QScriptValue::setProperty(quint32 arrayIndex, const QScriptValue &value, const PropertyFlags &flags) { - Q_D(const QScriptValue); + Q_D(QScriptValue); if (!d || !d->isObject()) return; if (value.engine() && (value.engine() != engine())) { @@ -1757,7 +1757,9 @@ void QScriptValue::setProperty(quint32 arrayIndex, const QScriptValue &value, JSC::asObject(d->jscValue)->deleteProperty(exec, arrayIndex, /*checkDontDelete=*/false); } else { if ((flags & QScriptValue::PropertyGetter) || (flags & QScriptValue::PropertySetter)) { - Q_ASSERT_X(false, Q_FUNC_INFO, "property getters and setters not implemented"); + // fall back to string-based setProperty(), since there is no + // JSC::JSObject::defineGetter(unsigned) + d->setProperty(JSC::Identifier::from(exec, arrayIndex), value, flags); } else { if (flags != QScriptValue::KeepExistingFlags) { // if (JSC::asObject(d->jscValue)->hasOwnProperty(exec, arrayIndex)) |