Commit Graph

15601 Commits

Author SHA1 Message Date
Lars Knoll 3354628fd9 Update to the latest version of the ecmascript test suite
Update test262.py to work with an up to date version of
the Ecmascript test suite and update the suite to current
master.

test262 does also contain tests for experimental features
that are not yet part of the standard. As we don't want to
test those, test262.py contains a hardcoded list of those
features.

As this brings in all the ES6/7/8 tests in the test suite, it
requires us to add a large list of failing tests to
TestExpectations. But like this we can more easily track
work towards better ES6 compatibility and make sure we
don't introduce regressions.

Currently, we pass around 60% of the test suite.

Task-number: QTBUG-66950

Change-Id: I6ea75702e6f89e901e4752b73219d2f48ed53c10
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-04-26 20:26:36 +00:00
Simon Hausmann 3934ec5671 Minor V4 data structure cleanup
Remove unused flag that indicates whether a cache file contains
executable code. Since we don't embed executable code anymore we can get
rid of that along with the code that attempts to creat an executable
mapping.

Change-Id: I50e9770dc69b31319288a75379fd2f5db4c0a0f4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-04-26 15:26:01 +00:00
Liang Qi 9f295f526d Merge "Merge remote-tracking branch 'origin/5.11' into dev" into refs/staging/dev 2018-04-26 12:02:19 +00:00
Liang Qi 1169242f14 Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
	src/imports/imports.pro
	src/src.pro

Change-Id: Icdc39b6169d15b2102acd0e4d550a8d91e4b0744
2018-04-26 13:08:13 +02:00
Simon Hausmann 0f4212cbdf Minor cleanup in QQmlRefPointer
Add rvalue constructor and assignment operator, to reduce the amount of
atomic operations as a consequence of the typeloader changes that
replace the manual reference counting with QQmlRefPointer usage.

Change-Id: Id36be54e717cf2e83b0027b818f11e20b4fde0ce
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-04-26 09:56:56 +00:00
Simon Hausmann 99b7f1b502 Clean up manual reference counting of QQmlQmldirData
Finally the handling of the  asynchronously retrievable qqmldir data
obtained via QQmlTypeLoader::getQmldir(url) becomes simpler when doing
QQmlRefPointer.

Change-Id: I557980482f8d1a3c7e4189dee92564ec5e6dfb48
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-04-26 09:56:53 +00:00
Simon Hausmann f741956de9 Clean up manual reference counting of blob dependencies
The manual addref() and then release() in notifyComplete() are hard to
read. It's simpler to let m_waitingFor store QQmlRefPointer instances,
at the expense of iteration code that's harer to read.

Change-Id: Idc51fbb1b24e0bd466381b9a1ad10fbd38fc8ac1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-04-26 09:56:49 +00:00
Simon Hausmann 12a2c68789 Clean up manual reference counting of QQmlScriptData
QQmlScriptData is another data type that is best reference counted using
automatic means.

Change-Id: I9e25ac81ccdc03c2eefa35fcecc9cdfcc06dfe0a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-04-26 09:56:46 +00:00
Simon Hausmann 2ce01aa8ca Clean up manual reference counting of QQmlScriptBlob
Replace manual reference counting for loaded scripts with QQmlRefPointer
use.

Change-Id: I5d765a3bb73a04b3a894a04e066d4d73220dafe5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-04-26 09:56:43 +00:00
Simon Hausmann 1a3447a040 Clean up manual reference of QQmlTypeData and QQmlPropertyCache
We have a few places in the type loader where we do adventurous manual
reference counting, where getType() returns a raw pointer that has been
addref()'ed and then sometimes somehow we call release() later. Commit
0b394e30bb is an example of where this can
easily go wrong. As a consequence and also in preparation for future
work on the type loader, this patch starts replacing the manual
reference counting there.

Changing the return type from QQmlTypeData *getType() to a
QQmlRefPointer<> itself is not sufficient though, as the implicit
operator T*() will still allow the caller to store the result as a raw
pointer. Therefore this patch removes the "unsafe" implicit extraction
operator.

As a result of that change, other types that are sometimes stored in
QQmlRefPointer are also affected and their usage needs to be adapted
to QQmlRefPointer usage or manual raw pointer extraction with .data().

Change-Id: I18fd40634047f13196a237f4e6766cbef3bfbea2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-04-26 09:56:39 +00:00
Eskil Abrahamsen Blomfeldt 78be6b2aa4 Fix issue where updated text in layout is not correctly rewrapped
When the text element is inside a Qt Quick layout and we set the implicit width,
this can trigger the Layout to resize the width further down in the stack. At
this point, a recursion guard we have in place to protect against binding
loops will cause us to ignore the size update. The end result is that the text
width has changed, but the contents have not been updated to reflect this.

