| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows users in a JavaScript-only environment to install extensions including:
- Translation functions (qsTr(), etc.)
- The console object (console.log(), print(), etc.)
- Garbage collection functions (gc())
This deprecates installTranslatorFunctions(). This API results in less
clutter in the API, as we'd otherwise need to have several functions
for each type of extension.
[ChangeLog][QJSEngine] Introduced an extension API that allows
installing various function and object extensions (qsTr(),
console.log(), etc.) to QJSEngine.
[ChangeLog][QJSEngine] installTranslatorFunctions() was deprecated in
favor of the new extension API (see installExtensions()).
Change-Id: I4d6eb2097c3eda6810e967b2e8f6441c28c91a16
Task-number: QTBUG-40772
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Replace Q[TRY]_VERIFY(pointer == 0) by Q[TRY]_VERIFY(!pointer).
- Replace Q[TRY]_VERIFY(smartPointer == 0) by
Q[TRY]_VERIFY(smartPointer.isNull()).
- Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b) and
add casts where necessary. The values will then be logged
should a test fail.
Change-Id: I8cc97fd9b48fc789a849e9527c292c4e05accd97
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
|
|\
| |
| |
| | |
Change-Id: Ie8ea118ed0a1a9a1c3d81e1e34d85c03c695c9a4
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 75c22465cf8fe262edfe6178bb9ca19661fb710e regressed in allowing
locals and arguments to be passed directly as further arguments to function
calls, but that's incorrect when considering
var i = 2;
testFunction(i, i += 2)
where it is instrumental to place the first argument into a temp (making a
copy) instead of passing it directly.
Change-Id: Iffcf6c6eda92a8fb665982cda1db0b96359cd092
Task-number: QTBUG-45879
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|\|
| |
| |
| |
| |
| |
| | |
Conflicts:
src/qml/jsruntime/qv4numberobject.cpp
Change-Id: I4e66a03ef4d99cec192c9da30c028fd8c1f4ac0d
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
(12.5).toFixed() should return 13, not 12.
Task-number: QTBUG-43885
Task-number: QTBUG-44039
Change-Id: Id2b19641e8c12dd5755d8447508b74567e4a2b9b
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
|
|\|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
.qmake.conf
LICENSE.GPLv2
examples/qml/networkaccessmanagerfactory/view.qml
src/qml/jsruntime/qv4runtime.cpp
src/qml/jsruntime/qv4stringobject.cpp
Change-Id: I5d12f436d60995e51d5c2f59d364e9cbc24f8e32
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
For
true()
we generate IR that looks like this:
temp = true
result = call temp()
and therefore the move at isel time has IR::Call as source and a temp
as base for the call. However constant propagation in the optimizer transforms
this to
result = call true()
and that's a case we didn't handle in the IR visitor. Since we have
Runtime::callValue we can however handle this case as well and the run-time
will consequently produce the expected run-time error.
Change-Id: Ia94a8116388e66f9f339913307f68e33a5c18a19
Task-number: QTBUG-43819
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Jan Kundrát <jkt@kde.org>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Qt copyrights are now in The Qt Company, so we could update the source
code headers accordingly. In the same go we should also fix the links to
point to qt.io.
Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9
Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
|
|\|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
.qmake.conf
src/qml/jsruntime/qv4context_p.h
src/qml/jsruntime/qv4debugging.cpp
src/qml/jsruntime/qv4engine.cpp
src/qml/jsruntime/qv4functionobject_p.h
src/qml/jsruntime/qv4qobjectwrapper.cpp
src/quick/scenegraph/shaders/visualization.frag
tests/auto/qml/qjsengine/tst_qjsengine.cpp
Change-Id: I492e8546c278f80a300a2129e9a29d861e144a30
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Only do integer add/sub/mul when all operands are known to be integers.
[ChangeLog][QtQml] Fixed invalidly opportunistic truncating of non-integer values for additions/subtractions/multiplications in JavaScript and binding expressions.
Change-Id: I21b3bede2fb3e8033305591110b98cc9e6bf52f8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The operands of bit-ops are not typed as int32 when no type-inference is
done, like for the interpreter.
Task-number: QTBUG-43309
Change-Id: I67af18e14ddbc0649530ac23601332ee7d7a1f34
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
[ChangeLog][QtQml] Added qjsEngine(QObject*) getter similar to qmlEngine(object)
that allows retrieving the engine for an exposed object.
Change-Id: Id14adec58d45fe58133f65bab773b07d6bc18569
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
This completes the first milestone towards being able to move
objects across the GC heap.
Change-Id: I8e6ce90254ea767188a31f0dc85b133534c87eb0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In case a QJSValue contains a QVariant which wrapps an
enum value, the valueOf() method will convert the enum
to an int32.
Change-Id: I0b92207184f343d53f73884245b90552165c34fc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|\|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/qml/jsruntime/qv4arraydata.cpp
src/qml/jsruntime/qv4context_p.h
src/qml/jsruntime/qv4globalobject.cpp
src/qml/jsruntime/qv4internalclass.cpp
src/quick/items/qquicktext_p.h
src/quick/items/qquicktextedit_p.h
src/quick/items/qquicktextinput_p.h
Change-Id: If07e483e03197cb997ef47a9c647a479cdb09f4c
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
QJSEngine::installTranslatorFunctions install the translator functions
to any given JS object. However, the custom string::arg() method is only
added in qqmlbuiltinfunctions.cpp, making the use of qsTr() in other
pure-JS programs quite hard.
Task-number: QTBUG-43113
Change-Id: Ia9ed97a4c07a4d167c792f3ea13e4f6e96c97423
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This implements most of the spec required for the
Khronos typed array specification.
It tries to follow ECMAScript 6 as closely as possible,
but currently only implements a subset of the ECMAScript
6 specification.
Addes a test script in tests/manual/v4 to test our
implementation.
Change-Id: I8ec63869500358e088b73240e1f37120ae3cf59a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
The second class that is required for typed
array support.
Change-Id: Idc2dcec7c1eee541f76dc5ab1aea6057ba03cb93
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|/
|
|
|
|
|
|
| |
This is the first class required to support typed
arrays in our JS engine.
Change-Id: I0fe1e1ca430769c171912dda207cfae772e9b9db
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|\
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
.qmake.conf
src/qml/jsruntime/qv4arraydata.cpp
src/quick/scenegraph/util/qsgatlastexture.cpp
Change-Id: Ic4c96066d5c37dcf0d5446baed590ea005d445ce
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We can't use std::sort to implement Array.sort. The reason is that
std::sort expects a conformant compare function, and can do weird
things (esp. crash) when the sort function isn't conformant.
Falling back to qSort is not possible, as the method has been
deprecated. So add a copy of the qSort implementation here, and
use that one instead.
Fix the sortint test in tst_qqmlecmascript to have a consistent
sort function for strings, as the result of calling sort is
otherwise undefined according to the ecma standard.
Task-number: QTBUG-39072
Change-Id: I0602b3aa1ffa4de5006da58396f166805cf4a5e2
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Renamed LICENSE.LGPL to LICENSE.LGPLv21
- Added LICENSE.LGPLv3 & LICENSE.GPLv2
- Removed LICENSE.GPL
Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0
Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is a regression from Qt 5.1/5.0 introduced with 5.2. Private slots/methods
such as QObject::_q_reRegisterTimers() as well as QObject::deleteLater() are
not suitable for calls from JavaScript. deleteLater() in particular is covered
by the destroy() replacement slot.
Task-number: QTBUG-39744
Change-Id: I9b25f3c0d4095ba8e2e8e5ee47e37903b5def1f9
Reviewed-by: Michael Brasser <michael.brasser@live.com>
|
|\|
| |
| |
| |
| |
| |
| | |
Conflicts:
src/quickwidgets/qquickwidget.cpp
Change-Id: Id4b080aea713df68608847bb82570231e37ce536
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
After commit ac57f185d1a2203cd4b585df7bd7af01c3ec33ed we succeed in selecting
the correct overload based on the supplied arguments. However when calling
slots on objects without a property cache, we end up using the local "dummy"
variable to store the synthetic propert data. We also store the currently best
patch in the "best" variable, which is a _pointer_ to the property data of the
match. Suppose we have 5 overloads to choose from, we find that the 3rd is
the best. Then we try the fourth but find it unsufficient and break out of
the loop. Unfortunately the "dummy" property data at this point contains the
data of the fourth (wrong) overload, and our best match variable points to it.
So then when we finally call the method, we do it based on the wrong property
data.
The easy patch is to simply copy the few bytes of property data, so "best" is
stored by value instead of pointer.
Change-Id: Ie2ebbdb88a117770b6c7b9490e1c634077020e9d
Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Re-add the QScriptEngine::addTranslatorFunctions API that brings back
qsTr() and friends to pure QJSEngine based environments.
The auto-test were also ported where applicable.
Change-Id: Ib03e3495ef09eeea9e4c8341061499768caed307
Sanity-Review: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Consider:
function f() {
var a;
a();
}
Here the constant propagation will propagate the value for a (undefined)
to the call site. This was not yet handled, resulting in Q_UNIMPLEMENTED
warnings when running a debug build.
Change-Id: I5f85f681d975b54df7a9e00bd5b50e6f4350139a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|\
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/qml/compiler/qv4ssa.cpp
src/qml/jsruntime/qv4arrayobject.cpp
src/qml/jsruntime/qv4context.cpp
Change-Id: Ied5b23bec4dc14abe51127c507aed668f855c1e1
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
|/
|
|
|
|
|
|
|
|
|
| |
... 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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
This reverts commit 17ae095602bf36ece892598e69f794ef982c603b.
The test can be re-enabled now.
Change-Id: I0134365edbfd4aed05665bf16b8e15221fe62d67
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
|