qtdeclarative/tests/auto
Ulf Hermann b6cf0672e6 Allow limited extensions to globals
We can allow

a, overriding data members of globals, such as Error.name
b, adding members that don't clash with any internals
c, any manipulation of toString(), toLocaleString(), valueOf(),
   and constructor

To that effect, add a "Locked" flag to our internal classes. If that is
set, disallow changing prototypes and when defining a property, check if
it shadows any non-configurable property. Furthermore, make all
non-primitive properties that are not meant to be overridden
non-configurable and non-writable.

constructor, toString(), toLocaleString() and valueOf() are exempt
because they are explicitly meant to be overridden by users. Therefore,
we let that happen and refrain from optimizing them or triggering their
implicit invocation in optimized code.

[ChangeLog][QtQml][Important Behavior Changes] The JavaScript global
objects are not frozen anymore in a QML engine. Instead, they are
selectively locked. You can extend the objects with new members as long
as you don't shadow any existing methods, and you can change or override
data members. This also means that most methods of Object.prototype,
which was previously exempt from the freezing, cannot be changed
anymore. You can, however, change or override constructor, toString(),
toLocaleString() and valueOf() on any prototype. Those are clearly meant
to be overridden by user code.

Fixes: QTBUG-101298
Task-number: QTBUG-84341
Change-Id: Id77db971f76c8f48b18e7a93607da5f947ecfc3e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-09-07 16:57:25 +02:00
..
bic tst_bic: remove offending, private entries 2021-11-27 19:08:00 -08:00
cmake Add license headers to cmake files 2022-07-08 10:41:06 +02:00
core CMake: Don't use PUBLIC_LIBRARIES for tests and test helpers 2022-07-28 14:58:42 +02:00
guiapplauncher
particles CMake: Don't use PUBLIC_LIBRARIES for tests and test helpers 2022-07-28 14:58:42 +02:00
qml Allow limited extensions to globals 2022-09-07 16:57:25 +02:00
qmldom qmldom: line by line indentation/reformatting 2022-09-01 02:00:59 +02:00
qmlls qmlls: fix import as resolution 2022-08-12 15:10:01 +00:00
qmltest QmlTest: Prevent interleaved execution of TestCases 2022-08-25 19:05:51 +02:00
qmltest-blacklist CMake: Don't use PUBLIC_LIBRARIES for tests and test helpers 2022-07-28 14:58:42 +02:00
quick Add BoundaryRule.returnedToBounds signal 2022-09-06 07:25:55 +02:00
quickcontrols2 Fix cmake warnings from using deprecated PUBLIC_LIBRARIES 2022-09-06 22:18:52 +02:00
quickdialogs QQuickFileDialog: give non-native dialog a text field for filename 2022-08-17 10:41:18 +02:00
quicktest tst_signalspy: don't wait for window activation 2022-08-25 09:55:47 +08:00
quickwidgets CMake: Don't use PUBLIC_LIBRARIES for tests and test helpers 2022-07-28 14:58:42 +02:00
toolsupport CMake: Don't use PUBLIC_LIBRARIES for tests and test helpers 2022-07-28 14:58:42 +02:00
CMakeLists.txt Add license headers to cmake files 2022-07-08 10:41:06 +02:00