aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/data
Commit message (Collapse)AuthorAgeFilesLines
* fix whitespaceOswald Buddenhagen2014-01-2242-79/+79
| | | | | | | remove trailing spaces and expand tabs Change-Id: Ieacb9d096b612c45d1a64700044c114d1f7522bc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-01-061-0/+9
|\ | | | | | | Change-Id: If9a205bea219b9aca95d78b1e556ca9bbff58dd0
| * Fix lookups of enums in singletonsSimon Hausmann2014-01-021-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a regression against 5.2.0 (which didn't have this bug), due to optimizations introduced in the stable branch after the release. The code path for optimizing access to the members of C++ based singletons through the regular meta-object properties would end up excluding access to enums when the lookup happens at run-time. The run-time getter for the singleton itself would return a wrapped QObject instead of a QQmlTypeWrapper, and only the latter includes enums. As QML based singletons (composite singletons) cannot declare enums, we can continue to do fast lookups on these, but otherwise have to fall back to the slower code path. Task-number: QTBUG-35721 Change-Id: Icc66bdaf3572622cdb718f82b706e3204afa0167 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Change C++ parameter type used for var parameters in QML declared signalsSimon Hausmann2013-12-241-0/+11
|/ | | | | | | | | | | | | | "signal someSignal(var foo)" mapped to foo being of type QVariant. Unfortunately that is a "lossy" type and it cannot represent all JavaScript values, including for example function closures (as reported in the JIRA bug). Instead we should use QJSValue. It is an important behavioural change because it affects the presumably rare case of somebody declaring a signal in QML with such a parameter and connect to it from C++ (or trying to emit it) - in that situation the code needs to be changed. Task-number: QTBUG-35171 Change-Id: I4fb4a18b407e4ea6c28a3a297fc6f76edb76d734 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix regression in QML string list concatenationsSimon Hausmann2013-12-111-0/+16
| | | | | | | | | | | | | | | | | | | | String lists and other QList property types (wrapped as QQmlSequence) should behave like arrays and have the Array prototype. Therefore it should be possible to pass them also as parameter to concat and they get composed correctly, i.e. the individual items get appended instead of the list being appened as one item. In the spec for concat this "special" casing should be applied if the "class internal property" is "Array", and concat appears to be the only place where this check is done. Therefore this patch adds another exception to match the expected behavior in QML and extends the "internal class is Array" meaning to QML list types. This is a regression from Qt <= 5.1.x Task-number: QTBUG-33149 Change-Id: Iab9522ac3c4ae6b746e790a99d87501b1cc1b655 Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix dependency calculation for context and scope propertiesSimon Hausmann2013-12-051-0/+14
| | | | | | | | | | | | | | | We were incorrectly calculating writing to a context or scope property as a dependency for an expression. We don't know whether a property is being written only or also being read from at lookup time, but we can make that decision in the isel then when generating the move instructions. So initially context and scope properties end up in a candidate set first and get promoted to real dependencies when they're being used in reading moves. Task-number: QTBUG-35210 Change-Id: Ia67057abafc2d611e1e6605327b4965ebe91cbed Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix url type testLars Knoll2013-12-041-2/+2
| | | | | | | | it passed before, but wasn't testing two methods it should be testing. Change-Id: I5784ecfe1b5a00620832c7b995ed3cf5ed7e27dd Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix JavaScript signal connect on alias without other handlersSimon Hausmann2013-11-291-0/+34
| | | | | | | | | | | | | The changed handlers for aliases are connected lazily in the engine. QQmlPropertyPrivate::flushSignal is responsible for that and called in other places, for example when installing a onSomeAliasPropertyChanged handler. However we were missing a call to flushSignal when doing onSomeAliasPropertyChanged.connect(...), i.e. using the JavaScript connect API. Task-number: QTBUG-30493 Change-Id: Ia3f008626fd7af3f2cfbdd30d13fb83158bed4d5 Reviewed-by: Albert Astals Cid <albert.astals@canonical.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4: fix Array.indexOf() for QStringListLiang Qi2013-11-201-0/+13
| | | | | | | | | Autotest is included. Task-number: QTBUG-33542 Change-Id: I46c3a81006019c6613a3d35aa018217f85a15d0b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Liang Qi <liang.qi@digia.com>
* V4: remove failing assert and fix code.Erik Verbruggen2013-11-191-0/+14
| | | | | | | | | | Assert failed for cases where the node’s ancestor with lowest semi-dominator number was not the same as the parent. The test case exemplifies this. Task-number: QTBUG-34792 Change-Id: Ie6847b22a27211801bff7479bfcbfaf329c6005a Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
* Fix failing assertion when trying to assign to an id referenced QML objectSimon Hausmann2013-11-191-0/+7
| | | | | | | | | | References to id addressed QML objects are member expressions, which are unlike other member expressions by not being lvalues. Handle this correctly. Task-Number: QTBUG-34890 Change-Id: Ied6230edbc561128ad36bf0d1a1918185204deec Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make comparison of singletons and qobjects workAlbert Astals Cid2013-11-181-0/+74
| | | | | | | | | | | Otherwise you can end up with some weird situation in which you have two objects, you print them and then you print the comparison and get a Foo(0x858480) b Foo(0x858480) a == b false Task-number: QTBUG-34651 Change-Id: Id2444d919f039be085eb5ed9112345db691540a5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Don't assert in QQuickItem::updateLars Knoll2013-11-181-0/+10
| | | | | | | | | | | The method can actually be called from QML, so we can not have an assert in that method. Instead simply return if the item has no contents Task-number: QTBUG-34060 Change-Id: Ib28ffa5c6c63fbec956abe25020010ed73a9cfa9 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Fix === operator for value typesLars Knoll2013-11-151-0/+28
| | | | | | | | | Fix === comparison for urls and other QML value types. Task-number: QTBUG-33546 Change-Id: I4a7066e6bbc7de7c599fe2c7b2fdfb75e0ff5196 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Don't crash when trying to assign to null.propLars Knoll2013-11-152-0/+10
| | | | | | | | | | Fixes a regression introduced during the exception handling refactoring. Task-number: QTBUG-34544 Change-Id: Ib751274d759030db3e5d3b1380b30dc07ec85f83 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Allow passing qmlRegisterSingletonType QObjects to C++ as QObject*Albert Astals Cid2013-11-141-0/+48
| | | | | | | | | | | | | At the moment you can pass them as their FinalType* or as one of their ParentType* but not as QObject* which does not make much sense to me Task-number: QTBUG-34617 Task-number: QTBUG-30730 Change-Id: Id5cfb7bbb123456ef43f44f33b450f8966a7641a Reviewed-by: Alan Alpert <aalpert@blackberry.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4 IR: scan arguments when entering function scope in QML.Erik Verbruggen2013-11-121-0/+19
| | | | | | | | | | | | | When doing IR generation for a function declaration in a QML object, call through the helper methods to check for forbidden names, and most importantly, also checks if the function has parameters. If the latter is the case, they need to be added as a member for the current scope in order to get IR generation correct. Task-number: QTBUG-34493 Change-Id: I0ade15ee19e1b1ac8ee2f2d3fa186d1551800199 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4: fix loop block marking for initializer blocks.Erik Verbruggen2013-11-121-0/+12
| | | | | | | | | | | | | | Any new blocks generated as part of the initializer were incorrectly marked as belonging to a loop. For example, if a LocalForStatement would contain a ternary expression, the generated then and else blocks would be marked. This would confuse the block scheduling, because all blocks are postponed unil the condition block (“group start”) is scheduled. Task-number: QTBUG-33754 Change-Id: I45919ebeac356f015bb91fe0210472b3df0b56d8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Ensure the this object is set correctly to the scope object in binding ↵Simon Hausmann2013-11-051-0/+10
| | | | | | | | | expressions This is a regression from 5.1 Change-Id: I61ad372a02d937c195dad74bd9fcb8fd4410d97a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Avoid crash when a QML signal is connected to a non-void slotJ-P Nurmi2013-10-221-0/+10
| | | | | | | | | | Don't pass a QVariant pointer for the return value when we're not interested in it and the return type might not even be a QVariant (that would be only true for QML methods). Task-number: QTBUG-32801 Change-Id: I8f14e40d8f94caef7e3d086b776735f0484dbf0e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Correctly convert an invalid QDateTime to JSLars Knoll2013-09-181-0/+20
| | | | | | | Task-number: QTBUG-33539 Change-Id: I645db2e12e3b46731c0bef04e2d48abb71650974 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Improve reliability of propertyVarOwnership testSimon Hausmann2013-08-271-2/+0
| | | | | | | | | | In the last expect-to-collect-a-QObject test, avoid calling gc() from within JavaScript and call it from C++ instead with zap stacking. That reduces the probability of finding an old reference on the stack that would keep the object alive. Change-Id: Ia9c66dd188f31264a70ad4dbd20356d16aa7a057 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Don't crash with deferred propertiesAlan Alpert2013-08-221-0/+6
| | | | | | | | | | | There are cases where a qmlExecuteDeferred(o) can be postponed until the context of o is being destroyed, at which point it's too late to create an object in that context. Task-number: QTBUG-33112 Change-Id: I7f981b5e34e3cb8a52c00de4742a7242d7e4df54 Reviewed-by: Christopher Adams <chris.adams@jollamobile.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Improve reliability of GC related testsSimon Hausmann2013-07-296-7/+0
| | | | | | | | | | | | | | | | | | | | | | | Fixes propertyVarCircular2 in clang release builds for example. Some of the QML/GC related tests had functions like function deassign() { someVariableThatWasholdingSomethingThatShouldBeCollectedNow = null; gc(); } which work fine with an exact GC like in v8, but with our conservative collector they are not that reliable and much more vulnerable to a reference to the object still being around somewhere. So to improve the reliability of the test, this patch moves the gc() calls out of the JavaScript function and back to the C++ caller side (these functions are invoked via QMetaObject::invokeMethod), where the existing gc() helper function will call the collector and also process posted deferred deletion events for QObjects. Change-Id: I8c1f715d56d66bc567ea8bd1575f171460b15ac8 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into ↵Simon Hausmann2013-06-243-0/+28
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | wip/v4 Conflicts: src/imports/qtquick2/plugins.qmltypes src/qml/debugger/qv8debugservice.cpp src/qml/qml/qml.pri src/qml/qml/qqmlcompiler.cpp src/qml/qml/qqmlcomponent.cpp src/qml/qml/qqmlcontext.cpp src/qml/qml/qqmldata_p.h src/qml/qml/qqmlengine_p.h src/qml/qml/qqmljavascriptexpression.cpp src/qml/qml/qqmlxmlhttprequest.cpp src/qml/qml/v4/qv4bindings.cpp src/qml/qml/v4/qv4irbuilder.cpp src/qml/qml/v4/qv4jsonobject_p.h src/qml/qml/v8/qqmlbuiltinfunctions.cpp src/qml/qml/v8/qv8bindings.cpp src/qml/qml/v8/qv8contextwrapper.cpp src/qml/qml/v8/qv8listwrapper.cpp src/qml/qml/v8/qv8qobjectwrapper.cpp src/qml/qml/v8/qv8qobjectwrapper_p.h src/qml/qml/v8/qv8sequencewrapper_p_p.h src/qml/qml/v8/qv8typewrapper.cpp src/qml/qml/v8/qv8valuetypewrapper.cpp src/qml/types/qqmldelegatemodel.cpp src/quick/items/context2d/qquickcanvasitem.cpp src/quick/items/context2d/qquickcontext2d.cpp sync.profile tests/auto/qml/qjsengine/tst_qjsengine.cpp tests/benchmarks/qml/animation/animation.pro tools/qmlprofiler/qmlprofiler.pro Change-Id: I18a76b8a81d87523247fa03a44ca334b1a2360c9
| * Partial fix for deferred properties when combined with componentsAlan Alpert2013-05-223-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current deferred properties implementation did not store context or compiled data pointers correctly. Those pointers are now stored when the defer is reached, so as to avoid confusion (confusion leads to asserts or crashes). Does not extend the deferred property support to allow multiple deferred blocks per item. This now prints and error and the side effect is only that one of the deferred blocks is lost. This use case is sufficiently rare that it may not be worth the cost. Task-number: QTBUG-30325 Change-Id: I80cb074ed4452e95020208a0142a91e721bced7d Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix tst_qqmlecmascript::functionAssignment_fromJSSimon Hausmann2013-06-181-10/+10
| | | | | | | | | | | | | | | | | | Make the test-case compile with strict mode, where function declarations are not allowed within blocks. An alternative would be to use function expressions here. Change-Id: If7e1cc23ef4a0c6a83e4ba8ae03dc9c6b678730d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix qqmlecmascript::propertyVarOwnershipSimon Hausmann2013-06-131-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | Don't rely on o = new Date in the test-case to really clear the last "reference" on the stack. As it turns out, in v4, we sometimes allocate the result of "new Date" in a different slot and the old slot is still around (and thus the object is visible and marked). Instead work with separate scopes, which requires a little helper function in JS. Change-Id: I5f318feaccfc7d83dbe28be043a0ee83e0c16355 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Remove failing testSimon Hausmann2013-06-081-15/+0
| | | | | | | | | | | | | | | | This test doesn't seem to make sense anymore, as it tested an implementation aspect of the previous engine with the expression rewriter and v8 compilation. Change-Id: I17a83b82080ab567431d8dc403f14f5266a81ba4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix tst_qqmlecmascript::signalArgumentsSimon Hausmann2013-06-072-4/+0
| | | | | | | | | | | | | | | | Don't check for arguments.callee, which is only available in non-strict mode Change-Id: I90851862e36e5bc7c518198f9fe5672178a3ec58 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Port Qt.include() over to v4Lars Knoll2013-05-241-1/+1
|/ | | | | | | | | Still doesn't quite work as it should, but that's no regression to before neither. The reason is that the context handling is still v8 based and needs to be rewritten. Change-Id: I51216f93d6db4ba26f8adddaeb39d8a8c62df7ee Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix hexadecimal escape sequence validation in strings.Erik Verbruggen2013-03-191-0/+9
| | | | | | | | | Give an error message when the sequence does not conform to the grammar. Although the specification does not explicitly state that this is an error, this is the behaviour of both JSC and V8. Change-Id: I34d189f07628bc6cc40b13bfbb8d09bee7810ced Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix automatic semicolon insertion before ++/-- operators.Erik Verbruggen2013-01-111-0/+19
| | | | | | | | Also move the tilde token from isBinop to the lex method, because it is not a binop, but should still be delimited. Change-Id: I532260f4f3ebdde2d38128b41d11bce5a113d1f1 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix semicolon insertion before pre-incr/decr operators.Erik Verbruggen2013-01-082-0/+66
| | | | | | | | Do not insert a semicolon if the previous token was a binop or a question mark. Change-Id: Id2ee1d3cb57fa3fe20bfc0078d06f9e2619d88f1 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix unicode escape sequence validation in strings.Erik Verbruggen2013-01-081-0/+9
| | | | | | | | | Give an error message when the sequence does not conform to the grammar. Note that both \u and \x (without any numbers following it) are not valid escape sequences in ECMA5.1. Change-Id: I14348984c680b0ce86e05faad5630afc1e98cd02 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix: disallow incomplete hex numbers "0x" and "0X".Erik Verbruggen2013-01-072-0/+18
| | | | | | | See also ECMA 5.1, 7.8.3, rule HexIntegerLiteral. Change-Id: I356dc7cfbc88890bb7f35c8bc4219a37633177f8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Added parsing for getter/setter definitions in property assignments.Erik Verbruggen2012-12-171-0/+14
| | | | | | | Specified in ecma 5.1, 11.1.5. Change-Id: I93d12593534ed8a987922c8aa329124940e77c6f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Throw a parse error on octal numbers and escape sequencesLars Knoll2012-12-1111-0/+99
| | | | | | | | | | | | | This is compliant with EcmaScript 5.1, where octal numbers and escape sequences are an optional and deprecated part of the syntax. Allow leading 0's in qml mode, but interpret the result as decimal. This is also to keep compatibility with existing code. Change-Id: Ic3450ec3dd17966846751ee688a90c65939ba78f Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Accept missing semicolon after do-while statement.Erik Verbruggen2012-11-261-0/+13
| | | | | | | | | Although not valid according to ECMA 5.1, both JSC and V8 accept a missing semicolon after a do-while loop. (Both JSC and V8 do not do this through automatic semicolon insertion, but handle it as a special case.) Change-Id: Iff2b07b894564740d2dcbf9b1d46bc279d30b9e3 Reviewed-by: Alan Alpert <aalpert@rim.com>
* Test: Fix tst_qqmlecmascript::exportDateCaroline Chao2012-10-292-2/+2
| | | | | | | Get timezone offset of the date specified and not the default value. Change-Id: I58dba896098cbee72a2e4ec15ba2c928121e6cff Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* doc: fix some typos in .qml filesSergio Ahumada2012-09-074-4/+4
| | | | | Change-Id: Ice5d60b06ec9ab81fbd98fd1679c8834f3018938 Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Delete weak JS objects on exit right awayThomas McGuire2012-08-311-0/+6
| | | | | | | | | This reduces memory leaks on exit when the engine is destroyed after exec() has finished. Change-Id: I917d103966d55b4dd3ba4e986ff902e29d8fb0ac Reviewed-by: Chris Adams <christopher.adams@nokia.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Test metatype registration errors with non-metatypes.Stephen Kelly2012-08-281-5/+5
| | | | | | | | | QList<QPoint> is to become automatically registered with https://codereview.qt-project.org/#change,32897 and https://codereview.qt-project.org/#change,33031 Change-Id: I455028e226c15e922162bae21db7e5e9de07063b Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Refactor singleton type registration codeChris Adams2012-08-287-9/+33
| | | | | | | | | | | Previously each singleton type was registered as an implicit separate import. This commit changes the code so that these types are treated just like any other type in the registration sense. It also ensures that singleton types are instantiated per-engine. Change-Id: I5c81c4ca5bf65210f7125d74a62a282a21838068 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
* Restrict v8 property lookup to the execution contextMatthew Vogt2012-08-275-1/+164
| | | | | | | | | | | | | When resolving property names, only properties known to the current context of execution should be available. If a property name has been overriden by a component extension, code executing in the context of the base component should resolve the property name to the property available inside the base component or its bases. Task-number: QTBUG-24891 Change-Id: I9687cc28e108226d5a939627a901c8254344b598 Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Avoid dynamic lookup of signal handler argumentsMichael Brasser2012-08-243-0/+26
| | | | | | | | | | | Rewrite signal handlers to include the parameters in the rewrite. Also check whether parameters are actually used when possible, and if not don't provide them to the expression. Change-Id: I7d65c05f4639979dd61035cf7478119ef7647c25 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Add unit test for concatenated property name accessChris Adams2012-08-091-0/+127
| | | | | | Task-number: QTBUG-23126 Change-Id: I706d5f4ba49a554c3816146f15a87e001cde9a3f Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Ensure that copy sequences can be passed as argumentsChris Adams2012-08-091-0/+23
| | | | | | | | | | | | Previously, automatic conversion from JS array to sequence copy resource was not performed in the case where the array was passed as a parameter to a QObject function invocation. This commit adds code to check if the parameter type is a sequence type - and if so, and if the value is a variantlist, we convert it to a sequence of the appropriate type. Change-Id: I3cc3e2f95604bc71d1d8d237e1acffa1e03b78ba Reviewed-by: Glenn Watson <glenn.watson@nokia.com>
* Add type name to singleton (module api) implementations.Glenn Watson2012-08-0835-156/+197
| | | | | | | | | | | | | This change renames the previous module api implementation to singleton types. When a singleton type is registered, a type name must be provided that is used when accessing the API from QML. This makes the implementation more consistent with the rest of QML. Task-number: QTBUG-26549 Change-Id: Iab0bb1ccf516bd3ae20aee562a64d22976e0aecd Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Support JS Array.sort() function for sequence wrappers.Glenn Watson2012-08-081-0/+95
| | | | | | | | | | | | | | The V8 natve sort implementation calls some functions that are incompatible with the way sequence wrappers work. In particular, it calls an internal length() function which does not pass through the length accessor provided by sequence wrappers, so the sort function always thinks the array is zero length. Instead, clone the array prototype and override the sort function with one that is specific to sequence wrappers. Task-number: QTBUG-25269 Change-Id: Ic83b9ee0bd3a0707e512f28057f0f99b432fded4 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>