This change detects this case by checking if the width of the text changed
while the recursion guard was in place, and if it was, we call updateSize()
again to make sure everything is up-to-date.

I added a second admittedly ugly recursion guard for this out of paranoia.
I haven't seen any case where this might cause an infinite recursion, but
it seemed better to be on the safe side.

[ChangeLog][Text] Fixed an issue where updating text inside a layout would
not cause it to correctly adapt to its new width.

Task-number: QTBUG-53279
Change-Id: I1e421a7073428fa490a24be36208a2077f5836dd
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-04-26 07:11:43 +00:00
Lars Knoll 9f731b6841 Fix crashes when parsing some invalid JS
function foo() { let x; function x() {} }

would crash. Throw an error instead now.

Change-Id: I5e5588deb21c1777be15a6656baefc422d59ff0c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 17:50:33 +00:00
Lars Knoll e2ed846dd4 Fix an assertion in the codegen
If there is no name for the binding, we need to store it's
value as a temp on the stack for further destructuring.

Change-Id: Ibf8651e5aed4f45f2ca5f2d2d3ddeb8fc60b5f9f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 17:50:29 +00:00
Lars Knoll d3058682fd Support static as a keyword in class definitions
This requires some interaction between parser and
lexer as static is only recognized as a keyword
directly in the class declaration.

Change-Id: Ib64157ae6ad542706a5eee8ff4ec7f9cb79a62c3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 17:50:24 +00:00
Lars Knoll 62143542d4 Fix tokenizer to generate arrow and exponentiation tokens
Change-Id: Ib228925db9285e61acebc79f881acfbc2de9ff16
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 17:50:19 +00:00
Lars Knoll 70251c5ee7 Bring JS grammar in line with ES7 spec
This basically updates all grammar rules in the
qqmljs.g file to be in line with the ES7 specification.

Some special handling for the lookahead rules appearing
in the spec was needed and is implemented through empty
lookahead rules in the grammar, that might push an
additional token into the token stream.

Renamed some classes in the AST to be in line with
the names used in ES7, and removed some other ones
(SourceElements) that are no longer used.

The ES7 grammar rules contain lots of variations of
the base rules (with In/Return/Yield/Default suffixes).
With the exception of the In and Default rules, these
are implemented through state tracking in the parser
and lexer.

Change-Id: I4017d97cd050ed816c1dad11833e882cba30801a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 17:50:12 +00:00
Lars Knoll 19d3b7eb4c Don't try to verify the AST after parse errors
In preparation for the ES6 changes, where one or two files
won't parse correctly anymore.

Change-Id: Ie83e684761b2d7dcdec1d44f67006f60fb6e500c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 17:50:05 +00:00
Lars Knoll 9814c60536 Don't do a forced lookup by name
Use referenceForName() consistently to do the lookup
of a symbol. Otherwise we might get errors if the name
refers to a local name that we do not export from the
current scope

Change-Id: I09e5816260cec8107411a8562e7f7b76f36912bf
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 17:50:01 +00:00
Lars Knoll de3714c97d Rename JSIdentifer to IdentifierReference
To bring the naming in line with the naming used in the
ES7 grammar specification.

Change-Id: Ie996bba5fb7d08e0790a8e55d3de62961a7257a8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 17:49:56 +00:00
Lars Knoll 4e18d38f16 Add yield as a keyword
It's not a keyword outside of generator functions, so extend the
qmlmode boolean on the lexer to become a more general parsemode that
we can use to also turn the yield keyword on and of.

The parser can then set the flag when it enters the body of a generator
function.

Change-Id: Ibf792d4c7c567d825c6706f7b4997362c87fc575
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 17:49:52 +00:00
Lars Knoll f6754300e2 Cleanup the qqmljs.g file
Unify duplicated code for the regular and NotIn cases, and rather
simply keep them as different states, but execute the same code to
create the AST.

Change-Id: I05687423f95323c23a0340a1d80f99a355628cc4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 17:49:48 +00:00
Lars Knoll aabf219601 Support for destructuring arrays
add support for destructuring of arrays when passing
arguments to functions.

Change-Id: I19feb39aa3ae520ec7591d49d1b14ceaa78783c6
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 17:49:44 +00:00
Lars Knoll da5fffbd34 Partially support binding patterns
Destructuring objects works, but arrays are not
yet supported.

Change-Id: I61e917e1964e3c719f71b8f11d194e09dfe288c2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 17:49:38 +00:00
Lars Knoll e91d0091e0 Get rid of the AST::FunctionDeclaration member in QmlIR::Function
It's not required and makes the refactoring of the function
parameter handling required for ES6 a lot harder.

