diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-07-27 14:32:16 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-07-27 17:58:12 (GMT) |
commit | b9026b5f2182db6f0e607035cb4ac3798bf09054 (patch) | |
tree | 4b3c06b391e10d063f3301705e7b8f314c9d3826 /src/script/api/qscriptcontext.cpp | |
parent | 4832462e2f0a3f68485ae85efff368e3346d5c1f (diff) | |
download | Qt-b9026b5f2182db6f0e607035cb4ac3798bf09054.zip Qt-b9026b5f2182db6f0e607035cb4ac3798bf09054.tar.gz Qt-b9026b5f2182db6f0e607035cb4ac3798bf09054.tar.bz2 |
don't rely on custom global object to get GC callback
Install custom ClientData on JSGlobalData instance instead.
Also some cleanups to avoid globalObject et al being accessed
directly.
Killed the proxying scheme employed in setGlobalObject() since it
didn't work; if you stored the original Global Object and replaced
it with another object, then added properties to the new object,
they would show up in the old object, too (because the old object
would always proxy to whatever the current Global Object was).
Diffstat (limited to 'src/script/api/qscriptcontext.cpp')
-rw-r--r-- | src/script/api/qscriptcontext.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/script/api/qscriptcontext.cpp b/src/script/api/qscriptcontext.cpp index e05e786..8d4fe18 100644 --- a/src/script/api/qscriptcontext.cpp +++ b/src/script/api/qscriptcontext.cpp @@ -205,8 +205,8 @@ QScriptContext::QScriptContext() QScriptValue QScriptContext::throwValue(const QScriptValue &value) { Q_D(QScriptContext); - JSC::ExecState *exec = d->engine->globalObject->globalExec(); JSC::JSValue jscValue = d->engine->scriptValueToJSCValue(value); + JSC::ExecState *exec = d->frame; exec->setException(jscValue); return value; } @@ -248,7 +248,7 @@ QScriptValue QScriptContext::throwError(Error error, const QString &text) jscError = JSC::URIError; break; } - JSC::ExecState *exec = d->engine->globalObject->globalExec(); + JSC::ExecState *exec = d->frame; JSC::JSObject *result = JSC::throwError(exec, jscError, QScript::qtStringToJSCUString(text)); return d->engine->scriptValueFromJSCValue(result); } @@ -264,7 +264,7 @@ QScriptValue QScriptContext::throwError(Error error, const QString &text) QScriptValue QScriptContext::throwError(const QString &text) { Q_D(QScriptContext); - JSC::ExecState *exec = d->engine->globalObject->globalExec(); + JSC::ExecState *exec = d->frame; JSC::JSObject *result = JSC::throwError(exec, JSC::GeneralError, QScript::qtStringToJSCUString(text)); return d->engine->scriptValueFromJSCValue(result); } @@ -334,7 +334,7 @@ QScriptValue QScriptContext::callee() const QScriptValue QScriptContext::argumentsObject() const { Q_D(const QScriptContext); - if (d->frame == d->engine->globalObject->globalExec()) { + if (d->frame == d->engine->globalExec()) { //global context doesn't have any argument, return an empty object return static_cast<QScriptEngine *>(d->engine->q_ptr)->newObject(); } @@ -481,7 +481,7 @@ void QScriptContext::setThisObject(const QScriptValue &thisObject) "a different engine"); return; } - if (d->frame == d->engine->globalObject->globalExec()) { + if (d->frame == d->engine->globalExec()) { qWarning("QScriptContext::setThisObject(): setting this-object of global context is not supported"); return; } @@ -501,7 +501,7 @@ void QScriptContext::setThisObject(const QScriptValue &thisObject) QScriptContext::ExecutionState QScriptContext::state() const { Q_D(const QScriptContext); - if (d->engine->globalObject->globalExec()->hadException()) + if (d->frame->hadException()) return QScriptContext::ExceptionState; return QScriptContext::NormalState; } |