diff options
author | Frans Englich <frans.englich@nokia.com> | 2010-04-10 18:47:51 (GMT) |
---|---|---|
committer | Frans Englich <frans.englich@nokia.com> | 2010-04-10 18:47:51 (GMT) |
commit | e0408d9aaa19c16fd78fd9a2bf9edd25abf8bb9e (patch) | |
tree | 05114039874d5c28d43f1bfaf6ab43ac5b4c9493 /src/script/api/qscriptvalue.cpp | |
parent | 3de3c5b73f788a52f9c1d1c3699b2c90149c6646 (diff) | |
parent | 587f4325850615392e99881e060121bd5ea85360 (diff) | |
download | Qt-e0408d9aaa19c16fd78fd9a2bf9edd25abf8bb9e.zip Qt-e0408d9aaa19c16fd78fd9a2bf9edd25abf8bb9e.tar.gz Qt-e0408d9aaa19c16fd78fd9a2bf9edd25abf8bb9e.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.6
Diffstat (limited to 'src/script/api/qscriptvalue.cpp')
-rw-r--r-- | src/script/api/qscriptvalue.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 8cf01e7..79d5dcb 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -792,19 +792,28 @@ void QScriptValue::setPrototype(const QScriptValue &prototype) "a different engine"); return; } + JSC::JSObject *thisObject = JSC::asObject(d->jscValue); JSC::JSValue other = d->engine->scriptValueToJSCValue(prototype); // check for cycle JSC::JSValue nextPrototypeValue = other; while (nextPrototypeValue && nextPrototypeValue.isObject()) { JSC::JSObject *nextPrototype = JSC::asObject(nextPrototypeValue); - if (nextPrototype == JSC::asObject(d->jscValue)) { + if (nextPrototype == thisObject) { qWarning("QScriptValue::setPrototype() failed: cyclic prototype value"); return; } nextPrototypeValue = nextPrototype->prototype(); } - JSC::asObject(d->jscValue)->setPrototype(other); + + thisObject->setPrototype(other); + + // Sync the internal Global Object prototype if appropriate. + if (((thisObject == d->engine->originalGlobalObjectProxy) + && !d->engine->customGlobalObject()) + || (thisObject == d->engine->customGlobalObject())) { + d->engine->originalGlobalObject()->setPrototype(other); + } } /*! |