Change-Id: I0273449219ea9f3324353d6cf9166c1b58eb914b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 17:49:32 +00:00
Lars Knoll 3069193205 Some renaming
Rename defaultExpression to initializer, and the fix the spelling
of Initialiser to Initializer.

Change-Id: I049039a742bdb77cb5f6beab9a28ff3b6f47a605
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 17:49:27 +00:00
Lars Knoll 31026b2e83 Correctly check for duplicate parameter names
Those are not allowed as soon as we have default values for parameters
or rest arguments.

Change-Id: I7dec826c37e6045e4dd1f6b0adb90301efe33daf
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 17:49:21 +00:00
Lars Knoll 219485d898 Add support for ES6 rest parameters
function foo(a, b, ...c) {...} now works correctly.

Change-Id: Ie442a0e7cc5e9dc4156e56b348bba305cced8531
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 17:49:15 +00:00
Lars Knoll b59b727035 ES6: add support for default arguments for function parameters
The parser can also handle rest parameters correctly, this will
however require some additional work in the runtime to support
it correctly.

Change-Id: Ib6f4d27683774966b2d2aac075494d2f5066d2a2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 17:49:09 +00:00
Lars Knoll 2683a22364 Implement support for tagged templates
Get Foo`...` to work as intended by the spec.

Change-Id: If6ccdd7486d3c983c177a3e126e3a661e210a8ae
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 17:49:03 +00:00
Lars Knoll dad5d1cc82 Add support for ES6 template strings
This requires a bit of bookeeping in the lexer, as we can have
arbitrary expressions inside the ${...}. To make this work, keep
a stack of template states, in which we count the unclosed braces
to match up with the correct closing brace.

Implements support for `...`. Expressions of the type Foo`...`
and Foo()`...` will come in follow-up commits.

Change-Id: Ia332796cfb77895583d0093732e6f56c8b0662c9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 17:48:56 +00:00
Tor Arne Vestbø 6d42c6fd33 window example: close window on 'X' button press, not just hide it
Change-Id: Ice699b3350b223db25e4865c930caf6e3afb647c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2018-04-25 17:43:12 +00:00
Richard Moe Gustavsen 5e5107493c test, TableView: add boilerplate code for testing TableView
Change-Id: I4d68e033074442c402df11f779b6875e80ec6412
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2018-04-25 15:31:22 +00:00
Lars Knoll 44cfb771c2 Disentangle some includes by moving QQmlJS::Directives into qqmljsengine_p.h
Change-Id: Iee5a5a9edc8b79649a8f43612584ecf046a9aa2c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 14:19:23 +00:00
Lars Knoll 6c3f4db514 Get rid of some includes that aren't required
Change-Id: I1d9e8922130553acf2bf8fe5a88f209aec90c1fb
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 14:19:19 +00:00
Lars Knoll 1ea05eb775 Get rid of qlalr generated files
Let's not check in the files generated by qlalr. This is ok, as
qlalr is part of qtbase since a long time.

Change-Id: I1298c76e919169c8f02f1e5d067f128a9f2a7542
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-04-25 14:19:15 +00:00
Lars Knoll 0dd479fc8d Fix removal of members from the InternalClass
Removing identifiers from the propertyhash could cause subtle issues
if there was an identifier that hashed to the same value as the identifier
being removed stored in the hash afterwards. This identifier could
end up in a state where it could not be found anymore.

Amends ea164ca4a8

Change-Id: I2881865ee83833b6364d9be55579b8fc7d7c5016
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 14:19:10 +00:00
Richard Moe Gustavsen 4615ffda64 TableView: implement getAttachedObject() for convenience
This function will come in handy in later patches as well.

Change-Id: Id4d6437dcd74f5e69e43d1e56c4c5aa4f2cee462
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2018-04-25 13:05:57 +00:00
Richard Moe Gustavsen e3ec871eac TableView: add destructor that deletes resources
Change-Id: Ib0ca4af4ba4a885e2d936a36c1c448e042e3ff32
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2018-04-25 13:05:51 +00:00
Edward Welbourne ab6cfcfe84 Give the ES test-suite enough time to run
The watchdog timer's usual 5 minutes is roughly how long the test
takes to run (and it gets run twice), so there's a good chance of
timing out.  Avoid flakiness by giving it a third as much again on
top of the default.

Change-Id: I7cc9e392ab939ffe45d92bde635433d272e17388
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-04-25 08:58:29 +00:00
Lars Knoll f95c18b04e Make the test pass on my high resolution screen
Change-Id: I08e952fb8c19c21caf33ffb1cfdc260b533a01d9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2018-04-25 08:39:14 +00:00
Johan Klokkhammer Helsing 281c24d916 Fix QQuickListViewPrivate::snapItemAt for lists with spacing
If lists had spacing, snapping would have gaps where snapItemAt would
return nullptr eventhough there were items above and below in the list.

