summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptcontext.cpp
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2011-02-15 13:13:01 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2011-02-15 13:13:01 (GMT)
commit1c5596b514d3a590bd624c9e83606b435e5d4889 (patch)
treee2e672c4822fe26bea8b7e4a1424931da23a7639 /src/script/api/qscriptcontext.cpp
parent9c8b54fab60835f24cd15b806a7919df804c4615 (diff)
parent7033466baf4f78fd580d5dd54a0a4a2e42d71603 (diff)
downloadQt-1c5596b514d3a590bd624c9e83606b435e5d4889.zip
Qt-1c5596b514d3a590bd624c9e83606b435e5d4889.tar.gz
Qt-1c5596b514d3a590bd624c9e83606b435e5d4889.tar.bz2
Merge branch '4.7-upstream' into 4.7
Diffstat (limited to 'src/script/api/qscriptcontext.cpp')
-rw-r--r--src/script/api/qscriptcontext.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/script/api/qscriptcontext.cpp b/src/script/api/qscriptcontext.cpp
index 59ea52d..2468a46 100644
--- a/src/script/api/qscriptcontext.cpp
+++ b/src/script/api/qscriptcontext.cpp
@@ -299,6 +299,12 @@ QScriptValue QScriptContext::argumentsObject() const
//for a js function
if (frame->codeBlock() && frame->callee()) {
+ if (!QScriptEnginePrivate::hasValidCodeBlockRegister(frame)) {
+ // We have a built-in JS host call.
+ // codeBlock is needed by retrieveArguments(), but since it
+ // contains junk, we would crash. Return an invalid value for now.
+ return QScriptValue();
+ }
JSC::JSValue result = frame->interpreter()->retrieveArguments(frame, JSC::asFunction(frame->callee()));
return QScript::scriptEngineFromExec(frame)->scriptValueFromJSCValue(result);
}
@@ -309,7 +315,8 @@ QScriptValue QScriptContext::argumentsObject() const
}
//for a native function
- if (!frame->optionalCalleeArguments()) {
+ if (!frame->optionalCalleeArguments()
+ && QScriptEnginePrivate::hasValidCodeBlockRegister(frame)) { // Make sure we don't go here for host JSFunctions
Q_ASSERT(frame->argumentCount() > 0); //we need at least 'this' otherwise we'll crash later
JSC::Arguments* arguments = new (&frame->globalData())JSC::Arguments(frame, JSC::Arguments::NoParameters);
frame->setCalleeArguments(arguments);