diff options
Diffstat (limited to 'src/script/api/qscriptvalue.cpp')
-rw-r--r-- | src/script/api/qscriptvalue.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index fbd5d96..8cd4057 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -1726,10 +1726,12 @@ QScriptValue QScriptValue::construct(const QScriptValueList &args) JSC::JSValue savedException; QScriptEnginePrivate::saveException(exec, &savedException); - JSC::JSObject *result = JSC::construct(exec, callee, constructType, constructData, jscArgs); + JSC::JSValue result; + JSC::JSObject *newObject = JSC::construct(exec, callee, constructType, constructData, jscArgs); if (exec->hadException()) { - result = JSC::asObject(exec->exception()); + result = exec->exception(); } else { + result = newObject; QScriptEnginePrivate::restoreException(exec, savedException); } return d->engine->scriptValueFromJSCValue(result); @@ -1786,11 +1788,12 @@ QScriptValue QScriptValue::construct(const QScriptValue &arguments) JSC::JSValue savedException; QScriptEnginePrivate::saveException(exec, &savedException); - JSC::JSObject *result = JSC::construct(exec, callee, constructType, constructData, applyArgs); + JSC::JSValue result; + JSC::JSObject *newObject = JSC::construct(exec, callee, constructType, constructData, applyArgs); if (exec->hadException()) { - if (exec->exception().isObject()) - result = JSC::asObject(exec->exception()); + result = exec->exception(); } else { + result = newObject; QScriptEnginePrivate::restoreException(exec, savedException); } return d->engine->scriptValueFromJSCValue(result); @@ -2023,6 +2026,7 @@ void QScriptValue::setData(const QScriptValue &data) Q_D(QScriptValue); if (!d || !d->isObject()) return; + QScript::APIShim shim(d->engine); JSC::JSValue other = d->engine->scriptValueToJSCValue(data); if (d->jscValue.inherits(&QScriptObject::info)) { QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(d->jscValue)); |