I.e. if we have a list with items of size 100, and a spacing of 100, and
scroll to 110 (right below the first item), then the first item would fail
because this is false:

    itemTop+itemSize()/2 >= pos (50 >= 110)

And the next item (the one we should have snapped to), would fail because
this is false:

    itemTop-prevItemSize/2 < pos (200-100/2 < 110)

The meaning of first part was probably to see if the middle of the current
item is inside the view.

The meaning of the second part was probably to see if the middle of the
previous item is outside the view.

This patch refactors the code so it's more visible what's happening and
fixes the bug by taking the spacing into account when computing the position of
the halfway positions.

Task-number: QTBUG-59852
Change-Id: I60eec0d16e91d2f22d70b97d11bcde5d88ac2997
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2018-04-25 04:28:48 +00:00
Ulf Hermann ac6e893c5c Make the shared test code independent of QtQml
This enables us to drop the QML dependency from a number of tests. This
is desirable because we want to test that we didn't do any incompatible
changes to the debug framework.

Change-Id: I937dd45d3079eac15c200c9d68bb4c911f61afc0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-24 19:24:12 +00:00
Morten Johan Sørvig 127659c450 QQuickWindow: Don’t crash on events during destruction
Deleting d->contentItem may call into the platform
plugin, for example if the contentItem is a Window. This
can again make the platform (plugin) generate events
for the QQuickWindow that is being destroyed. The QQuickWindow
may try to use the now invalid d->contentItem during
event processing, and crash.

This is especially prone to happening if/when the platform
plugin does less queuing of events, for example on macOS
after commit ed483346.

Fix this by clearing the d->contentItem pointer before
deleting it. Also make sure all d->contentItem accesses
have nullptr checks.

Task-number: QTBUG-67802
Change-Id: Ieff97711fbe15818948d4b6ade069b096a55c683
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-24 18:38:00 +00:00
Jesus Fernandez 5cc8db797a Use different buffer for indices and vertices only in the WebGL plugin
This patch partially reverts 098ba08653.
Only QtWebGL will use separate buffers for indices and vertices. This
patch gives a performance boost.

Task-number: QTBUG-66191
Task-number: QTBUG-67147
Change-Id: I58b4db2bdf44cd954390e85e079de82031caf9e5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2018-04-24 16:37:10 +00:00
Ulf Hermann 03739f2150 Make QtQmlDebug independent of QtQml
This means QtQmlDebug needs its own qqmlprofilerdefintions.h. This is a
good thing because this way we notice if we change the definitions in an
incompatible way. The test uses QtQmlDebug after all. Also,
qqmldebugserviceinterfaces_p.h is not available anymore, which means the
service names have to be spelled out. This, also, is beneficial as it
prevents us from accidentally changing the names.

In the context of QmlDebug we don't need to namespace the profiler
definitions, either. This simplifies some code.

Task-number: QTBUG-60996
Change-Id: Ibb39e48c9b758687d68b8ce4431f45eb26939a09
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-24 08:44:41 +00:00
Edward Welbourne bea27694ae Update submodule now that I've fixed the actual bug here
The submodule has now reverted my "fix" for a test the ES spec
initially lead me to think was misguided; the test is fine, in fact,
but I was using the wrong time-zone to run it.  That's now fixed here,
so we can take in the revert of the mis-fix.

Task-number: QTBUG-67010
Change-Id: I89c8236ce11ee4dc16eb145e37f4510e19977bb2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-23 14:30:38 +00:00
Ulf Hermann 15202d33cd Make QPacketProtocol independent of Qml
Just because we need a data stream version for QQmlDebugPacket, we don't
need to add such a huge dependency. Using a template here adds some
boiler plate to all users of QQmlDebugPacket, but this is worth it.

Task-number: QTBUG-60996
Change-Id: Ibade8757e28ac772942129c22c8721b504da3aee
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-23 12:46:00 +00:00
Richard Moe Gustavsen 913dc3f4f2 QQuickItemViewFxItem: init index
Change-Id: Idca9285715e10e6306eb155dcd39a36b4e847797
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2018-04-23 07:29:54 +00:00
Pasi Petäjäjärvi 8f1ba6faff Build fix for -no-feature-testlib
Task-number: QTBUG-66609
Change-Id: I6d96b14299f7d764414f6482b7b9b003611d8344
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-04-23 06:27:39 +00:00
Qt Forward Merge Bot 1939ecb562 Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: Ibeba10bc821a01125a485df48a0bc88c45c01a73
2018-04-21 01:00:06 +02:00