summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptengine
Commit message (Collapse)AuthorAgeFilesLines
* fix tst_qscriptengine after merging MR-1149Zeno Albisser2011-04-281-0/+2
| | | | Reviewed-by: Olivier Goffart
* Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-air-staging into ↵Qt Continuous Integration System2011-03-021-3/+48
|\ | | | | | | | | | | | | | | | | | | | | master-integration * 'master' of scm.dev.nokia.troll.no:qt/qt-air-staging: Don't allow non-Object values to be set as prototype Enable QtScript/JavaScriptCore ASSERTs in debug mode Don't assert in abortEvaluation() autotest Avoid asserting when computing line number for backtrace Make missing line number info an expected failure
| * Don't assert in abortEvaluation() autotestKent Hansen2011-03-011-3/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When QtScript is built without NDEBUG defined, the tst_QScriptEngine::abortEvaluation() test would assert. This was due to commit 716e0284c8f569d71e42354fd6fc3b965233e019, which fixed the tst_QScriptEngine::throwErrorFromProcessEvents() autotest for a script containing an infinite while-loop with an empty body. The CHECK_FOR_EXCEPTION_AT_END() that we added should only be done if the timeout checker did not report a timeout; otherwise the JSC state becomes corrupted due to returnToThrowTrampoline() being called twice. This caused an assert later when calculating the line number of the exception. Also add test cases for scripts with try-catch statements. For abortEvaluation(), scripts should not be able to observe (i.e. catch) the interrupted exception, but if an error is thrown using QScriptContext::throwError(), the script should be able to catch it. Task-number: QTBUG-17854 Reviewed-by: Olivier Goffart
* | Merge remote-tracking branch 'origin/4.7' into qt-master-from-4.7Olivier Goffart2011-03-011-0/+11
|\ \ | |/ |/| | | | | | | | | | | | | | | Conflicts: src/gui/text/qfontengine_mac.mm src/opengl/qpixmapdata_gl.cpp src/opengl/qwindowsurface_gl.cpp src/s60installs/bwins/QtOpenGLu.def src/s60installs/eabi/QtOpenGLu.def tests/auto/qtextlayout/tst_qtextlayout.cpp
| * Don't crash when marking arguments object of native contextKent Hansen2011-02-251-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | JSC assumes that the callee is always valid, since JSC::Arguments is used for JS frames, which must have a callee. But we use JSC::Arguments for arguments object of pushContext()-created contexts, and then there is no callee. But the callee member can't be null, so now we put a fake callee there and make sure it doesn't bleed up to the public API. Alternative solution: Add "if (d->callee)" to JSC::Arguments::markChildren(), then no other changes would be needed. But we don't want to patch JSC any more. Non-solution: Subclass JSC::Arguments and reimplement markChildren() to temporarily set a dummy callee during marking. Can't be done, as JSC::Arguments::d is private (again, we don't want to patch JSC). Task-number: QTBUG-17788 Reviewed-by: Olivier Goffart
* | Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-air-staging into ↵Qt Continuous Integration System2011-02-251-7/+9
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | master-integration * 'master' of scm.dev.nokia.troll.no:qt/qt-air-staging: Add expected failures for JSC-specific bugs Make autotest insensitive to exact JS error wording Fix typo in autotest Link expected failures to tasks
| * | Add expected failures for JSC-specific bugsKent Hansen2011-02-231-5/+6
| | | | | | | | | | | | | | | | | | | | | We don't want to expect JSC's behavior, since it's not standard. It makes it confusing to run the tests on other (compliant) back-ends. Link to the corresponding upstream WebKit bugs.
| * | Link expected failures to tasksKent Hansen2011-02-231-2/+3
| | | | | | | | | | | | | | | | | | | | | These failures are all due to regressions when switching to the JavaScriptCore-based back-end (Qt 4.6). The failure messages now contain the IDs of the corresponding tasks that have more information.
* | | Merge remote-tracking branch 'origin/4.7' into qt-master-from-4.7Olivier Goffart2011-02-101-0/+16
|\ \ \ | |/ / |/| / | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | QScriptEngine: fix property flags for native functionsCaio Marcelo de Oliveira Filho2011-02-091-7/+6
| | | | | | | | | | | | | | | | Fix the tests and implementation to conform with ECMA-262, property "prototype" of the function and "constructor" of the prototype object associated with the function. Reviewed-by: Kent Hansen
* | Split QScriptEngine test into smaller functionsKent Hansen2011-02-031-327/+529
| | | | | | | | | | | | | | | | | | Also add comments to clarify what we're testing, and remove dependency on precise error messages (we don't care what the precise wording of an error is, only that it is e.g. a TypeError). Task-number: QTBUG-16746 Reviewed-by: Jedrzej Nowacki
* | Refactoring of tst_QScriptEngine::automaticSemicolonInsertion test.Jedrzej Nowacki2011-02-011-4/+4
| | | | | | | | | | | | Test shouldn't relay on error message, but on error type. Reviewed-by: Kent Hansen
* | 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 script translation test data for plural formsKent Hansen2010-11-194-0/+30
| |
* | Refactor script translation testsKent Hansen2010-11-191-66/+139
| | | | | | | | | | | | | | | | | | | | - Add a TranslationScope helper class to reduce the amount of copy&paste for installing translations. - Make translateScript() function data-driven. - Move special cases of script translation into separate test functions. Reviewed-by: Jedrzej Nowacki
* | Make qsTr() work with Unicode (non-Latin-1) stringsKent Hansen2010-11-088-0/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Converting the source string/context/comment to Latin-1 is very broken, since JS strings are UTF-16. The strings should be converted to UTF-8, which should also be the default encoding for qsTranslate(). Effectively, this bug meant that only Latin-1 characters could be used in source strings; the translations themselves could have non-Latin-1 characters. But there was data loss in the case where you passed a source string for which no translation was found (since the Latin-1-ized string would be returned). Task-number: QTBUG-14989 Reviewed-by: Jedrzej Nowacki
* | Split monolithic QScriptEngine autotests into smaller testsKent Hansen2010-11-021-15/+128
| | | | | | | | | | | | | | Each test was testing too much. Split them into more manageable chunks. Reviewed-by: Jedrzej Nowacki
* | Compile with Qt namespaceKent Hansen2010-11-011-0/+2
| |
* | Improve QtScript test coverageKent Hansen2010-10-291-11/+130
| | | | | | | | Based on BullsEye coverage reports.
* | Don't crash when null-pointer is passed to qScriptValueFromValue()Kent Hansen2010-10-291-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | qScriptValueFromValue_helper() (or rather, QScriptEnginePrivate::create()) will fall back to wrapping the value using newVariant(), so there is no reason for the QVariant specialization to check the return value. (In particular, if the return value was invalid, that's _because_ the engine was null, so we should definitely not call a function on the engine.) Task-number: QTBUG-14842 Reviewed-by: Jedrzej Nowacki
* | Align .pro with qmake: s/\.sources/.files/.Miikka Heikkinen2010-10-081-1/+1
| | | | | | | | | | | | | | | | | | | | Complement previous commit by aligning Qt itself to use .files consistently for DEPLOYMENT as well as INSTALLS. This excludes changes to webkit. Task-number: QTBUG-3216 Reviewed-by: axis
* | Merge remote branch 'origin/4.7' into master-from-4.7Rohan McGovern2010-10-041-3/+57
|\ \ | |/ | | | | | | | | | | | | | | | | | | Conflicts: doc/src/snippets/code/doc_src_qmake-manual.qdoc src/corelib/arch/symbian/arch.pri src/declarative/graphicsitems/qdeclarativeflickable.cpp src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h tests/auto/qfontmetrics/tst_qfontmetrics.cpp
| * Fix QScriptEngine::abortEvaluation.Jedrzej Nowacki2010-09-301-3/+57
| | | | | | | | | | | | | | | | This patch reduce time in which QScriptEngine would abort an script executing multiple long-running native functions. Task-number: QTBUG-9433 Reviewed-by: Olivier Goffart
* | Merge remote branch 'origin/4.7' into qt-master-from-4.7Olivier Goffart2010-09-101-0/+66
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: bin/syncqt demos/declarative/snake/content/snake.js demos/declarative/snake/snake.qml doc/src/development/qmake-manual.qdoc src/corelib/plugin/plugin.pri src/gui/kernel/qapplication_win.cpp src/gui/kernel/qdesktopwidget_win.cpp src/gui/painting/qdrawhelper.cpp tests/auto/qdir/tst_qdir.cpp tools/qdoc3/test/assistant.qdocconf tools/qdoc3/test/designer.qdocconf tools/qdoc3/test/linguist.qdocconf
| * Merge remote branch 'origin/4.6' into qt-4.7-from-4.6Thiago Macieira2010-09-071-0/+66
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/Makefile.win32 src/corelib/io/qfsfileengine_win.cpp src/corelib/kernel/qeventdispatcher_win.cpp src/gui/dialogs/qfiledialog_win.cpp src/gui/inputmethod/qcoefepinputcontext_s60.cpp src/gui/text/qfontdatabase_win.cpp src/gui/util/qsystemtrayicon_win.cpp src/script/utils/qscriptdate.cpp tests/auto/qinputcontext/tst_qinputcontext.cpp tests/auto/qscriptengine/tst_qscriptengine.cpp
| | * Fix QtScript Date <--> QDateTime (local time) conversionKent Hansen2010-08-311-0/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This has already been fixed in 4.7 (QTBUG-9770), but the change is too big to backport. The general idea is the same: Only operate on UTC dates internally (since that's how JS dates are stored), and let QDateTime take care of converting from/to local dates as necessary. The fix itself shouldn't be merged to 4.7, but the autotests should. Task-number: QTBUG-9770 Reviewed-by: Jedrzej Nowacki
* | | Merge remote branch 'origin/4.7' into qt-master-from-4.7Olivier Goffart2010-08-305-0/+105
|\ \ \ | |/ / | | | | | | | | | | | | | | | Conflicts: qmake/generators/win32/msbuild_objectmodel.cpp qmake/generators/win32/msvc_vcxproj.cpp tests/auto/qnetworkreply/tst_qnetworkreply.cpp
| * | Make qsTrId() / QT_TRID_NOOP() accessible from QtScriptKent Hansen2010-08-235-0/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | QScriptEngine::installTranslatorFunctions() now installs wrapper functions for qsTrId and QT_TRID_NOOP (similar to the existing ones for tr() and translate()). Task-number: QTBUG-8454 Reviewed-by: Jedrzej Nowacki
* | | It is no longer necessary to check for QT_NO_MEMBER_TEMPLATESminiak2010-08-031-2/+0
| | | | | | | | | | | | | | | Merge-request: 756 Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
* | | Merge remote branch 'origin/4.7' into qt-master-from-4.7Olivier Goffart2010-07-281-0/+29
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qapplication.cpp tests/auto/qfileinfo/tst_qfileinfo.cpp tools/qdoc3/test/assistant.qdocconf tools/qdoc3/test/designer.qdocconf tools/qdoc3/test/linguist.qdocconf tools/qdoc3/test/qmake.qdocconf tools/qdoc3/test/qt-build-docs.qdocconf tools/qdoc3/test/qt.qdocconf
| * | Add missing API shimsKent Hansen2010-07-071-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | There were still a couple of functions that didn't have them. This could cause said functions to crash if multiple script engines were being used. Reviewed-by: Jedrzej Nowacki
* | | Merge remote branch 'origin/4.7' into qt-master-from-4.7Thiago Macieira2010-07-012-1/+243
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | Conflicts: bin/syncqt src/gui/text/qtextlayout.cpp tools/assistant/tools/assistant/helpviewer_qwv.cpp tools/assistant/tools/assistant/helpviewer_qwv.h tools/configure/configureapp.cpp
| * | Merge branch 'buildSystemFixes' into 4.7-s60axis2010-06-291-1/+1
| |\ \ | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/symbian/symbian_building.prf
| | * | Various fixes to autotests when using the symbian/linux-armcc mkspec.axis2010-06-291-1/+1
| | | |
| * | | Use custom static scopes to improve QML/JavaScript performanceKent Hansen2010-06-251-0/+242
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces a new internal JS object type, QScriptStaticScopeObject, that enables the JS compiler to make more aggressive optimizations of scoped property access. QScriptStaticScopeObject registers all its properties in a symbol table that the JS compiler has access to. If the compiler finds the property in the symbol table, it will generate the fast index-based op_{get,put}_scoped_var bytecodes, rather than the dynamic (slow) op_resolve and friends. If the compiler _doesn't_ find the property in the symbol table, it infers that it's safe to skip the scope object when later resolving the property, which will also improve performance (see op_resolve_skip bytecode). QScriptStaticScopeObject is only safe to use when all relevant properties are known at JS compile time; that is, when a function that has the static scope object in its scope chain is compiled. It's up to the user of the class (e.g. QtDeclarative) to ensure that this constraint is not violated. The API for constructing QScriptStaticScopeObject instances is not public; it lives in QScriptDeclarativeClass for now, an internal class exported for the purpose of QML. The instance is returned as a QScriptValue and can be manipulated like any other JS object (e.g. by QScriptValue::setProperty()). The other part of this commit utilizes QScriptStaticScopeObject in QtDeclarative in the two major places where it's currently possible: 1) QML disallows adding properties to the Global Object. Furthermore, it's not possible for QML IDs and properties to "shadow" global variables. Hence, a QScriptStaticScopeObject can be used to hold all the standard ECMA properties, and this scope object can come _before_ the QML component in the scope chain. This enables binding expressions and scripts to have optimized (direct) access to e.g. Math.sin. 2) Imported scripts can have their properties (resulting from variable declarations ("var" statements) and function declarations) added to a static scope object. This enables functions in the script to have optimized (direct) access to the script's own properties, as well as to global properties such as Math. With this change, it's no longer possible to delete properties of the Global Object, nor delete properties of an imported script. It's a compromise we make in order to make the optimization safe. Task-number: QTBUG-8576 Reviewed-by: Aaron Kennedy Reviewed-by: Olivier Goffart Reviewed-by: Jedrzej Nowacki
* | | Merge branch 'qt-master-from-4.7' of ↵Qt Continuous Integration System2010-05-041-0/+106
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | scm.dev.nokia.troll.no:qt/qt-integration into master-integration * 'qt-master-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration: (166 commits) Fix the include header <qstring.h> -> <QtCore/qstring.h> bye bye QMakeProjectEnv short-cut evaluation inside if() tests eliminate special splitting of INCLUDEPATH and DEPENDPATH do not env-expand cache file path s/QMAKE_FRAMEWORKDIR_FLAGS/QMAKE_FRAMEWORKPATH_FLAGS/ s/INCPATH/INCLUDEPATH/ s/QMAKE_RPATH/QMAKE_LFLAGS_RPATH/ teach configure QMAKE_LFLAGS_RPATH (in addition to obsolete QMAKE_RPATH) warn about usage of deprecated variables warn about using non-lowercased replace $$function()s add -Wdeprecated option (on by default) make QMakeProject::isEmpty() consider legacy mappings document some functions' scope fix $$size() not using function-scoped variables doc: Fixed some qdoc errors. qdoc: Added breadcrumbs for namespaces. Autotest: check that we receive key events on toplevel widgets Cocoa: key events stopped working Fix desktopservices demo missing icon in Symbian ...
| * | Merge remote branch 'origin/4.6' into qt-4.7-from-4.6Thiago Macieira2010-04-211-0/+106
| |\ \ | | |/ | | | | | | | | | | | | | | | Conflicts: src/openvg/qpaintengine_vg.cpp src/script/bridge/qscriptqobject_p.h tests/auto/bic/tst_bic.cpp
| | * QtScript: regression with instanceof operator for QMetaObject wrappersKent Hansen2010-04-211-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tell JavaScriptCore that QMetaObject wrappers can be used as the second operand to instanceof; this is done by setting the ImplementsHasInstance flag. We don't actually have to implement hasInstance() because the default implementation does the right thing. Task-number: QTBUG-8366 Reviewed-by: Olivier Goffart
| | * QtScript: Add translation context testKent Hansen2010-04-201-0/+50
| | | | | | | | | | | | | | | | | | | | | The context is determined from the filename passed to evaluate(), and should be equivalent to QFileInfo(fileName).baseName(). Reviewed-by: Olivier Goffart
| | * Improve QScript{Engine,Value}::toObject() test coverageKent Hansen2010-04-191-0/+30
| | | | | | | | | | | | | | | Test that calling toObject() doesn't change the type of the original value.
* | | Fix conversion between QVariant and QScriptValue.Jedrzej Nowacki2010-04-301-0/+32
|/ / | | | | | | | | | | | | | | | | | | Function converting from QVariant to QScriptValue is smart and tries to unwrap a value. So QVariant(1234) after conversion will be equal to QScriptValue(1234). It is ok, but QVariant(QVariant(...)) should be unpacked only once. Reviewed-by: Kent Hansen Task-number: QTBUG-10315
* | Merge remote branch 'origin/4.6' into qt-4.7-from-4.6Olivier Goffart2010-04-165-0/+133
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/3rdparty/webkit/VERSION src/3rdparty/webkit/WebCore/ChangeLog src/3rdparty/webkit/WebCore/page/FrameView.cpp src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def src/s60installs/bwins/QtCoreu.def src/s60installs/bwins/QtGuiu.def src/s60installs/bwins/QtNetworku.def src/s60installs/eabi/QtGuiu.def tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
| * QtScript: Add tests for translation of multiple scriptsKent Hansen2010-04-144-0/+81
| | | | | | | | Suggested by Olivier.
| * QtScript: Add test for translation disambiguationKent Hansen2010-04-144-0/+10
| |
| * Improve test coverage of QtScript translation functionsKent Hansen2010-04-141-0/+42
| | | | | | | | And fix two silly typos in the error messages.
* | Merge remote branch 'origin/4.6' into qt-4.7-from-4.6Thiago Macieira2010-04-146-0/+87
|\ \ | |/ | | | | | | Conflicts: src/script/api/qscriptengine.cpp
| * Make qsTr work in global scopeKent Hansen2010-04-136-0/+87
| | | | | | | | | | | | | | | | | | | | | | Search up the call stack to find the first non-empty source URL. Also and add an autotest for the QtScript translator functions since there was none (their presence was checked, but not their behavior...). Task-number: QTBUG-9775 Reviewed-by: Olivier Goffart
* | Merge remote branch 'origin/4.6' into qt-4.7-from-4.6Thiago Macieira2010-04-091-0/+127
|\ \ | |/