aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qjsengine
Commit message (Collapse)AuthorAgeFilesLines
* Fix QJSEngine::evaluate using the wrong execution contextv5.3.0Simon Hausmann2014-05-091-0/+39
| | | | | | | | | | | | | | | | | | In contrary to what the documentation says, QJSEngine in Qt 5.x executes in the context of the global object (QScriptIsolate always called enter on the QV8Engine's "root" context, thus making it current). The v4 implementation unfortunately did what the documentation said and used the current context, which is wrong in many ways. For example it completely breaks the optimization of stack allocated contexts, because when a C++ callback is called from within a JS function with a stack allocated context and that C++ code calls QJSEngine::evaluate and creates new closures, the stack context would become an outter context and cause crashes during GC. This patch restores the behavior of Qt 5.0/5.1 and fixes the documentation. Task-number: QTBUG-38530 Change-Id: Ie6481f02e676954cc94b188a1c87c88e7c56dafa Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix marking of prototype objects in internal class poolSimon Hausmann2014-04-281-0/+16
| | | | | | | | | | As per reported bug, we have to protect ourselves against potential loops and can mark the internal classes much simpler by just walking through the memory pool they were allocated in. Task-number: QTBUG-38299 Change-Id: I3ae96e8082e76d06f4321c5aa6d2e9645d2830a0 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Refine fix for dynamic properties on QObjects wrapped in JavaScriptSimon Hausmann2014-04-171-5/+29
| | | | | | | | | | | | | | This is an ammendment to commit 60730cbb5e5475b5db6a15641211aa6958a93197 to further restrict the ability to set dynamic properties on JS wrapped QObjects only on those that are associated with a qml context. Only one such association comes with the static property lookup rules of QML and therefore only those should be prohibited from dynamic properties. The previous implementation on using the "compiledData" field to detect QML association or not is not strong and reliable enough. Change-Id: I10c0e6e58a2727c01a6cb56fdf912bf250333e1f Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Add support for dynamic properties for QObjects in JavaScriptSimon Hausmann2014-04-091-0/+11
| | | | | | | | | | | | | | | | | In QtScript you could add properties to a JS object that wraps a QObject. Depending on the wrap option the property was either stored on the JavaScript side or as dynamic QObject property. In QJSEngine/QJSValue, neither was supported - properties could not be added. For QObjects wrapped in JavaScript that weren't created by QML, we can restore the behavior of storing dynamically added properties as JavaScript properties. This makes porting from QtScript to QJS* much easier. Task-number: QTBUG-37408 Change-Id: I5ef1f379c08c3d84de9bdcac9b6a9397238064de Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix marking of prototype objects in chainSimon Hausmann2014-04-071-0/+18
| | | | | | | | | | | | | | | | With a real prototype chain it can happen that an internal class' prototype's class itself has a prototype. Therefore the first transition on the empty class is a PrototypeChange one, but the class the transition leads to may have PrototypeChange transitions itself, which weren't marked. There are multiple solutions to this, but this patch is the minimal fix by recursing fully through the internal class tree. That way it's easier to back-port the fix also into 5.2.x based branches. Task-number: QTBUG-37834 Change-Id: I901b13a2663fbad5844003ca5752f2f304de320c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix crash in conversion from QVariantMap to QJSValueSimon Hausmann2014-03-281-0/+8
| | | | | | | | | | When the key is an array index, use arraySet instead of trying to insert an array index as internal class member. Task-number: QTBUG-37854 Change-Id: I23f01cc9d6be98b57d3f13ac7ee847298e9632a3 Reviewed-by: Matt Broadstone <mbroadst@gmail.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Fix crash in sparse array handlingSimon Hausmann2014-03-281-0/+1
| | | | | | | | | | | | When re-allocating the sparse array data, make sure to initialize the free list correctly. Previously this was only done for the first allocation. Test cases uses an object literal, as that's a reliable way to ensure a sparse array is created. Task-number: QTBUG-37892 Change-Id: Ib38cfce50104904af0c980f022c9dbb7461ae5f8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix infinite loop in method overload resolutionSimon Hausmann2014-03-241-0/+20
| | | | | | | | | | When resolving overloaded slots in a situation without property cache, then we need to detect that we've reached the end of the overload lists and exit from RelatedMethod with zero. Task-number: QTBUG-37157 Change-Id: Ifaab8cc1b377725c99c1bb89bb9bb74d5a0af1b8 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Fixes to for...in statementLars Knoll2014-03-191-2/+31
| | | | | | | | | | | Properly convert the argument to an object if it's not null or undefined as mandated by the standard. Add a similar test case for the with statement. Change-Id: Idd8e245e8dae4803eb0e2010e3d43bb912670444 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix crash when calling concat on an empty arraySimon Hausmann2014-03-151-0/+1
| | | | | | | | | Make sure to create the array data. The earlier called copyArrayData() doesn't have to do that. Task-number: QTBUG-37506 Change-Id: I6671769fcd471234c4c2eaa1614aa61266db0e5c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix a crash in the register allocatorLars Knoll2014-03-031-0/+14
| | | | | | | | The base for an indexed access can be a constant. Change-Id: Icc529c02fb0ff2ac30d6f40088781b6ecfba81fc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Make it possible to call QQmlEngine::setObjectOwnership at any timeSimon Hausmann2014-03-021-0/+13
| | | | | | | | | | | | | QJSEngine::newQObject should call setObjectOwnership only if it wasn't called before, to preserve any policy set by the user earlier. Otherwise it's only safe to call after newQObject and then you'd have to call it _every_ time the QObject is wrapped, at all call sites. Instead this patch preserves any policy set. Task-number: QTBUG-37160 Change-Id: I6178fa38cd7f4b09d818b6f18762c21588562422 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix calls to overloaded slots for QObjects not created by QMLSimon Hausmann2014-03-021-0/+68
| | | | | | | | | | | If we don't have a property cache, we need to fall back to a slower method of determining the overload methods. We have the code for that in RelatedMethod, once we determine that we're calling overloads, but we never hit that code path because we did not _initially_ determine that the method was an overload. Task-number: QTBUG-37157 Change-Id: I8ff39156e5668236b3797400b4086ed545624398 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-02-111-0/+24
|\ | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4ssa.cpp src/qml/jsruntime/qv4arrayobject.cpp src/qml/jsruntime/qv4context.cpp Change-Id: Ied5b23bec4dc14abe51127c507aed668f855c1e1
| * Fix exception thrown in slot without Qml EngineSimon Hausmann2014-02-071-0/+24
| | | | | | | | | | | | | | | | | | Don't crash when an exception is thrown in a JS slot but we don't have a Qml engine. Change-Id: I1530d5c1c8cb9b9b33b9fdd0d45639fd4a0516f7 Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | alloca() is declared in stdlib.h on BSD systemsGabriel de Dietrich2014-02-021-6/+1
|/ | | | | | | | | | | ... except on Darwin. Bonus change: Updated auto-tests trying to include 'alloca.h'. This is a follow up on 24c43a5748b8502. Change-Id: I299de00bf0dca7842470b158282daea221a10f2d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add support for deprecated RegExp (constructor) propertiesSimon Hausmann2014-01-201-0/+64
| | | | | | | | | | | | These were apparently part of ancient EcmaScript specs, aren't even listed anymore in any recent spec (not even as deprecated), but apparently they are part of what the web supports as well as previous versions of Qml. So this patch implements them. Task-number: QTBUG-36244 Change-Id: I1b9ea7ea09fceb6a486f615837a71e41aae12de4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [ChangeLog][QtQml] Fix JavaScript Array.pop() not updating the internal ↵Simon Hausmann2014-01-071-0/+13
| | | | | | | | | | | | | array length correctly While the length property was reporting the correct value, the internal array length was out-of-sync. Task-number: QTBUG-35979 Change-Id: I68820a349cf1ce88c6aabc6a2301a8a861018a10 Reviewed-by: Liang Qi <liang.qi@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix a crash in JSON.parseLars Knoll2013-12-041-0/+8
| | | | | | | | | | Properly set members that are actually array indices and don't crash when trying to set those. Task-number: QTBUG-35383 Change-Id: I04d4b65c27e97a2e9db19541ed46ee1bb202f780 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Turn on exact garbage collection by defaultLars Knoll2013-10-161-22/+5
| | | | | | | | | 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>
* Remove milliseconds before comparing JS + Qt date strings.Mitch Curtis2013-09-201-0/+2
| | | | | | | | | It seems that tst_qjsengine also needs: https://codereview.qt-project.org/#change,65811 Change-Id: I5f5586f004dec047c3a1edebbc98d7ecde195bfd Reviewed-by: John Layt <jlayt@kde.org> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Revert "Temporarily disable tst_QJSEngine tests [...]"Mitch Curtis2013-09-201-28/+24
| | | | | | | | | This reverts commit 17ae095602bf36ece892598e69f794ef982c603b. The test can be re-enabled now. Change-Id: I0134365edbfd4aed05665bf16b8e15221fe62d67 Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Temporarily disable tst_QJSEngine tests to allow qtbase dev integrationMitch Curtis2013-09-181-24/+28
| | | | | | | | | | | Temporarily disables: - tst_QJSEngine::dateConversionJSQt() - tst_QJSEngine::dateConversionQtJS() so that https://codereview.qt-project.org/#change,65560 can merge. Change-Id: I415daf1c5bd137e1905773f88fe5ebaaab1e0a06 Reviewed-by: John Layt <jlayt@kde.org>
* Skip unstable testsLars Knoll2013-09-181-0/+2
| | | | | | | | | | We can't test GC reliably due to our GC being conservative currently. Once we moved over to an exact GC, we can re-enable the test. Change-Id: I6778ed9bee3b41372705f6b41c1379d224335e53 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Allow for function declarations inside conditionalsSimon Hausmann2013-08-231-0/+18
| | | | | | | | | This is strictly speaking a regression from 5.1/v8, which allows for that as real world JavaScript appears to require it. Task-number: QTBUG-33064 Change-Id: Iceaca84373f12fb08459ed007afb25b5a705fa31 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix another bug with automatic semicolon insertionSimon Hausmann2013-08-081-0/+5
| | | | | | | Avoid empty statements after else. Change-Id: Ia7782a3371bc79c7e93857aa252309d2824a5a9e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix some GC related tests to work with MSVCSimon Hausmann2013-08-061-3/+15
| | | | | | | | Using alloca instead of memset we can convince even MSVC to allocate memory on the stack, to overwrite any previous dead V4 pointers. Change-Id: Ic01bebfc6368e9c3ce1f6155a0f0ea206b90764c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Skip the date time conversion tests on WindowsSimon Hausmann2013-08-051-0/+9
| | | | | | | | There's an issue in QDateTime, now that we're using that in our ECMAScript date implementation... Change-Id: I7599900a670097623d1b7e5b9bb086ef43d6e7e6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix automatic semicolon insertion. Again.Erik Verbruggen2013-07-021-4/+0
| | | | | | | | | | After a do-token, no automatic semicolon can be inserted, because that would result in an empty statement. The issue was that the correct state was set when a do-token was found, but the state updating logic would immediately reset it back, resulting in a semicolon insertion. Change-Id: If867510dfaa182d0fe8b73a5bb1cab299c4faecc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into ↵Simon Hausmann2013-06-241-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Don't remove milliseconds now that toString() includes them.Mitch Curtis2013-06-051-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes a test failure introduced by 15da0a5af20fe6771bcb94ef8d46edbd5c8fb64c. tst_QJSEngine::dateConversionJSQt and tst_QJSEngine::dateConversionQtJS removed milliseconds from the JS-converted datetime, as QTime::toString() previously did not include them. Now it does, so we can remove this code. Change-Id: I48604a2eb4ed854665c9c9a24ba7b03657fea116 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
| * Doc: Fix module name formatSze Howe Koh2013-04-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Follow the conventions at http://qt-project.org/wiki/Spelling_Module_Names_in_Qt_Documentation Qt3D -> Qt 3D QtLocation -> Qt Location QtScript -> Qt Script Change-Id: Id59cb209e0e0407d564de0bfaab73990e64a02e6 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
| * Doc: Fix module name formatSze Howe Koh2013-04-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow the conventions at http://qt-project.org/wiki/Spelling_Module_Names_in_Qt_Documentation QtGui -> Qt GUI QtMultimedia -> Qt Multimedia QtScript -> Qt Script QtSensors -> Qt Sensors QtSvg -> Qt SVG QtWebkit -> Qt WebKit Also fix a broken link to "Qt WebKit QML Types" Change-Id: Ica6081024d3957a3ca2ef3d870f623506c69d877 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* | Mark automatic-semicolon insertion bugs as XFAILSimon Hausmann2013-06-241-0/+4
| | | | | | | | | | | | | | (but marked as needs-fix in trello) Change-Id: I7cfebc9494dd0d5cb027b36f8c8cbcd02a520302 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Comment out test of octal numbersLars Knoll2013-06-141-3/+3
| | | | | | | | | | | | | | We don't currently support octal numbers in v4 Change-Id: Icb31d399a199eb573068b431954a22d169de9b9e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Implement error.fileName and error.lineNumberLars Knoll2013-06-141-3/+0
| | | | | | | | | | | | | | | | | | Useful extensions to the error object. This also helped track down a few places in the parser where we wouldn't give correct error information. Change-Id: Id03653e096216e097c13a7a6e698ca142d92da13 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Remove test case that violates the ecma specLars Knoll2013-06-131-42/+0
| | | | | | | | | | | | | | | | It's actually also hard for us to support this properly, so let's simply not do it. Change-Id: I107e1c1f482d64c9d4d58c805e0446e76e85d840 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Fix test caseLars Knoll2013-06-131-1/+1
| | | | | | | | | | | | | | | | | | The for..in statements behavior is actually undefined when it comes to inserting values into the object being iterated over. Simply adjust the test case to the v4 behavior. Change-Id: I85774ae98810d8c14ee457138ccc54082de47802 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Fix test case. QDateTime actually writes milliseconds since 5.2Lars Knoll2013-06-131-2/+0
| | | | | | | | | | Change-Id: I21a7b63175b173a5036892dd932614a299d519c3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Remove last traces of v8 API and v8 compatibility layerSimon Hausmann2013-06-121-2/+0
| | | | | | | | | | | | | | | | The debugger and profiler service remain as bigger parts that need to be ported properly to v4. Change-Id: I68e72d6db66fe497eb58ed60df417ffe4662d115 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | convert QV8VariantWrapper to v4Lars Knoll2013-05-171-1/+0
| | | | | | | | | | | | | | | | | | Implement variant support through a QV4::VariantObject class. Port scarce resource support for the pixmap and image variants. Change-Id: Ib6aac8debc7f57224ccddb912ab4342c5f1dec15 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Fix keywords testLars Knoll2013-05-051-14/+3
| | | | | | | | | | | | | | The reserved keywords are allowed as property names in objects. Change-Id: I5e0025ff374e0e154df81590660fc96b5c529ea4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Some fixes to the autotestLars Knoll2013-05-051-6/+0
| | | | | | | | | | | | | | Remove an XFAIL that now passes, and some bogus code. Change-Id: I75ef6e54c5efe30e125003e9f2946f3d4e0533ea Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Fix compilation of testLars Knoll2013-05-041-102/+0
| | | | | | | | | | | | | | | | Testing interoperability between our API and v8 doesn't make any sense anymore anyway. Change-Id: Ice97c253974a49e4dd8890d69ec0d0bea19ae110 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Small fixes to auto testLars Knoll2013-04-191-1/+0
| | | | | | | | | | Change-Id: Ie18a15601b27c551a2baf13d0f57f72d711dcef2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Fix compilation with built-in v4vm JS engineSimon Hausmann2013-04-152-2/+2
|/ | | | | Change-Id: Ieda9267e296acf6392a5461f4cfb9233a7a409a0 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge branch 'stable' into devGunnar Sletta2013-01-171-1/+1
|\ | | | | | | | | | | | | | | Conflicts: src/qml/doc/qtqml.qdocconf src/quick/doc/qtquick.qdocconf Change-Id: I087fa14720995a5e53c43567dc4a3c29eb9992a9
| * Update copyright year in Digia's license headersSergio Ahumada2013-01-101-1/+1
| | | | | | | | | | | | Change-Id: I6c3bd7bebe3d62d1cfd0fa6334544c9db8398c76 Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* | Reenable temporarily skipped QML testsPeter Varga2013-01-091-2/+0
| | | | | | | | | | Change-Id: I1e57b0e39c539648602cc480e296db6c6948ff39 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Update some QML tests and temporarily skip themPeter Varga2013-01-091-7/+4
|/ | | | | | | | | | These tests should be skipped until the next V8 update is landed into QtJSBackend. The expected results of these tests currently check wrong behavior. These bugs have been already fixed in the official V8 thus we need to update and skip them until the fix is landed into QtJSBackend. Change-Id: I77d8ee50b45cd6599cbb5735ddef7d1461aeceab Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>