summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptengine
Commit message (Collapse)AuthorAgeFilesLines
* 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
* | 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
* | 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 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 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.
* | 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
|\ \ | |/
| * Regressions in Global Object prototype accessKent Hansen2010-04-091-0/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 4.5, changing the prototype of the (custom) global object used to "Just Work"(tm). In the JSC-based back-end, the built-in global object acts as a proxy if a custom global object is set, because JSC doesn't (yet, anyway) provide a way to replace the global object. To complicate this further, we also have a proxy to the original global object (that bypasses the custom global object proxying (!)). This is so that properties of the original global object can still be accessed with the QtScript C++ API when a custom global object has been set. Unfortunately, JSObject::prototype()/setPrototype() are not virtual, meaning that a change of prototype in the source object is not reflected in the proxy or vice versa. Work around this for now by syncing the prototype at the appropriate places (QScriptEngine::setGlobalObject(), QScriptValue::setPrototype()). This fixes all except the case when a prototype is set from JS, since such a write doesn't go through our public C++ API. But this case can be detected and handled by the global object's JSObject::put() reimplementation. Created a separate report for that issue: QTBUG-9737. Task-number: QTBUG-7066 Reviewed-by: Jedrzej Nowacki
* | QScriptEngine: Fix reentrency involving creation and desctructions of ↵Olivier Goffart2010-03-291-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QScriptEngines the currentIdentifierTable table, which is a static thread local variable, could be corrupted. The main change is to fix the QScriptEngine constructor not to alter the currentIdentifierTable This showed a lot of cases where APIShim guards where missings. The problem was seen with creator, related to QTBUG-9426 Reviewed-by: Jedrzej Nowacki
* | QtScript: Add API for reporting additional memory costsKent Hansen2010-03-251-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QScriptEngine::reportAdditionalMemoryCost(int). This function provides the ability to give a hint to the engine that it should perhaps trigger garbage collection sooner rather than later. For example, if you've implemented a JS ByteArray class that wraps a QByteArray, and a user constructs a few hundred temporary ByteArray objects of large sizes, failure to report the additional memory cost may cause the application's memory consumption to grow and grow (because the script engine thinks they are "cheap" objects, the GC won't kick in). Reporting the correct size can be difficult (or impossible) in some cases. For example, it's difficult to predict the total amount of system memory & resources consumed by a QImage. But even reporting a heuristic / approximate cost can be better than reporting no cost. Task-number: QTBUG-6238 Reviewed-by: Simon Hausmann
* | Merge branch '4.6-s60' into 4.7-s60axis2010-03-221-3/+28
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure.exe mkspecs/common/symbian/symbian.conf src/gui/graphicsview/qgraphicswidget.h src/gui/kernel/qapplication.cpp src/gui/text/qtextlayout.cpp src/openvg/qpixmapdata_vg.cpp src/s60installs/s60installs.pro tools/runonphone/main.cpp tools/runonphone/serenum_unix.cpp qtextlayout.cpp fixed up together with Eskil. Kept the configure.exe from 4.7 without recompile.
| * installTranslatorFunctions doesn't work for custom global objectKent Hansen2010-03-191-3/+28
| | | | | | | | | | | | | | | | | | | | | | Regression against the old back-end. Don't set the translator properties on the original global object but rather on the active one (except for String.prototype.arg, which should always be added to the original String constructor to match 4.5 behavior). Task-number: QTBUG-6437 Reviewed-by: Jedrzej Nowacki
* | QtScript: Fix regression when calling newQObject() from native constructorKent Hansen2010-03-161-0/+20
|/ | | | | | | | The thisObject passed to native constructors did not have all the new structure flags, so if it was promoted to a QObject (using the overload of newQObject() that takes an existing script object as first argument), the resulting script object did not receive dynamic property access callbacks.
* Update copyright year to 2010Jason McDonald2010-01-061-1/+1
| | | | Reviewed-by: Trust Me
* Fix garbage collection issue with script-owned objects with connectionsKent Hansen2009-11-301-0/+18
| | | | | | | | | | This reinstates the pre-4.6 behavior: A script-owned C++ object that's not referenced anymore should be garbage collected, even if it has connections. In order to achieve this, the "weak" reference to the C++ object's wrapper must be invalidated. Task-number: QTBUG-6366 Reviewed-by: Simon Hausmann
* update autotest to match 4.6 behaviorKent Hansen2009-11-231-9/+14
| | | | | In 4.6 the Global Object no longer has an arguments property with undefined value; there should be no such property.
* Add reference to JIRA task for expected test failureKent Hansen2009-11-231-1/+1
|
* Add references to JIRA tasks for expected test failuresKent Hansen2009-11-231-4/+4
| | | | | | 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.
* API review: QRegExp::numCaptures() -> QRegExp::captureCount()Marius Storm-Olsen2009-11-061-1/+1
| | | | | | | QRegExp::numCaptures() is marked as obsolete. Replaced all usage in Qt and test-cases. Reviewed-by: Andreas Aardal Hanssen
* Say hello to QScriptProgram :-)Kent Hansen2009-10-281-0/+149
| | | | | | | | | | | QScriptProgram encapsulates a Qt Script program (AKA a script). It retains the compiled representation of the script, so that repeated evaluation of the same script becomes faster. An overload of QScriptEngine::evaluate() that takes a QScriptProgram has been added. Reviewed-by: Olivier Goffart
* tests/auto/qscriptengine/qscriptengine.pro Windows CE fixJoerg Bornemann2009-10-071-1/+6
| | | | Reviewed-by: TrustMe
* attempt to make QScriptEngine::collectGarbage() autotest more robustKent Hansen2009-10-021-9/+23
| | | | | | | Since the GC looks for pointers in the C stack, try to kill those pointers before calling collectGarbage(). Reviewed-by: Simon Hausmann
* Fix column number provided to QScriptEngineAgentKent Hansen2009-10-011-1/+0
| | | | | | | | Introduced a helper function in our custom source provider, columnNumberFromOffset(), that maps an absolute offset in the source input to a relative column number. Reviewed-by: Jedrzej Nowacki
* add test case for wrong error message in qtscriptKent Hansen2009-09-251-0/+11
|
* Removed explicit TARGET.EPOCHEAPSIZE statements from script testsMiikka Heikkinen2009-09-231-1/+0
| | | | | | | | Large enough max heap for script tests is now defined by default for all tests in qttest_p4.prf, so removed the statements from individual script tests. Reviewed-by: Janne Anttila
* Fix tst_QScriptEngine::throwErrorFromProcessEventsOlivier Goffart2009-09-221-1/+0
| | | | | | | | | | The problem is that the interpreter did not check for exception while running the "while(true){}" loop, as it deduced that none of the generated opcode would possibly generate an exception. The solution is to force a check right after we come from a timeout. Reviewed-by: Kent Hansen
* 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
* | implement proxying of JSObject::putWithAttributes() on Global ObjectKent Hansen2009-08-261-0/+25
| | | | | | | | | | | | Otherwise the property is stored on the wrong object (the proxy). This fix makes the Qt bindings generated by qtscriptgenerator work again.
* | Memory leak in QScriptEngineAgent.Olivier Goffart2009-08-251-0/+1
| | | | | | | | | | | | | | The documentation of the agent constructor specify that the agant is owned by the engine. Even if the agent is not set to the engine Reviewed-by: Kent Hansen
* | QScriptValue: No need to create the activation object for call or constructOlivier Goffart2009-08-241-9/+23
| | | | | | | | It is uneeded and add useless overhead
* | Merge commit 'qt/master'Jason Barron2009-08-211-115/+676
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure.exe examples/examples.pro qmake/Makefile.unix qmake/Makefile.win32 qmake/Makefile.win32-g++ qmake/Makefile.win32-g++-sh qmake/qmake.pro src/script/api/qscriptable.h src/script/api/qscriptclasspropertyiterator.h src/script/api/qscriptcontext.h src/script/api/qscriptengineagent.cpp src/script/api/qscriptstring.cpp src/script/api/qscriptstring.h src/script/api/qscriptvalueiterator.cpp src/script/api/qscriptvalueiterator.h src/script/qscriptclass.cpp src/script/qscriptcontext.cpp src/script/qscriptengine.cpp src/script/qscriptengine_p.cpp src/script/qscriptvalue.cpp src/script/qscriptvalue_p.h src/script/qscriptvalueimplfwd_p.h src/script/script.pro src/src.pro tests/auto/auto.pro tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp tools/configure/configureapp.cpp
| * | add more detailed tests for QRegExp <--> JS RegExp conversionKent Hansen2009-08-191-1/+19
| | |
| * | remove expected failureKent Hansen2009-08-191-1/+0
| | | | | | | | | | | | Works as of commit 5bca43cca3ac90429e3f9263d0d7ea8c9eb164d4.
| * | move the builtinFunctionNames test to qscriptengine autotestsKent Hansen2009-08-191-0/+175
| | | | | | | | | | | | | | | | | | | | | With the JSC-based back-end, stack frames aren't created when calling any of the built-in ECMA functions, so we can't base the test on that. Instead, just look up the "name" property of each function and check that it has the expected value.
| * | implement getter/setter proxying for Global Object and activation objectKent Hansen2009-08-181-0/+25
| | |
| * | adopt same ownership relationship of scriptengine agents as in old back-endKent Hansen2009-08-181-7/+29
| | | | | | | | | | | | The engine owns its agents, and also knows when they are deleted.