summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptcontext
Commit message (Collapse)AuthorAgeFilesLines
* Avoid asserting when computing line number for backtraceKent Hansen2011-03-011-4/+2
| | | | | | | | | | | | | | | | | | With JSC asserts enabled (QtScript built without NDEBUG defined), JSC::CodeBlock::getBytecodeIndex() would assert because we sometimes called it with an address that was not inside the range of the block's JIT code. We never caught this bug because it just so happens that even though the assert fails, the function returns a result that causes our autotests to pass. Check that the returnPC is in range and report lineNumber -1 if not; this unifies the behavior of the interpreter and JIT, even though it's not the result we want. Task-number: QTBUG-17741 Reviewed-by: Olivier Goffart
* Make missing line number info an expected failureKent Hansen2011-02-281-8/+6
| | | | | | | | The fact that the line number is incorrect was hidden away in a comment in the test data. This commit makes it an explicit failure so that we're reminded of the issue. Reviewed-by: Olivier Goffart
* Merge remote-tracking branch 'origin/4.7' into qt-master-from-4.7Olivier Goffart2011-02-101-0/+44
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: doc/src/development/qmake-manual.qdoc mkspecs/symbian-gcce/qmake.conf qmake/project.cpp src/corelib/global/qnamespace.qdoc src/declarative/graphicsitems/qdeclarativetext.cpp src/gui/text/qtextdocumentlayout.cpp src/gui/text/qtextdocumentlayout_p.h tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp tests/auto/networkselftest/networkselftest.pro tests/auto/qscriptengine/tst_qscriptengine.cpp tools/designer/src/components/signalsloteditor/signalslot_utils.cpp tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp tools/qdoc3/test/qt-build-docs.qdocconf tools/qdoc3/test/qt-html-templates.qdocconf tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf tools/qdoc3/test/qt.qdocconf tools/qdoc3/test/qt_ja_JP.qdocconf tools/qdoc3/test/qt_zh_CN.qdocconf
| * Don't crash when creating backtrace for built-in JS function (2nd try)Kent Hansen2011-02-081-1/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 147df10403ba280b3f04c1e3d6c4b1cf386abe5d did not quite fix the issue; other places need the same checks. When the JIT is enabled, frames for built-in JS host calls (such as Array.prototype.forEach) are not fully initialized. In particular, the CodeBlock register of such frames is not set (see comment in JITCall.cpp). We need to check if the codeBlock is actually valid before we start using it. This fixes the crash(es) but not the problem of actually getting the arguments for such frames through the API. There's also a related problem when a QtScript function (newFunction()) is called as a callback of a built-in JS host function (QTBUG-17287). These problems will go away once JavaScriptCore is updated to a more recent version (4.8 at the earliest), since the native-vs-script frame handling has been unified. Task-number: QTBUG-17137 Reviewed-by: Olivier Goffart
| * Don't crash when creating backtrace for built-in JS functionKent Hansen2011-02-031-0/+15
| | | | | | | | | | | | | | | | | | | | | | 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
* | Add new tests cases to context tests.Jedrzej Nowacki2011-02-091-0/+71
| | | | | | | | | | | | | | New tests mostly check thisObject and globalObject behavior in conjunction with popScope and pushScope functions. Reviewed-by: Kent Hansen
* | Split QScriptContext autotest into smaller functionsKent Hansen2011-02-031-136/+194
| | | | | | | | | | Task-number: QTBUG-16746 Reviewed-by: Jedrzej Nowacki
* | Merge remote branch 'origin/4.7' into qt-master-from-4.7Olivier Goffart2011-01-171-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/webkit/imageanalyzer/imageanalyzer.h examples/webkit/imageanalyzer/mainwindow.h mkspecs/unsupported/qws/linux-x86-openkode-g++/qplatformdefs.h src/corelib/io/qfsfileengine_iterator_unix.cpp src/corelib/io/qfsfileengine_iterator_win.cpp src/corelib/kernel/qcoreapplication.cpp src/network/access/qnetworkaccessdatabackend.cpp src/plugins/bearer/connman/qconnmanservice_linux.cpp src/plugins/platforms/openvglite/qwindowsurface_vglite.h src/s60installs/bwins/QtCoreu.def src/s60installs/eabi/QtCoreu.def src/s60installs/s60installs.pro tools/assistant/tools/assistant/helpviewer_qwv.h tools/qdoc3/test/qt-html-templates.qdocconf
| * Update copyright year to 2011.Jason McDonald2011-01-101-1/+1
| | | | | | | | Reviewed-by: Trust Me
* | Add autotest that checks return value of QScriptContext::throwXXX()Kent Hansen2010-11-081-0/+49
| | | | | | | | | | | | | | | | | | The documentation says that they should return the error/value that was thrown. When throwError() is called from a native function call, the return value of the function will be ignored, so we need a test that calls throwError() outside of a function context. Reviewed-by: Jedrzej Nowacki
* | Refactor tst_QScriptContext::throwError test.Jedrzej Nowacki2010-11-031-59/+61
| | | | | | | | | | | | | | | | | | | | | | The test should use a data set instead of executing the same code block one by one. New function returning a string was added to the check. New case, replacing QSE::evaluate call by QSV::call, was added. Reviewed-by: Kent Hansen
* | Improve QtScript test coverageKent Hansen2010-10-291-0/+38
|/ | | | Based on BullsEye coverage reports.
* Ensure that activation object has been created before popping scope of ↵Kent Hansen2010-05-271-0/+45
| | | | | | | | | | | native context One shouldn't have to call activationObject() or scopeChain() before calling popScope(); the scope chain should always have 2 items (activation and global object) before we start popping anything from the internal chain. Task-number: QTBUG-11020 Reviewed-by: Olivier Goffart
* Update copyright year to 2010Jason McDonald2010-01-061-1/+1
| | | | Reviewed-by: Trust Me
* Add references to JIRA tasks for expected test failuresKent Hansen2009-11-231-1/+1
| | | | | | These are behavioral differences between QtScript in 4.6 and 4.5, and so should have tasks to figure out whether anyone actually depend on the behavior.
* QScriptContext::parentContext: don't skip unessecary framesOlivier Goffart2009-10-061-1/+0
| | | | | | | | Calling QScriptValue::call doesn't create a fake frame. We can detect a real fake frame as it does not have a callee. Task-number: QT-2270 Reviewed-by: Kent Hansen
* add test for QT-2270Kent Hansen2009-10-061-0/+17
|
* QScript: Add test for getting backtrace of recursive functionsOlivier Goffart2009-09-281-0/+66
|
* QScript: Fix strange bugs and crashes.Olivier Goffart2009-09-281-0/+25
| | | | | | | | | | I was assuming that the default return value register was always set to 0 for native calls. But this is not the case. So we must ensure this. Also be consistend in the way the stackframe grow and shrink. This expose another bug in the way the call frame is created in JSC Reviewed-by: Kent Hansen
* improve "nested evaluation" testKent Hansen2009-09-251-0/+10
| | | | | | | Test that the variable is stored in the correct activation object. Currently it's marked as an expected failure because it doesn't work with the JSC-based back-end. It did however work with the old back-end, so this is a regression.
* Update license headers again.Jason McDonald2009-09-091-4/+4
| | | | Reviewed-by: Trust Me
* Merge branch '4.5' into 4.6Thiago Macieira2009-08-311-13/+13
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: demos/boxes/glshaders.cpp demos/boxes/vector.h demos/embedded/fluidlauncher/pictureflow.cpp demos/embedded/fluidlauncher/pictureflow.h doc/src/desktop-integration.qdoc doc/src/distributingqt.qdoc doc/src/examples-overview.qdoc doc/src/examples.qdoc doc/src/frameworks-technologies/dbus-adaptors.qdoc doc/src/geometry.qdoc doc/src/groups.qdoc doc/src/objecttrees.qdoc doc/src/platform-notes.qdoc doc/src/plugins-howto.qdoc doc/src/qt3support.qdoc doc/src/qtdbus.qdoc doc/src/qtdesigner.qdoc doc/src/qtgui.qdoc doc/src/qtmain.qdoc doc/src/qtopengl.qdoc doc/src/qtsvg.qdoc doc/src/qtuiloader.qdoc doc/src/qundo.qdoc doc/src/richtext.qdoc doc/src/topics.qdoc src/corelib/tools/qdumper.cpp src/gui/embedded/qkbdpc101_qws.cpp src/gui/embedded/qkbdsl5000_qws.cpp src/gui/embedded/qkbdusb_qws.cpp src/gui/embedded/qkbdvr41xx_qws.cpp src/gui/embedded/qkbdyopy_qws.cpp src/gui/embedded/qmousebus_qws.cpp src/gui/embedded/qmousevr41xx_qws.cpp src/gui/embedded/qmouseyopy_qws.cpp src/gui/painting/qpaintengine_d3d.cpp src/gui/painting/qwindowsurface_d3d.cpp src/opengl/gl2paintengineex/glgc_shader_source.h src/opengl/gl2paintengineex/qglpexshadermanager.cpp src/opengl/gl2paintengineex/qglpexshadermanager_p.h src/opengl/gl2paintengineex/qglshader.cpp src/opengl/gl2paintengineex/qglshader_p.h src/opengl/util/fragmentprograms_p.h src/plugins/kbddrivers/linuxis/linuxiskbdhandler.cpp src/plugins/mousedrivers/linuxis/linuxismousehandler.cpp src/script/parser/qscript.g src/script/qscriptarray_p.h src/script/qscriptasm_p.h src/script/qscriptbuffer_p.h src/script/qscriptclass.cpp src/script/qscriptclassdata_p.h src/script/qscriptcompiler.cpp src/script/qscriptcompiler_p.h src/script/qscriptcontext.cpp src/script/qscriptcontext_p.cpp src/script/qscriptcontext_p.h src/script/qscriptcontextfwd_p.h src/script/qscriptecmaarray.cpp src/script/qscriptecmaarray_p.h src/script/qscriptecmaboolean.cpp src/script/qscriptecmacore.cpp src/script/qscriptecmadate.cpp src/script/qscriptecmadate_p.h src/script/qscriptecmaerror.cpp src/script/qscriptecmaerror_p.h src/script/qscriptecmafunction.cpp src/script/qscriptecmafunction_p.h src/script/qscriptecmaglobal.cpp src/script/qscriptecmaglobal_p.h src/script/qscriptecmamath.cpp src/script/qscriptecmamath_p.h src/script/qscriptecmanumber.cpp src/script/qscriptecmanumber_p.h src/script/qscriptecmaobject.cpp src/script/qscriptecmaobject_p.h src/script/qscriptecmaregexp.cpp src/script/qscriptecmaregexp_p.h src/script/qscriptecmastring.cpp src/script/qscriptecmastring_p.h src/script/qscriptengine.cpp src/script/qscriptengine_p.cpp src/script/qscriptengine_p.h src/script/qscriptenginefwd_p.h src/script/qscriptextenumeration.cpp src/script/qscriptextenumeration_p.h src/script/qscriptextqobject.cpp src/script/qscriptextqobject_p.h src/script/qscriptextvariant.cpp src/script/qscriptfunction.cpp src/script/qscriptfunction_p.h src/script/qscriptgc_p.h src/script/qscriptmember_p.h src/script/qscriptobject_p.h src/script/qscriptprettypretty.cpp src/script/qscriptprettypretty_p.h src/script/qscriptvalue.cpp src/script/qscriptvalueimpl.cpp src/script/qscriptvalueimpl_p.h src/script/qscriptvalueimplfwd_p.h src/script/qscriptvalueiteratorimpl.cpp src/script/qscriptxmlgenerator.cpp src/script/qscriptxmlgenerator_p.h tests/auto/linguist/lupdate/testdata/recursivescan/project.ui tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp tests/auto/qkeyevent/tst_qkeyevent.cpp tools/linguist/shared/cpp.cpp
| * Update tech preview license header.Jason McDonald2009-08-311-13/+13
| | | | | | | | Reviewed-by: Trust Me
| * Update license headers.Jason McDonald2009-08-111-1/+1
| | | | | | | | Reviewed-by: Trust Me
* | Make it possible for autotests to check if JIT is enabled or notKent Hansen2009-08-281-10/+14
| | | | | | | | | | | | Currently there are some differences in behavior and availability of information between the interpreter and the JIT. This is now documented as expected failures in the relevant autotests.
* | QScriptContextInfo: fix the line numbers with JITOlivier Goffart2009-08-281-2/+8
| | | | | | | | It even works better than with the interpreter
* | Fix QScriptContext::argumentObjects for function called with QScriptValue::callOlivier Goffart2009-08-241-0/+35
| | | | | | | | They have the hostCallFrameFlag, but are function context, not <eval> context
* | Fix the QScriptContext::argumentsObject and QScriptContext::argument for js ↵Olivier Goffart2009-08-181-5/+48
| | | | | | | | | | | | | | | | | | | | | | | | functions On js functions, if the number of arguments is different from the number of expected arguments, they are located in different place in the stackframe. We need to call the JSC functions that take that into account. Test is the backtrace test Reviewed-by: Kent Hansen
* | Fix the line numbers on the backtraceOlivier Goffart2009-08-181-3/+6
| | | | | | | | | | | | | | The returnPC points to the opcode after the call, but we want the opcode right before to compute the line number. Reviewed-by: Kent Hansen
* | test default scope chain after a new context has been pushedKent Hansen2009-08-171-0/+3
| | | | | | | | | | The scope chain should contain the activation object and the Global Object.
* | push the right object when the argument is the Global ObjectKent Hansen2009-08-141-12/+9
| | | | | | | | | | | | | | | | | | Since the internal Global Object is never exposed to the public, we need to do like we do in setActivationObject(): if the object passed is the Global Object proxy, use the internal Global Object as the "real" argument. (JSC requires that the initial object pushed onto the scope chain is an instance of JSC::JSGlobalObject, and the Global Object proxy is not; hence, we can't push the proxy.)
* | Detect evaluation context in the backtraceOlivier Goffart2009-08-141-2/+2
| |
* | More polishing on the backtraceOlivier Goffart2009-08-141-18/+18
| | | | | | | | | | | | change the coding style of function from foo (arg=text) to foo(arg = 'text')
* | more extensive backtrace testOlivier Goffart2009-08-141-12/+93
| |
* | Polish the QScriptContext::backtrace()Olivier Goffart2009-08-141-4/+3
| | | | | | | | | | | | | | - in QScriptContextInfo, get the filename of specials context - in QScriptContextInfo, get the right information for the global context (from the skipped fake frame) - addapt the test to the current backtrace layout.
* | make sure QScriptContext::scopeChain() returns the right objectKent Hansen2009-08-141-0/+2
| | | | | | | | | | | | | | | | Follow-up to commit e0a86dc604b87921652b844a5f85889bb6291ed9. Just like in the activationObject() function, we need to check if the activation object is actually a proxy to another object, and return that other object if that's the case (the proxy object should not be exposed to the public).
* | make it possible for any script object to serve as activation objectKent Hansen2009-08-141-2/+37
| | | | | | | | | | | | | | This was possible in the old back-end. In JSC, activation objects have to be instances of JSC::JSVariableObject. So the way we solve it is by having our QScriptActivationObject be able to act as a proxy to any other JSObject.
* | Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into ↵Kent Hansen2009-08-121-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qtscript-jsc-backend Conflicts: configure src/script/qscriptarray_p.h src/script/qscriptasm.cpp src/script/qscriptasm_p.h src/script/qscriptbuffer_p.h src/script/qscriptclass.cpp src/script/qscriptclassdata.cpp src/script/qscriptclassdata_p.h src/script/qscriptclassinfo_p.h src/script/qscriptclasspropertyiterator_p.h src/script/qscriptcompiler.cpp src/script/qscriptcompiler_p.h src/script/qscriptcontext_p.cpp src/script/qscriptcontext_p.h src/script/qscriptcontextfwd_p.h src/script/qscriptcontextinfo_p.h src/script/qscriptecmaarray.cpp src/script/qscriptecmaarray_p.h src/script/qscriptecmaboolean.cpp src/script/qscriptecmaboolean_p.h src/script/qscriptecmacore.cpp src/script/qscriptecmacore_p.h src/script/qscriptecmadate.cpp src/script/qscriptecmadate_p.h src/script/qscriptecmaerror.cpp src/script/qscriptecmaerror_p.h src/script/qscriptecmafunction.cpp src/script/qscriptecmafunction_p.h src/script/qscriptecmaglobal.cpp src/script/qscriptecmaglobal_p.h src/script/qscriptecmamath.cpp src/script/qscriptecmamath_p.h src/script/qscriptecmanumber.cpp src/script/qscriptecmanumber_p.h src/script/qscriptecmaobject.cpp src/script/qscriptecmaobject_p.h src/script/qscriptecmaregexp.cpp src/script/qscriptecmaregexp_p.h src/script/qscriptecmastring.cpp src/script/qscriptecmastring_p.h src/script/qscriptengine.cpp src/script/qscriptengine_p.cpp src/script/qscriptengine_p.h src/script/qscriptengineagent_p.h src/script/qscriptenginefwd_p.h src/script/qscriptextenumeration.cpp src/script/qscriptextenumeration_p.h src/script/qscriptextqobject.cpp src/script/qscriptextqobject_p.h src/script/qscriptextvariant.cpp src/script/qscriptextvariant_p.h src/script/qscriptfunction.cpp src/script/qscriptfunction_p.h src/script/qscriptgc_p.h src/script/qscriptglobals_p.h src/script/qscriptmember_p.h src/script/qscriptnameid_p.h src/script/qscriptnodepool_p.h src/script/qscriptobject_p.h src/script/qscriptobjectfwd_p.h src/script/qscriptprettypretty.cpp src/script/qscriptprettypretty_p.h src/script/qscriptsyntaxcheckresult_p.h src/script/qscriptvalue.cpp src/script/qscriptvalue_p.h src/script/qscriptvaluefwd_p.h src/script/qscriptvalueimpl.cpp src/script/qscriptvalueimpl_p.h src/script/qscriptvalueimplfwd_p.h src/script/qscriptvalueiteratorimpl.cpp src/script/qscriptvalueiteratorimpl_p.h
| * | Update contact URL in license headers.Jason McDonald2009-08-121-1/+1
| | | | | | | | | | | | Reviewed-by: Trust Me
* | | make it possible to pop all items in a scope chain and then push to itKent Hansen2009-08-111-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A lot of the JSC::ExecState functions rely on scopeChain() not being 0. This means we shouldn't pop the scope chain if doing so would make it empty; otherwise when you call e.g. pushScope() or evaluate(), you will crash. So instead of popping the chain completely, we now set the sole scope chain item's object pointer to 0 and add appropriate checks elsewhere. A second issue, not solved in this commit, is that JSC expects the Global Object to always be the last item in every scope chain. If it's not, you will crash.
* | | Fix line number and arguments in QScriptContext::toStringOlivier Goffart2009-08-111-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For arguments, we always need to skip the implicit 'this' argument For line number, we walk thought the stack frames from the top to find the one above the requested one, which contains the returnPC we need. Also fixed a crash because QScriptContext::parentContext would have returned a pointer with flags inside. Reviewed-by: Kent Hansen
* | | Test the activationObject for js functionsOlivier Goffart2009-08-101-0/+25
| | |
* | | more tests for the QScriptContext::argumentsObjectOlivier Goffart2009-08-101-4/+11
| | |
* | | make QScriptContext::setScope() fail for object created in other engineKent Hansen2009-08-101-8/+15
| | | | | | | | | | | | | | | Also fix some autotest failures, improve the descriptions of failures, and make the tests run to completion.
* | | implement QScriptContext::setActivationObject()Kent Hansen2009-08-101-2/+6
| | |
* | | implement QScriptContext::backtrace()Kent Hansen2009-08-101-1/+1
| | | | | | | | | | | | | | | Doesn't pass the test yet, but at least it returns something that might be useful on occasion.
* | | skip the QScriptContext::returnValue() testKent Hansen2009-08-101-2/+1
| | | | | | | | | | | | | | | returnValue() and setReturnValue() are internal functions not implemented in the JSC-based back-end.
* | | Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into ↵Kent Hansen2009-08-051-0/+30
|\ \ \ | |/ / | | | | | | | | | | | | | | | qtscript-jsc-backend Conflicts: src/script/qscriptextqobject.cpp
| * | test that activation and this-object can be inherited from parent contextKent Hansen2009-07-311-0/+30
| | |
* | | Do not crash if using popContext() while the current context have not been ↵Olivier Goffart2009-08-041-6/+2
| | | | | | | | | | | | | | | | | | pushed Reviewed-by: Kent Hansen