aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript
Commit message (Collapse)AuthorAgeFilesLines
* fix whitespaceOswald Buddenhagen2014-01-2244-106/+106
| | | | | | | remove trailing spaces and expand tabs Change-Id: Ieacb9d096b612c45d1a64700044c114d1f7522bc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rework array handling for JS objectsLars Knoll2014-01-091-1/+1
| | | | | | | | | Split up ArrayData into two classes, one for regular arrays, one for sparse arrays and cleanly separate the two cases. Only create array data on demand. Change-Id: I9ca8d0b53592174f213ba0f20caf93e77dba690a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-01-064-0/+39
|\ | | | | | | Change-Id: If9a205bea219b9aca95d78b1e556ca9bbff58dd0
| * Fix lookups of enums in singletonsSimon Hausmann2014-01-024-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-242-0/+14
|/ | | | | | | | | | | | | | "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-052-0/+23
| | | | | | | | | | | | | | | 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>
* Encapsulate the current context and fix it's usageLars Knoll2013-12-042-4/+4
| | | | | | | | | | | Encapsulate accesses to the current context, and rework the way we push and pop this context from the context stack. Largely a cleanup, but simplifies the code in the long term Change-Id: I409e378490d0ab027be6a4c01a4031b2ea35c51d Reviewed-by: Simon Hausmann <simon.hausmann@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-292-0/+41
| | | | | | | | | | | | | 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-202-0/+15
| | | | | | | | | 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-192-0/+26
| | | | | | | | | | 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-192-0/+18
| | | | | | | | | | 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-183-0/+120
| | | | | | | | | | | 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>
* Fix interaction between head room and appending in arraysLars Knoll2013-11-181-0/+13
| | | | | | | | | | We reserve space on both ends of the JS array for appending and prepending. Make sure they interact well with each other and don't cause any memory corruption. Task-number: QTBUG-34853 Change-Id: I184280178690e3cb12ab9b199a8436b32383af38 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Don't assert in QQuickItem::updateLars Knoll2013-11-182-0/+22
| | | | | | | | | | | 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>
* Limit the amount of memory we allocate on the stackLars Knoll2013-11-181-0/+6
| | | | | | | | | | | | | | | | | | | Setup limits for both the C and the JS stack, and check them before entering functions. If we run out of space, throw a RangeError exception. Be careful and recheck the stack bounds when things go outside. This catches the case where the engine got moved to another thread changing the stack boundaries. Windows currently uses an unsafe fallback implementation, this needs to be fixed later on. Task-number: QTBUG-34568 Change-Id: I22fbcbec57b28f9cc8a49e12f1cc6e53e4f07888 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Fix === operator for value typesLars Knoll2013-11-153-0/+68
| | | | | | | | | 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-153-0/+32
| | | | | | | | | | 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-144-0/+99
| | | | | | | | | | | | | 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-122-0/+33
| | | | | | | | | | | | | 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-122-0/+21
| | | | | | | | | | | | | | 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-052-0/+20
| | | | | | | | | expressions This is a regression from 5.1 Change-Id: I61ad372a02d937c195dad74bd9fcb8fd4410d97a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix rounding behavior of Qml when assigning doubles to integer propertiesSimon Hausmann2013-11-051-4/+4
| | | | | | | | | | | | The engine used to round, but that is inconsistent with ECMAScript's way of converting doubles to integers by truncation. With this patch we can also enable the propagation of integer type information into the IR, but we have to be careful not to utilize it when writing properties. Change-Id: I04af4879ba5131349eca2eeff2b27f4598f5267b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix valgrind errors in tst_qqmlecmascript::revisionSimon Hausmann2013-11-011-1/+1
| | | | | | | | | | | | | | The QML code looks like this: MyRevisionedClass { prop1: prop2 } and MyRevisionedClass is C++ based. We need to return an initialized value when reading prop2. Change-Id: I33792c04aa1ba0d8e38c1351b8fb4de7abbe4891 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Speed up lookups of imported scriptsSimon Hausmann2013-10-311-8/+8
| | | | | | | | | | The QQmlContextData stores the JS objects of imported scripts in a QList<PersistentValue>. Instead of indexing into that list, this patch changes ctxt->importedScripts to be a JavaScript array, that in the IR we can index via subscript. Change-Id: Ie2c35fb5294a20a0b7084bb51d19671a27195fec Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Initial support for resolving meta-property access for the scope and context ↵Simon Hausmann2013-10-311-0/+1
| | | | | | | | | | | | | | | | | objects at QML compile time This avoids having to do a string lookup for ids and in the import cache at run-time, before we can do a string hash lookup in the property cache. Instead we resolve final properties in the context and scope object at compile time and look them up at run-time using their index instead. The dependencies to these properties are also tracked separately and recorded in the compiled data. This is merely the initial patch. There's a lot left to do, such as having specialized getter and setters for specific property types. Setters are missing altogether right now and will fall back to name lookup. Change-Id: If3cb4e7c9454ef4850a615f0935b311c9395b165 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Properly propagate parse errorsLars Knoll2013-10-291-32/+41
| | | | | | | | Replace all try/catch statements used when parsing with checks for engine->hasException. Change-Id: I4493cb600d5a3eb095c2003bb88bd031403e47c9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Avoid crash when a QML signal is connected to a non-void slotJ-P Nurmi2013-10-223-0/+24
| | | | | | | | | | 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>
* Turn on exact garbage collection by defaultLars Knoll2013-10-161-40/+2
| | | | | | | | | Keep conservative GC as a fallback for testing Enable all tests again that were skipped due to GC issues. Change-Id: I8e0fa728207bdd39a96d0acf95e27841157d8402 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup exception handlingSimon Hausmann2013-10-031-1/+0
| | | | | | | | | | The code in the Exception class operates entirely on the engine's data, so move it into ExecutionEngine instead. This eliminates the need for a QV4::Exception class and catches and old code that tries to still do catch (Exception &) instead of catch (...) Change-Id: Ie608bec6af652038aca6c9423c225a4d7eb13b39 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change exception handling APISimon Hausmann2013-10-021-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the exception handling API in the engine slightly, encapsulating any use of direct throw statements and catch blocks with concrete types. In the future we need to be able to change the way these are implemented, in order to ensure that the correct stack unwinding code is triggered for throw and re-throw. This patch separates the C++ exception object thrown from the V4 exception (that includes value, throwing context pointer) and stores the latter inside the engine. In order for that to compile, ExecutionEngine::StackTrace and StackFrame had to move into the QV4 namespace directly. In addition the syntax for catching exceptions changes from try { ... } catch (QV4::Exception &ex) { ex.accept(context); QV4::ScopedValue exceptionValue(scope, ex.value()); } to try { ... } catch (...) { QV4::ScopedValue exception(scope, context->catchException()); } Context::catchException() checks if there's a "current" exception in the engine, and if not assumes that we caught an unrelated exception and consequently re-throws. partiallyUnwind() is also gone and replaced with rethrowException(), in order to encapsulate the re-throw. Lastly, in the future nesting try/catch blocks isn't going to be possible due to limitations in the common C++ ABI with regards to foreign exceptions. Change-Id: Ic81c75b057a2147e3176d8e0b4d326c14278b47d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cleanup API of Safe<T>Lars Knoll2013-10-021-2/+1
| | | | | | | | Don't have an implicit cast operator to Returned<T> anymore, and return a T* from the operator->() Change-Id: If4165071b986bfc84a157560d94d39c2dcfbc9e1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Compile imported scripts in the loader threadSimon Hausmann2013-09-301-21/+42
| | | | | | | | | | | | | | | | | This has the benefit of blocking the GUI thread less and speeding up type creation in the GUI thread (for types that import js libraries). This patch also brings one behavioral change: Due to the parsing at type instantiation type, things like syntax errors for script imports would only generate a run-time warning and the code in the QML file would just see "undefined". Errors in the script now generate real errors at component compilation time, meaning the errors come out earlier and as real errors. This patch implements the separation for the VME only (to keep the size of this patch small). Change-Id: I82f7f3a2d3d4524ea12a7ab62abd8640aba6a47f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* remove more uses of QV4::ValueLars Knoll2013-09-302-17/+15
| | | | | Change-Id: I11b0b2b7626297e2c98dc77784574da4b59ba8cf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix compilation of the auto testLars Knoll2013-09-281-3/+7
| | | | | Change-Id: I8c10463aa064a25c0170e6b7f294f48501b42319 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move Value::fromBool, ... to a new Primitive classLars Knoll2013-09-281-66/+66
| | | | | | | | This will simplify finding the remaining direct usages of QV4::Value that need fixing. Change-Id: I223099727436d5748027c84c53d9dfc4028e38ed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Skip two tests that don't work reliably with a conservative GCLars Knoll2013-09-261-0/+4
| | | | | Change-Id: I5619d533b6e48c88fda063bc7cdcc62d6838bcdf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move more API over to use ValueRefLars Knoll2013-09-261-6/+6
| | | | | Change-Id: I372f1f3e3e78d45912a913f437e622e0acfc9646 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix Persistent/WeakValue APILars Knoll2013-09-262-10/+12
| | | | | | | Don't use unprotected Values in the API anymore. Change-Id: I8851628227fca374de24701bc8ee0908b5ae3923 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Split off crashing test from qqmlecmascript.Erik Verbruggen2013-09-251-15/+21
| | | | | | | Task-number: QTBUG-33658 Change-Id: I5a9f24d49ab894e3cde745cc0c1d44ef0880510f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cleanup Object::define*Property APILars Knoll2013-09-221-1/+1
| | | | | Change-Id: I99125908a9bc1d41a2642c409af9704def7a0832 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Don't use Value::emptyValue() anymore.Lars Knoll2013-09-221-13/+17
| | | | | | | | | | emptyValue is special and reserved for usage inside the engine to mark missing values. The main to use cases are when converting property descriptors, and to mark holes in array data. Change-Id: I0ed357e65102b1041bf9a878e6e9a4ae0657523b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Correctly convert an invalid QDateTime to JSLars Knoll2013-09-183-0/+51
| | | | | | | Task-number: QTBUG-33539 Change-Id: I645db2e12e3b46731c0bef04e2d48abb71650974 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix handling of empty ValuesLars Knoll2013-09-181-1/+1
| | | | | | | | | | | | Make things consistent between 32 and 64 bit again Adjust test results after the changes Almost all uses of Value::empty() will get removed in the future, but for now this gets all our tests to pass again. Change-Id: I44784a43432e78febbdfe78115c9be2a3e3ece76 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert most remaining return values from Value to ReturnedValueLars Knoll2013-09-181-11/+16
| | | | | Change-Id: If8b0c3b91be50678693868c10fefc3678008834d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename QV4::ValueScope to QV4::ScopeLars Knoll2013-09-181-3/+3
| | | | | | | | The class is going to be used all over the place, so let's give it a short name :) Change-Id: If61543cb2c885e7fbb95c8fc4d0e870097c352ed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Require a ValueScope for ScopedCallData as wellLars Knoll2013-09-181-3/+4
| | | | | | | | This brings things more in line with ScopedValue, and also simplifies cleanup of Scoped values. Change-Id: If5f1466b4e13c629d56c1e7c638937f61ba48f77 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use a ReturnedValue for Managed::call()Lars Knoll2013-09-181-1/+2
| | | | | Change-Id: Ief2d75e9789dd367c603d90dc0fe5316a0d055e3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use a ReturnedValue when converting to String or ObjectLars Knoll2013-09-121-1/+1
| | | | | | | | Also rename Value::toQString() to Value::toQStringNoThrow(), and add a throwing toQString() method for JS use. Change-Id: I821b33fc61abb7d08839df965fd337685f61a545 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>