diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2011-02-03 11:28:27 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2011-02-09 07:16:01 (GMT) |
commit | 713f07486de353f30fb63d2e2e3b17202a5d4a1b (patch) | |
tree | c1471148c584aecb230b972227ceecf37ac0bfb4 /src/script | |
parent | 70cacb48b0bdbfe6ca58b7472cbeadb18d4dfc35 (diff) | |
download | Qt-713f07486de353f30fb63d2e2e3b17202a5d4a1b.zip Qt-713f07486de353f30fb63d2e2e3b17202a5d4a1b.tar.gz Qt-713f07486de353f30fb63d2e2e3b17202a5d4a1b.tar.bz2 |
Don't crash when creating backtrace for built-in JS function
When the JIT is enabled, NativeFunctionWrapper (used for
built-in functions such as Array.prototype.forEach) inherits
JSFunction, so we must check whether the function is
actually a JS (script) function before we start accessing
script-specific properties.
Task-number: QTBUG-17137
Reviewed-by: Olivier Goffart
(cherry picked from commit 147df10403ba280b3f04c1e3d6c4b1cf386abe5d)
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/api/qscriptcontextinfo.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/script/api/qscriptcontextinfo.cpp b/src/script/api/qscriptcontextinfo.cpp index db6b2d7..d39abe6 100644 --- a/src/script/api/qscriptcontextinfo.cpp +++ b/src/script/api/qscriptcontextinfo.cpp @@ -181,7 +181,8 @@ QScriptContextInfoPrivate::QScriptContextInfoPrivate(const QScriptContext *conte JSC::JSObject *callee = frame->callee(); if (callee && callee->inherits(&JSC::InternalFunction::info)) functionName = JSC::asInternalFunction(callee)->name(frame); - if (callee && callee->inherits(&JSC::JSFunction::info)) { + if (callee && callee->inherits(&JSC::JSFunction::info) + && !JSC::asFunction(callee)->isHostFunction()) { functionType = QScriptContextInfo::ScriptFunction; JSC::FunctionExecutable *body = JSC::asFunction(callee)->jsExecutable(); functionStartLineNumber = body->lineNo(); |