aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
Commit message (Collapse)AuthorAgeFilesLines
* qqml: Remove unused MatchScore::VariantMatchOlivier De Cannière2 days1-1/+1
| | | | | | | Amends 12fb7d27431a7db2a19e1954c85d5dc03264b356 Change-Id: I3af53164851a30317a1fdb5b9190bf7473c3d1ea Reviewed-by: Ulf Hermann <[email protected]>
* Compiler: Detect calls on partially deleted objects and throwOlivier De Cannière2 days1-6/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Component.onDestruction can be used to execute some code as an object is being destructed. The code may, however, reference objects that are no longer in a valid state because they themselves have already been destructed. We then throw an exeception. Commit a741271dd58b21728928684f1ef1efaa91e79ebf introduced the init step for calls in which the types of arguments are resolved. For object methods, we need to check that the object is still valid or throw an exception otherwise. This is made more complicated by the fact that, in some cases, the destruction of the object happens in a somewhat chaotic manner where, for instance, the object is still alive but its method and property storage has already been deleted. This inconsistent state is the cause of QTBUG-138516 and existing checks for invalid objects were not sufficient and we crashed when trying to use the function that we were unable to resolve. We can detect this particular problem by checking whether the ddata of the object still has its jsWrapper. Amends a741271dd58b21728928684f1ef1efaa91e79ebf Fixes: QTBUG-138516 Pick-to: 6.10 6.9 Change-Id: Ifdd7708d73ea6012d1e07aebed257b3f538183c1 Reviewed-by: Ulf Hermann <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>
* Doc: Demonstrate finding some private modulesSze Howe Koh5 days2-0/+3
| | | | | | | | | | | | | | Explicitly finding a private module was not strictly required in Qt 6.9 and older. This patch adds a small demonstration to some snippets, to show how to find QmlPrivate/QuickPrivate. This might be helpful for users who're scratching their heads when their previously-working project now fails to build in Qt 6.10. Change-Id: Ia8a08d94ea65aa73a44c7a7610d28119582ebf0f Pick-to: 6.10 Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Ulf Hermann <[email protected]> Reviewed-by: Alexandru Croitor <[email protected]>
* QtQml: Add method to generate a QVariantHash from a JS objectUlf Hermann5 days2-7/+20
| | | | | | | | | | This generalizes the QVariantMap code path. Pick-to: 6.10 6.9 6.8 Task-number: QTBUG-139025 Change-Id: Ibbdc1da974d3c166474c4bd02fb4c70d8df3e688 Reviewed-by: Semih Yavuz <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>
* QtQml: Fix formattingUlf Hermann5 days3-370/+364
| | | | | | | | ReferenceObject and VariantAssociationObject were indented in rather confusing ways. Change-Id: I3a4ef04f716609a0b32844bb14e4dfded6a1f2fa Reviewed-by: Semih Yavuz <[email protected]>
* QQmlValueTypeWrapper: fix stack-use-after-return and missing destructorAurélien Brooke5 days1-5/+7
| | | | | | | | | | | | | | | If isReference() is true and we allocate a gadgetPtr() on the stack with alloca(), then when readReferenceValue() fails, we return immediately, leaving a bad pointer in d()->gadgetPtr(): - gadgetPtr now references alloca() memory from a function that returned - the destructor of the gadget is never called To fix this, ensure that we destruct and nullptr the gadget on all exit paths, thanks to a qScopeGuard(). Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I4ff411c0f364ad337fdbd55772812e1f219e6dff Reviewed-by: Ulf Hermann <[email protected]>
* qt_target_qml_from_svg() command in cmakeEskil Abrahamsen Blomfeldt6 days1-0/+3
| | | | | | | | | | | | | This adds a build command for generating QML files out of SVG files automatically. It works by first calling svgtoqml on the sources and then adding these to the QML module for the target. [ChangeLog][svgtoqml] Added a cmake api for automatically generating QML files from SVG files in an application. Task-number: QTBUG-128915 Change-Id: I44e70f0ada4ca8ac9ac8253d46832d3a286da927 Reviewed-by: Alexandru Croitor <[email protected]>
* QtQml: Properly null-check module exports when iteratingUlf Hermann8 days1-2/+2
| | | | | | | | | | | | | We construct the iterator from the exports of the module in all current code paths. Therefore, this case can't happen in the current code. Still, the fact that we have a branch that throws a reference error there tells us that it's intended to work on other collections of names, too. Let's complete the check and also check for nullptr since resolveExport can indeed return that. Coverity-Id: 486706 Change-Id: Ieaf3996e76265e9e6ef59c2168699e47e41e8ff5 Reviewed-by: Olivier De Cannière <[email protected]>
* JSRuntime: Add const correctnessOlivier De Cannière8 days2-5/+5
| | | | | | Change-Id: I2fc82de562909ab2e0eecfbbe1e2e53953a33756 Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Ulf Hermann <[email protected]>
* QtQml: Optimize retrieval of string from ValueUlf Hermann8 days1-2/+2
| | | | | | | | stringValue() already checks isString(). We don't have to do it twice. Coverity-Id: 486710 Change-Id: I074228f9a120c3bbfe6d4a65f05fe11322fbd07b Reviewed-by: Olivier De Cannière <[email protected]>
* QtQml: std::move strings rather than copying themUlf Hermann8 days1-2/+2
| | | | | | | | Coverity-Id: 486699 Coverity-Id: 486697 Coverity-Id: 486715 Change-Id: Icdd15ff578f8be55fe9db3ffc38e893f667edc40 Reviewed-by: Olivier De Cannière <[email protected]>
* QtQml: Drop dead codeUlf Hermann8 days1-2/+0
| | | | | | | | | The propertyList is an array allocated on the JavaScript stack. None of it can be null. Coverity-Id: 486709 Change-Id: I3178181aa89bfff86fb5aa469660a912b4f1691c Reviewed-by: Olivier De Cannière <[email protected]>
* Document QQmlComponent error handling in detailed descriptionMitch Curtis9 days1-0/+9
| | | | | | | | | | | | | | QQmlComponent has two stages where it can produce errors that weren't accounted for in the first example (which is what most users will see first): in its constructor and in create(). Add error handling for these so that users aren't confused when their QML silently fails to load or they get crashes trying to access non-existent objects returned by create(). Pick-to: 6.5 6.8 6.9 6.10 Change-Id: I42d0222a997b3cac01cd191bb076513642f5716d Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Ulf Hermann <[email protected]>
* QtQml: Deduplicate enum handling in QtObject and clean up APIOlivier De Cannière9 days6-76/+146
| | | | | | | | | | | | | QJSValue is slow and can be avoided. Use more specific types. Also, switch to an exception based error handling instead of returning undefined. Amends 5e312953f6c41f244344bbd05a41f205a8d3f86d, found in API review Pick-to: 6.10 Change-Id: Ie7c304a0dd76c8096e7c1f9b7cc3cfe7471649da Reviewed-by: Fabian Kosmale <[email protected]>
* Harden namespacingTim Blechmann12 days9-16/+39
| | | | | | | | | | | | | | | When using namespaced Qt, we need to prevent symbol clashes with symbols of the same name. * namespace some publicly visible classes * hide classes in implementation in an anonymous namespace * rename read/write to readValue/writeValue to avoid name clash with c functions. Task-number: QTBUG-138543 Pick-to: 6.10 Change-Id: Ica77462c1f81f1e01cc60477e5b56ecfe3c1abb4 Reviewed-by: Ulf Hermann <[email protected]>
* Improve error message for invalid import qualifierDheerendra Purohit12 days1-1/+1
| | | | | | | | | | | | Previously, the error message for an invalid import qualifier did not show the qualifier name or explain what was wrong. This change adds the qualifier name to the message and says it must start with an uppercase letter. Pick-to: 6.10 Fixes: QTBUG-133313 Change-Id: I0bd4bb143f7b4cdc3b26cae73ab42a4fb05977b1 Reviewed-by: Ulf Hermann <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>
* Fix invalid access to enginePriv in QQmlIncubatorPrivate::clear()Dheerendra Purohit12 days1-0/+2
| | | | | | | | | Add null check to avoid accessing enginePriv after it is set to nullptr. Pick-to: 6.10 6.9 6.8 6.5 Fixes: QTBUG-138927 Change-Id: I180828066a100465694337c4378139cfd9e4ab06 Reviewed-by: Axel Spoerl <[email protected]>
* qt_add_qml_module: Support enabling lint target for examplesFabian Kosmale13 days1-1/+12
| | | | | | | | | | | | | | | If QT_LINT_EXAMPLES is set, any target defined below the "examples" folder will add its lint target to the ALL target. Together with a change in CI to actually pass that define down, we can enforce absence of qmllint warning by combining it with a .qmllint.ini file setting max warnings to 0. Pick-to: 6.10 Task-number: QTBUG-108448 Change-Id: I0f4fd1d18221e503d93e3f435bbc47292857ec20 Reviewed-by: Alexey Edelev <[email protected]> Reviewed-by: Olivier De Cannière <[email protected]>
* QtQml: Deduplicate import finalizationUlf Hermann13 days2-65/+88
| | | | | | | | | We can re-use the same code for file and directory imports. And we can avoid copying a QString this way. Coverity-Id: 486646 Change-Id: Id95226674e382a722527ba3ff6205682ffe1075a Reviewed-by: Sami Shalayel <[email protected]>
* QtQml: Assert on currentStackFrame in direct eval callUlf Hermann13 days1-2/+12
| | | | | | | | | | | If we're called directly from a CallPossiblyDirectEval instruction, that instruction must live in a function which must have created a stack frame. Coverity-Id: 486651 Change-Id: I8136f40a8b6058ad499a7fdaaed99bf85485b11c Reviewed-by: Olivier De Cannière <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>
* Doc: Fix incorrect usage of \generatelistTopi Reinio13 days1-1/+1
| | | | | | | | | | | | | | | | | | | | | The \generatelist command takes an optional argument that affect how the members are listed, for example, `classesbymodule` which creates an annotated list of the classes in a named C++ module. `groupsbymodule` is not recognized or documented. QDoc falls back to generating a list of all members of a group in this case. While the end result is correct, this relies on an undocumented feature that is likely to change and break. Replace these instances with an explicit \annotatedlist command that produces the same output. Pick-to: 6.10 Task-number: QTBUG-138901 Change-Id: Icebe063937cdf1e2ef034b723cce646cd6c96bbe Reviewed-by: Paul Wicking <[email protected]>
* Doc: Mention all_qmllint in the doc for qmllintOlivier De Cannière2025-08-061-4/+9
| | | | | | | | | This should help bring more awareness to it for people who already know qmllint. Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I60e6c6cd1bcab349587904bce08f66af5aef3d95 Reviewed-by: Sami Shalayel <[email protected]>
* QtQml: Allow eval() in global contextUlf Hermann2025-08-051-9/+9
| | | | | | | | | | We don't have to crash if we can't determine a function to query for strictness or if there is no explicit "this" object. Pick-to: 6.10 6.9 6.8 6.5 Fixes: QTBUG-136688 Change-Id: I541f2d906e10a7512d8364a9286885bd6afa4423 Reviewed-by: Sami Shalayel <[email protected]>
* QtQml: Avoid unnecessary string copyingUlf Hermann2025-08-053-3/+4
| | | | | | | | We only need to retrieve the qmldir type namespace if it's not empty. Coverity-Id: 482854 Change-Id: I833e1dd1e100442cf2351944203dce18a4fb9f2b Reviewed-by: Olivier De Cannière <[email protected]>
* QtQml: Avoid unnecessary copyUlf Hermann2025-08-051-6/+4
| | | | | | | | If the qmldir file has no redirection, we don't need to copy any URLs. Coverity-Id: 482855 Change-Id: I8249ffe65b8b62401e8e0593fafa794d5ce862db Reviewed-by: Olivier De Cannière <[email protected]>
* Doc: Create a Getting Started section for the Qt Quick moduleAlexei Cazacov2025-08-014-0/+628
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit moves the "Building UIs with Qt Quick" tree section to the Qt Quick module as a getting started subtree. Changes: qtquick-debugging.html - moved to concepts/Debugging qtquick-deployment.html - moved to concepts/Deployment qtquick-performance.html - moved to concepts/Performance qml-codingconventions.html - moved to guidelines/Coding Conventions scalability.html - moved to guidelines/Scalability qtquick-qml-runtime.html - moved to the qml module "Use Case" topics moved to Getting Started: Visual Elements In QML -> Visual types Positioners and Layouts In QML -> Positioners and layouts Responding To User Input in QML -> Handling user input Displaying Text In QML -> Displaying text Animations In QML -> Animations Style And Theme Support -> was deleted (it had almost zero useful info) Integrating JavaScript in QML -> Integrating JavaScript in QML Task-number: QTBUG-134130 Pick-to: 6.10 6.9 Change-Id: I14c8e4abadc587fbba788b7ce479c3a8364d0a42 Reviewed-by: Ulf Hermann <[email protected]> Reviewed-by: Kai Köhne <[email protected]>
* qmllint: Introduce UserContextPropertiesSami Shalayel2025-07-312-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | Allow the user to specify context property names in .contextProperties.ini files so that they can disable all warnings or only the unqualified warning on their defined context properties by name. I remember some use cases where checking the .qmllint.ini into a users project repository is unwanted, so use a new setting file for the context properties that does not mess with global/system-wide .qmllint.ini files when checked into the repository. Create a new class called UserContextPropertiesSettings that is in charge of loading user context properties setting files, and use it inside of QQmlJSLinter. Introduce a ContextPropertyInfo class that contains both the heuristic information and the user-provided information. ContextPropertyInfo is used to pass the ContextProperty information down the type propagator. Also add some documentation for the new settings file. Task-number: QTBUG-138061 Task-number: QTBUG-128232 Change-Id: Icd700154dc89219f115fa3187c037d65451d0059 Reviewed-by: Fabian Kosmale <[email protected]>
* QtObject: Give uiLanguage a signal in addition to BINDABLEFabian Kosmale2025-07-302-1/+6
| | | | | | | | | | | | | | | | | The consensus at contributor summit [1] was that we want to phase out the BINDABLE integration over time. That means that we shouldn't have properties which are BINDABLE but non-NOTIFY-able in Qt itself exposed to QML. Adjust QtObject::uiLanguage accordingly. No revision marker is needed as the global Qt object only exists as a singleton (and is ina private header). [1] https://wiki.qt.io/QtCS25_-_QProperty_and_QBindable Fixes: QTBUG-138749 Pick-to: 6.10 Change-Id: Ice54f844c87864a325e667d2536c39af821ce7b9 Reviewed-by: Olivier De Cannière <[email protected]>
* Doc: Remove link to deprecated method QQmlEngine::importPluginKai Köhne2025-07-281-1/+1
| | | | | | | | The method got deprecated in Qt 6.4. Pick-to: 6.5 6.8 6.9 6.10 Change-Id: I8cd380f65b4cd800bbc028b3fbe1aefd98881269 Reviewed-by: Nicholas Bennett <[email protected]>
* QQmlPropertyCacheCreator: let PropertyCache handle override instead of ↵Dmitrii Akshintsev2025-07-286-26/+24
| | | | | | | | | | | | | | | | | | | Resolver (2/2) Existing handling of `final` using Resolver seems to be redundant unless there are some corner cases, not covered by our tests. For maintainability purposes it's arguably better to keep handling of override logic in one place and inside PropertyCache, which is intended to be responsible for it (see handleOverride). Therefore adjusting PropertyCache::appendAlias to propagate OverrideResult to the upstream calls and use it in QQmlPropertyCacheAliasCreator<>::appendAliasToPropertyCache to throw an error in cases of invalid property override. Change-Id: I7cabd42197b0829dd7fc2965868c5e5287169a40 Task-number: QTBUG-98320 Reviewed-by: Fabian Kosmale <[email protected]>
* QQmlPropertyCacheCreator: let PropertyCache handle override instead of ResolverDmitrii Akshintsev2025-07-284-43/+36
| | | | | | | | | | | | | | | | | Existing handling of `final` using Resolver seems to be redundant unless there are some corner cases, not covered by our tests. For maintainability purposes it's arguably better to keep handling of override logic in one place and inside PropertyCache, which is intended to be responsible for it (see handleOverride). Therefore adjusting PropertyCache::appendProperty to propagate OverrideResult to the upstream calls and use it in PropertyCacheCreator<>::tryDeriveCacheFrom to throw an error in cases of invalid property override. Change-Id: Iec8da8d5bd2979a4639c27d916b9444b37ad0b7a Task-number: QTBUG-98320 Reviewed-by: Fabian Kosmale <[email protected]>
* QQmlPropertyCacheCreator: add tryDeriveCacheFrom(objIR, baseTypePropCache)Dmitrii Akshintsev2025-07-281-234/+259
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit aims to break monolithic logic of property cache creation into smaller isolated chunks by extracting and exposing a method responsible for creation of cache based on the object's IR and propertyCache of base type. Currently there is a lot of coupled logic happening behind the buildMetaObjectsIncrementally, which is extremely hard to understand and especially hard to test in isolation. It requires a lot of pre-setup of different components to make things work. Within the scope of QTBUG-98320, however, all what's needed to be verified is that given objectIR and property cache of Base Type we create/derive a correct property cache for this object. a.k.a. (objectIR, BaseTypePropertyCache) -> objectPropertyCache The logic in `createMetaObject`, which is a protected method is overly complicated by itself and depends on the state of the PropertyCacheCreator, which is changing during buildMetaObjectsIncrementally. However this "derivation" can be easily extracted and isolated, hence better tested. Some tests will follow in the further commits. Task-number: QTBUG-98320 Change-Id: I332591b0f210efb95d5c096cc75e77d837d9ab94 Reviewed-by: Fabian Kosmale <[email protected]>
* Quick: Correctly expose more types to QMLFabian Kosmale2025-07-281-1/+1
| | | | | | | | | | | | | | | | | | | | | In order for QML tooling (and in some cases, the runtime [1]) to work correctly, meta-methods need to use the fully qualified type. Moreover, we need to make sure that types which are referenced are exposet to QML, even if only as anonymous types. Switching signals and slots to fully qualified types risks breaking old style connects, so this is only applied to private headers. This reduces the warnings reported by the Quick_qmllint_module target quite a bit. [1] The runtime often has the meta-type available, which is generally enough. Tooling however will not be able to identify the type and provide e.g. proper auto-completion. Pick-to: 6.10 Change-Id: I706c25d8fdeb79ca3d2488ce1d2e66f79818cfbb Reviewed-by: Mitch Curtis <[email protected]> Reviewed-by: Olivier De Cannière <[email protected]>
* QtQml: Fix code to assign lists to list propertiesUlf Hermann2025-07-281-7/+65
| | | | | | | | | | | | We need to figure out if the input is also a list, iterate that if necessary, and deal with the various QVariant cases. Amends commit b0fc028cb5a5dfa9e95640a32e9b38ca6df0734d. Pick-to: 6.10 6.9 6.8 Fixes: QTBUG-136566 Change-Id: Iab7c2d18b7049eecd0327cbdb7e7c7592b2d2ad3 Reviewed-by: Sami Shalayel <[email protected]>
* Fix typo: rename uneccessary to unnecessaryTian Shilin2025-07-241-1/+1
| | | | | | | | | The function name had a spelling error. This change improves code readability and follows Qt naming conventions. Fixes: QTBUG-138663 Change-Id: I6965c85e541b4d641a4fae938fc0ddd43e9411be Reviewed-by: Shawn Rutledge <[email protected]>
* CMake: More fixes for QT_CMAKE_EXPORT_NAMESPACE not being availableAlexandru Croitor2025-07-221-7/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The _qt_internal_write_qmldir_part function is deferred to be called in the root CMAKE_BINARY_DIR, where QT_CMAKE_EXPORT_NAMESPACE is not defined if find_package(Qt6) is not called in the root of the project. Make sure to pass the value of QT_CMAKE_EXPORT_NAMESPACE to the function explicitly, from a scope where it is available. This avoids errors like: CMake Error at Qt6QmlMacros.cmake:155 (add_custom_command): Error evaluating generator expression: $<TARGET_FILE:::qmltyperegistrar> No target "::qmltyperegistrar" As a drive by, do the same for _qt_internal_deferred_aotstats_setup and use that variable, instead of the hardcoded Qt6:: prefix. Add test. Amends b47555feff56afa678c4cd91b64b2c77b61b1253 Amends f2889262c86f31d85f2e72edd11792527348b39e Pick-to: 6.8 6.9 6.10 Fixes: QTBUG-138559 Change-Id: I9ecf2149737f3522fa61b7188403c8470b5a15d3 Reviewed-by: Joerg Bornemann <[email protected]>
* Expose XMLHttpRequest to qmltypesFabian Kosmale2025-07-222-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In QML, one can use XMLHttpRequest. Not so with a plain JS engine. The reason for that lies in the fact that a JS engine did not have any network access, because all network functionality was in the type loader, and the type loader was coupled to the QV4::Engine. This has changed in d2bc4a4330254c0c68a0ade51b59a71c4b67b470, but we stil don't expose XMLHttpRequest to a plain QJSEngine. Nevertheless, it conceptually lives in the global object, and we need to collect information about it to enable code completion and linting. Consequently, expose a function in QV4::Engine, which allows us to manually trigger the registration, and call it in qmljsrootgen. Going forward, we should arguably have a QJSEngine::Extension for XMLHttpReuqest, after which we could remove the hack. Note that as before, qmljsrootgen prints a few warnings, because we call functions in contexts in which they must not be called. As before, we ignore this for now. As a side-effect, this adds a few more entries to the qmltypes file for new entries on the global Qt object. Task-number: QTBUG-137075 Pick-to: 6.10 Change-Id: I21e9d62bf075e8d4356db8f357502feb927717e7 Reviewed-by: Olivier De Cannière <[email protected]>
* qmlAttachedPropertiesObject: rename create parameter to createIfMissingMitch Curtis2025-07-222-8/+9
| | | | | | | It will only be created if it doesn't exist. Change-Id: Ide1e6301dd5a67591cb1bd0dc9d19cbfeaaeaa9b Reviewed-by: Fabian Kosmale <[email protected]>
* Document that qmlAttachedPropertiesObject only creates object if it's missingMitch Curtis2025-07-221-4/+4
| | | | | | | Pick-to: 6.5 6.8 6.9 6.10 Change-Id: I1cd7e68182ce97576aba91a5ac95439faf35491b Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Olivier De Cannière <[email protected]>
* QQmlEngine: use the QMetaCallEvent small-arguments-in-place optimizationAurélien Brooke2025-07-211-13/+12
| | | | | | | Following qtbase f6211c079fa000c0d46b7912341f014669fa628a. Change-Id: I87ea2f5c2aab9cbc2b7f26d0761921d430239cc8 Reviewed-by: Volker Hilsheimer <[email protected]>
* cmake/qt_add_qml_module: Fix QtQuick auto dependency setupFabian Kosmale2025-07-141-15/+12
| | | | | | | | | | | | | | | | We need to actually defer the code which attempts to detect whether we are linking against QtQuick to the point where we write-out the file, as the user is not unlikely to use target_link_libraries _after_ qt_add_qml_module. Amends 065b784cab3ff8e8a1dd1f5a304c6b8c3f222d79. To test that this works, we run the all_qmllint target of on an example project. We need to add a .qmllint.ini file to let qmllint fail the build if there are any warnings. Pick-to: 6.10 6.9 6.8 Change-Id: I7e00583b3a5b38549db2be13b1a8817b8489496d Reviewed-by: Alexandru Croitor <[email protected]>
* Rename QV4::Value::undefindedLuca Di Sera2025-07-142-2/+2
| | | | | | | | | | | | | | | The method provides an easier construction of a QV4::Value representing the Undefined value and was thus intended to be called "undefined", as it can be inferred from the introducing patch at ac2d9bf0f2c32bdd6a64b8421c414a28369cbe2e. The current name is thus almost certainly an uncaught typo and is now renamed to the more descriptive and originally intended "undefined". The only usage site of the method was modified to use the new name. Change-Id: Ic00d910960d281c84550af3ab5ccaab52283daca Reviewed-by: Fabian Kosmale <[email protected]>
* QtQml: Remove QQml_isFileCaseCorrect()Ulf Hermann2025-07-117-161/+27
| | | | | | | | | | | | | | | QQmlTypeLoader::fileExists() can do the same job, on all platforms, and more efficiently. Drop the file name case check when loading plugins. Plugin paths are platform-specific and controlled by the build system. There is no sane way to confuse the casing. Also, the build system apparently creates case-mismatched plugins on android, and that works fine so far because QQml_isFileCaseCorrect() was a no-op on android. Fixes: QTBUG-134652 Change-Id: I46059be7998ff8402b400b3e2a5385065275e38d Reviewed-by: Sami Shalayel <[email protected]>
* JIT: Always zero out the accumulator when an exception is thrownLuca Di Sera2025-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently when a JITtted function throws an exception, on exiting, the accumulator is not zeroed-out if we don't have an exception handler and is zeroed out when we do have an exception handler. In the case where an exception handler is missing, this means that if the caller is making use of the result of the function call, it might be dealing with garbage memory. Many times this isn't an issue as the result of the call would correctly be ignored in the face of handling the presence of an exception. Nonetheless, not directly using the result is not necessarily enough to avoid issues with the possible garbage. In particular, if the result of the call is put on the JS stack and handling the exception allocates, the GC might be run as part of the allocation and read the elements on the JS stack, one of which would be the garbage memory that was returned. One case where this can happen in the current code-base is during the evaluation of a non-signal `QQmlJavaScriptExpression`, which does put the result of a call on the JS stack while later handling an exception in a possibly allocating way, with the garbage result still on the JS stack. Furthermore, the interpreter currently isn't affected by the same issue, as the interpreter always zeroes out when unwinding without running an handler. This adds the additional problem of the behavior differing between the an interpreted function and its JITted version in the face of an exception when the result of the call is voluntarily or not inspected. To avoid the issue, the code generated by the baseline JIT was modified to always zero out the accumulator before exiting a function call after an exception, independently of the presence of an exception handler. This further aligns the behavior of a JITted function to that of the interpreter when no handler is present. A test was added to `tst_qqmlecmascript` that exemplifies the issue by passing by `QQmlJavaScriptExpression::evaluate` with a JITted throwing function. Fixes: QTBUG-138242 Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I969dc790f8a274364ae124afaeae8e2381fc82ae Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Ulf Hermann <[email protected]>
* QQmlTypeLoader: Remove pointless check from absoluteFilePath()Ulf Hermann2025-07-111-8/+3
| | | | | | | | A path that starts with '/:' is a pretty obscure thing and there is no reason to special case it here. Change-Id: I06cac90de9dfe202f9fbbe196183e9e89062de86 Reviewed-by: Sami Shalayel <[email protected]>
* QtQml: Fix some arguments to importsUlf Hermann2025-07-114-19/+15
| | | | | | | | The precedence is always quint8 and addImportToNamespace doesn't need the errors list. Change-Id: Ieb0a703cf4e2b5fe64fe954b6ddbdfcf35fb4ddd Reviewed-by: Sami Shalayel <[email protected]>
* QtQml: Look for existing imports even without redirectionUlf Hermann2025-07-111-13/+26
| | | | | | | | | | | It makes no sense to prohibit multiple imports of the same QML module with the same version. We can just re-order the imports according to prcedence when we detect this. Pick-to: 6.10 6.9 6.8 Fixes: QTBUG-138391 Change-Id: I5ad94e1181f6a2beb278e421c1bbf06678fd863b Reviewed-by: Sami Shalayel <[email protected]>
* Replace btoa() and atob() with better implementationsUlf Hermann2025-07-112-4/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current btoa() and atob() perform UTF-8 conversion of the data and therefore produce different outputs than the relevant Web APIs. That's not helpful for a format which was explicitly invented for data exchange. However, since they are compatible with each other, we cannot simply change their behavior. The actual problem stems from the fact that those functions take strings as their inputs. Strings in JavaScript as well as Qt hold 16-bit data, while base64 can only process 8-bit data. This makes it necessary to deal with invalid characters in the first place. Add additional overloads that take QByteArray. At least for btoa() we don't need to check the input for compliance this way. However, since it's difficult to obtain a QByteArray for random data in JavaScript, also add overloads that take a few more common array-likes and convert them. These overloads actually check the data for compliance and throw the "Invalid character" excpetion if it's found to be non-compliant. In turn, deprecate the broken implementations and print a warning when they are used. [ChangeLog][QtQml] The Qt.btoa() and Qt.atob() methods were subtly broken and produced different output than the common Web APIs. They have been deprecated in favor of overloads that take array-likes. Array-likes, especially ArrayBuffer, are a better fit for expressing raw data than strings. Fixes: QTBUG-135329 Change-Id: I4d48c84b3a87cb615f78aa1a8c1eddfedcd306f9 Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Sami Shalayel <[email protected]>
* QtQml: Fix leftovers from V8Ulf Hermann2025-07-115-11/+11
| | | | | | | Some comments and header guards still had V8 in them. Change-Id: I71e888fb72916fcd948a293d9fd50fb54a9499c3 Reviewed-by: Sami Shalayel <[email protected]>
* doc: qmllint: update settings fileSami Shalayel2025-07-111-7/+66
| | | | | | | | | The settings file in the docs looks quite old: replace it with a fresh version obtained by "qmllint --write-defaults". Pick-to: 6.10 Change-Id: I46b12f6b5164ea1880fb63b5408b4b3494eb2d93 Reviewed-by: Ulf Hermann <[email protected]>