aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix hasOwnProperty on various types wrapped in QMLSimon Hausmann2013-08-081-1/+0
| | | | | | | | | | | | * Change semantics of Object::query to not walk the prototype chain but let the caller do that where needed (__hasProperty__) * Re-implement query in various places * Implement method_hasOwnProperty to fall back to query() if getOwnProperty failed * Fix missing prototype initialization in some qml wrappers, as well as missing base class calls to ::get() Change-Id: Ic2a702fd5ff3be2ff3c8317a8a24f99940a9594f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix some GC related tests to work with MSVCSimon Hausmann2013-08-061-6/+22
| | | | | | | | 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>
* Disable some GC sensitive tests with MSVCSimon Hausmann2013-08-051-0/+9
| | | | | | | | | We can't get these tests to work reliably with MSVC because it depends on how MSVC optimizes away memory stores that are "dead" stores for the compiler but not for our conservative collector. Change-Id: Ia5ca197573a09358c220d926deccaaf0bacc3a0b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Improve reliability of GC related testsSimon Hausmann2013-07-291-25/+16
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Silence qqmlecmascript::propertyVarInheritance failures with clang release ↵Simon Hausmann2013-07-261-0/+6
| | | | | | | | | | builds There's no equivalent to #pragma GCC optimize ("O0") yet, so we cannot run these test (sort of) reliably with clang. Change-Id: Ie41d3ba7911cefacca00165941761b20579107a2 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Move QV4::Exception into a separate compilation unit with header fileSimon Hausmann2013-07-121-0/+1
| | | | | | | | This is in preparation for some platform specific code regarding throwing exceptions, as well as a general cleanup :) Change-Id: I23fb4f12fd09423a1f2cb225145780925002677b Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Get rid of the first half of QQmlGuard usageLars Knoll2013-07-051-7/+6
| | | | | | | | | QQmlGuard was being used as a more performant replacement for QPointer. QPointer got now fixed in Qt 5.0, making this class obsolete. Change-Id: I77eef066c4823af4b074ef32d4d78dbd67c36cd0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix failing GC related tests with gcc in release buildsSimon Hausmann2013-07-051-3/+21
| | | | | | | | | | | | | | | | Our conservative collector might is more likely to find old pointers to QV4::Objects on the C stack in release builds, when gcc optimizes out stores that seem unnecessary. These two tests are prone to that due to temporary QV4::Values potentially ending up on the stack on x86, because vmeProperty returns then through an invisible first argument that is a pointer a a location on the stack. This patch makes those temporaries explicit, clears them out after usages and adds GCC pragmas to disable optimizations for these two test functions. Change-Id: Ie43841e869346792296911fee6fed80c745faeff Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into ↵Simon Hausmann2013-06-241-0/+32
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-221-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 expected error messages in singleonType testSimon Hausmann2013-06-231-2/+1
| | | | | | | | | | | | | | | | Writing to a property of a frozen object doesn't throw a type error exception in non-strict mode. Change-Id: I408078a2a09d16868b95f275f13f2f7a176f66e9 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Mark qqmlecmascript::hasOwnProperty as xfailSimon Hausmann2013-06-211-0/+1
| | | | | | | | | | | | | | | | hasOwnProperty is not currently properly supported on dynamic objects that re-implement get. Change-Id: Ib6cfe13bbdbe4457adf05cd20e42d3a5e85ac318 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Mark a sub-test in qqmlecmascript::scope() as xfailSimon Hausmann2013-06-211-0/+1
| | | | | | | | | | | | | | | | This test relies on the global object vs. context ordering and consequently fails right now Change-Id: I6b6cec38bf2d2074c2fcfacf9b499bc7a97cca44 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Remove XFAILs that was due to strict modeSimon Hausmann2013-06-211-7/+0
| | | | | | | | | | | | | | In non-strict mode we can use with() and eval() again, and so these tests pass. Change-Id: I66b16653a28b1d7e420e53c012d7908c8fc6c29a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix tst_qqmlecmascript::functionAssignmentfromJS_invalidSimon Hausmann2013-06-181-2/+2
| | | | | | | | | | | | | | | | | | | | Remove the column number from the expected output, as we generate those QQmlBinding objects from within a v4 callback and produce the line number and column number from the stack trace of the engine, which currently doesn't produce column numbers. Change-Id: I9840f0ab571d4261570dd079436aaa9f81e27abf Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Mark the eval() test as xfailSimon Hausmann2013-06-171-0/+1
| | | | | | | | | | | | | | | | eval() works differently in strict mode, and it's nicely covered by test262 Change-Id: I9bb84753032d5106c94d78afe765680f3d85348d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Adjust expected error message for qqmlecmascript::qtbug_22843Simon Hausmann2013-06-171-2/+2
| | | | | | | | | | Change-Id: Ib6f58c2d7ee5e4f03fcc755d2290bdf204e3aa61 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Re-enable two disabled var property tests and make them passSimon Hausmann2013-06-151-30/+19
| | | | | | | | | | | | | | | | | | When marking the var properties of a VME-metaobject (we decided to keep its QObject alive), then we must also mark the var properties of the parent VME-metaobject. The two property var inheritance tests verify that. Change-Id: If1f0d4f3daef78d42adb7052cc1ce7bbdd6da585 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Don't allow for a QJSValue to be taken from one engine to another through ↵Simon Hausmann2013-06-131-1/+1
| | | | | | | | | | | | | | QVariant Change-Id: I21127d22f595b0ff88f6073bddf617423ad17867 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Cosmetic: Silence the with statement warnings, in addition to the XFAILSimon Hausmann2013-06-131-1/+7
| | | | | | | | | | Change-Id: I8a89acc93f1446a5ef6cb8441a8ad9b48c4fb752 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix tst_qqmlecmascript::callQtInvokablesSimon Hausmann2013-06-131-0/+3
| | | | | | | | | | | | | | | | | | | | Make sure to set inheritContext to true, to run the sample scripts the same way as we run QML right now: with lookups disabled. Lookups with custom get() don't work right now and cause the tests to fail lookup properties in QObject. Change-Id: I22a1133d5d568935c64fc5162445a438665713b8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix exception type when trying to assign to read-only QObject propertiesSimon Hausmann2013-06-131-2/+2
| | | | | | | | | | | | | | [[Put]] throws a type error, and so should the put operation on a QObject Change-Id: I8fad91f3969c1889381d67d8d0ff751a91f8239e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix diagnostic error message when put fails because of a read-only propertySimon Hausmann2013-06-131-2/+4
| | | | | | | | | | Change-Id: I9310c160386e9610d76ae0a8b3228b22757d5a02 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix toString lookups on QObject bindings (And thus ↵Simon Hausmann2013-06-131-3/+7
| | | | | | | | | | | | | | qqmlecmascript::toObjectString) Change-Id: I20e5788e8810d9354ca51245ee05181c9f4648ae Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix syntax error propagationSimon Hausmann2013-06-131-1/+1
| | | | | | | | | | | | | | | | | | For syntax errors we use the DiagnosticMessage type in qv4context.cpp, that contains detailed information about the error. We must catch that error correctly in QQmlVME::run and report it to the engine. Change-Id: I8f53c7db8dbdc6afa72396f3c25537690a6f5841 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Mark test using with statement as expected failureSimon Hausmann2013-06-131-0/+1
| | | | | | | | | | | | | | We run QML bindings in JS strict mode now, where with is not supported Change-Id: I7e1b2747c50f9affdb6b7cfa80287f1f198ad930 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Remove last traces of v8 API and v8 compatibility layerSimon Hausmann2013-06-121-19/+19
| | | | | | | | | | | | | | | | 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>
* | Small fix in tst_qqmlecmascriptSimon Hausmann2013-06-121-2/+2
| | | | | | | | | | | | | | EVALUATE_ERROR is supposed to return true if an exception was caught Change-Id: I8371206e4a4e9d0c3d40ef09cf61d28ed19e40aa Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix qqmlecmascript::enums and nonNotifyableSimon Hausmann2013-06-081-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | In the v8 bindings in expressionIdentifier we used to print the url with line number and only in the base class we printed the expression itself. With qv8bindings.cpp gone, we can do that now in the base class, as expected by the test. Adjusted the test also by columns. Change-Id: I8d532d21baf5bf2fbfcca56c2657a1d65025fe84 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix qqmlecmascript::sequenceConversionBindingsSimon Hausmann2013-06-081-1/+1
| | | | | | | | | | | | | | Adjust the expected error message with the missing column Change-Id: Iac6be0cdf7322bfb4289925c4bb67b5b2f0437f5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Remove failing testSimon Hausmann2013-06-081-14/+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 qqmlecmascript::signalWithJSValueInVariantSimon Hausmann2013-06-081-2/+2
| | | | | | | | | | | | | | Don't use arguments.callee as we're now in strict mode :) Change-Id: I9992fd6d39a170ce6f6d751aa49393e50ca0e636 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix qqmlecmascript::nonExistentAttachedObjectSimon Hausmann2013-06-081-1/+1
| | | | | | | | | | | | | | Add column to the expected error message output Change-Id: I585fdcedd7a78f1a208770765851f04ee5a5b207 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix tst_qqmlecmascript::scriptErrors()Simon Hausmann2013-06-071-1/+1
| | | | | | | | | | | | | | | | | | * In the context wrapper, throw a real JS exception that when serialized to a string includes the "Error:" prefix (due to the error object's name) * Added column information to one of the expected error messages Change-Id: I4c1bc749f01425efb0a27121f7f1b8cf4946d644 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix tst_qqmlecmascript::signalArgumentsSimon Hausmann2013-06-071-2/+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>
* | Improve type error messages when reading propertiesSimon Hausmann2013-06-051-12/+7
| | | | | | | | | | | | | | | | | | | | This fixes the expected output of the qobjectConnectionListExceptionHandling and while we're at it this patch also re-enables the importScripts test. The test expects similar output that now passes. importScripts_data produces two failures though, that are unrelated to expected error message but indicate real bugs. Change-Id: I606b8791524d19a4bb20a81c30abc2285a1a0a0f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Move QV8QObjectWrapper::newQObject into QV4::QObjectWrapperSimon Hausmann2013-06-051-1/+1
| | | | | | | | | | | | | | | | ...where it is just called wrap(), because it doesn't always create a new JS wrapper for the QObject. Change-Id: Ieed0fc97174eb51cd04df0149e715c234a5822bd Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Get rid of QV8Engine::toQObject and QV8QObjectWrapper::toQObjectSimon Hausmann2013-06-031-1/+3
| | | | | | | | | | Change-Id: I8726148093079b3385c6b0f16284af0b5ba92066 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Start converting casting of Managed to subtypes to a better schemeLars Knoll2013-05-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | There is now a template based as<Foo>() method available in Managed, that'll allow casting to the proper subclass. It uses the pointer to the vtable and compares it to the classes static vtable for type checking. Like this we can avoid that Managed has to know about all subclasses. Change-Id: Ic966bbe00d85224b8d96cc0ff00f69a6ac67129e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Fix tst_qqmlecmascript::switchStatement()Simon Hausmann2013-05-291-1/+1
| | | | | | | | | | | | | | | | Adjust the expected error message output to include the column number instead of just the line number. Change-Id: Ie8064d6a26f875d8da5b0d68c503d632b6afc69e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Implement JS ownership policy for var and variant propertiesSimon Hausmann2013-05-241-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | Instead of a GC callback, let's keep the lifecycle of the var properties and the QObject wrapped variants in sync with the lifecycle of the JS QObject wrapper, through a markObjects re-implementation. handleReferenceManagement test passes now, fixed a few incorrect gc() calls in there. Change-Id: I78e8ca700e41bba788b61d3816a77cfb3a7c5e58 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Implement QObject ownership policy for QObject JavaScript wrappersSimon Hausmann2013-05-241-230/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A parent with C++ ownership keeps its children alive. We know that all QObject wrappers are kept in a QWeakValue inside the QObject's QQmlData. As the weak values are registered to the MM, we can traverse there and mark the children if necessary in one extra pass. The handleReferenceManagement auto-test that covers this was actually testing the addGCRelationship implementation as well as the overal behavior. Some of the tests verify that a handle based overload of addGCRelationship works, so since those tests don't make sense anymore, I've removed them. Also fixed some cases where the test ran gc(engine) when it should've called gc() on the specific local QQmlEngine instance used in the test. This worked in V8 because the GC was "global". Change-Id: Ib394b46e034b016196804a9e73682507fa791445 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Various fixesLars Knoll2013-05-221-18/+18
| | | | | | | | | | | | | | | | Fix a regression in Script::run, and compilation for v4 and an auto test. Change-Id: I4026eebec0e02f4af03ca49ba714916ad90b34e7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Fix the buildSimon Hausmann2013-05-211-4/+4
| | | | | | | | | | Change-Id: I04a2e3c280b622378bf4431a77388e59eb31ad10 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Convert the remaining TryCatch statements to use QV4::ExceptionLars Knoll2013-05-211-34/+41
| | | | | | | | | | | | | | | | v8::Script::Run doesn't catch the exception anymore. Instead we handle this on the calling side, removing all needs for v8::TryCatch. Change-Id: I946269a6734f50c728c4f153c00cd19db48f1a6a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | convert QV8VariantWrapper to v4Lars Knoll2013-05-171-9/+11
| | | | | | | | | | | | | | | | | | 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 build of tst_qqmlecmascriptSimon Hausmann2013-05-151-5/+15
| | | | | | | | | | | | | | | | Comment out v8 persistent and weak reference handling related bits and tests. Otherwise this auto test contains a lot of stuff we need. Change-Id: Ieafd9c8ea5200e5429d6354243ccaddba4f4772e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | More steps towards eliminating the v8 layerSimon Hausmann2013-05-071-22/+9
| | | | | | | | | | | | | | | | * Changed the return type of the InvocationCallback from a v8 handle to a QV4::Value * Removed v4 auto tests and fixed build of other tests Change-Id: Ic927b925923ca8785170689a5c260969fd1cb794 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Replace v8::Undefined() with QV4::Value::undefinedValue()Simon Hausmann2013-05-071-60/+60
|/ | | | | Change-Id: I4c7bb5bcc1bc15a982bb83d2597e6ae4bc5710cd Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix hexadecimal escape sequence validation in strings.Erik Verbruggen2013-03-191-1/+1
| | | | | | | | | 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>