aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsapi/qjsengine.h
Commit message (Collapse)AuthorAgeFilesLines
* Make JavaScript execution interruptibleUlf Hermann2019-04-301-0/+3
| | | | | | | | | | | Add an atomic isInterrupted flag to BaseEngine and check that in addition to the hasException flag on checkException(). Add some more exception checks to cover all possible infinite loops. Also, remove the writeBarrierActive member from QV4::EngineBase. It isn't used. Fixes: QTBUG-49080 Change-Id: I86b3114e3e61aff3e5eb9b020749a908ed801c2b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add convenience functions for creating and inspecting error objectsAllan Sandfeld Jensen2018-10-301-0/+3
| | | | | | | | | Serves to simplify porting from QtScript by replacing QScriptContext::Error and QScriptContext::throwError(). Change-Id: I4bfe404c358c50aaf3b5469a4304fec97552bf24 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add API to QJSEngine for importing ECMAScript modulesSimon Hausmann2018-08-161-0/+2
| | | | | | | | | | | | Now that the standard defines the concept of a module, it makes sense to offer a function in QJSEngine that can read files and load them. [ChangeLog][QtQml][QJSEngine] Added function to import ECMASCript modules from the file system or the Qt resource system. Change-Id: I72f8d49de948872221ac1b54fcfb066404bed9b9 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add QJSEngine::throwError() method to report run-time errorsRichard Weickelt2018-07-021-0/+2
| | | | | | | | | | | | | | | | It is quite common in JavaScript to use exceptions for error handling, but there was no way to generate an exception from C++ context, i.e. when the JS run-time invoked a C++ method or a slot. This patch adds an naive way to report run-time errors to QJSEngine from CPP context. The user may set a custom error message, but the location points always to the caller context in JavaScript. [ChangeLog][QtQml][QJSEngine] Added API to throw run-time errors. Task-number: QTBUG-39041 Change-Id: If59627b83d50351eb225adde63187fc251aa349e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* use the override keyword consistently and correctly (clang-tidy)Shawn Rutledge2018-02-271-1/+1
| | | | | Change-Id: If9e28d143f8cba3df3c757476b4f2265e2eb8b2a Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Remove double indirection between QJSEngine and QV4::ExecutionEngineUlf Hermann2018-02-021-5/+2
| | | | | | | | As QJSEngine's handle() method is internal, we can redefine it to return a pointer to an ExecutionEngine. That makes many things easier. Change-Id: Ie3df99e0bad5f00ad4fe73182896cd135fa82994 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Move qqmldebug.h includes into the right placesUlf Hermann2017-11-091-0/+2
| | | | | | | | We want then in qjsengine.h and qquickwindow.h, as that are the base classes relevant to QML debugging and profiling. Change-Id: Ic4b19b492cd1ec67649f40e2b7e01137aae74baf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Replace Q_NULLPTR with nullptrKevin Funk2017-09-271-1/+1
| | | | | Change-Id: I0c01862dbb475494c84e39c695cb563df8cbcfa8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add QJSEngine::newQMetaObjectCorentin Jabot2016-06-051-0/+8
| | | | | | | | | | | | | QJSEngine::newQMetaObject let us expose QMetaObject to the QJSEngine, allowing to construct QObjects instance from javascript. Additionally, enums values are exposed as property of the QMetaObject wrapper. (The engine takes ownership of the created objects) Change-Id: I5428d4b7061cceacfa89f51e703dce3379b2c329 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-03-071-1/+1
|\ | | | | | | Change-Id: Icfa1d61fcc286c3418d4a625de11d2191336fa60
| * Make public headers compile with -Wzero-as-null-pointer-constantMarc Mutz2016-03-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | ... or equivalent. QtBase 5.6 headers already compile that way, so let the other modules follow suit. Task-number: QTBUG-45291 Change-Id: Ied526fb2d7adc3a68946d6843a6bd6f475ebf864 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-191-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: Ic36f1a0a1436fe6ac6eeca8c2375a79857e9cb12 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Add extension API to QJSEngineMitch Curtis2015-09-251-1/+15
| | | | | | | | | | | | | | | | | | | | | | 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>
* Update copyright headersJani Heikkinen2015-02-121-7/+7
| | | | | | | | | 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>
* Add ability to retrieve QJSEngine for a given QObjectSimon Hausmann2015-01-121-0/+2
| | | | | | | | [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>
* Update license headers and add new licensesJani Heikkinen2014-08-251-19/+11
| | | | | | | | | - 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>
* Add support for translations in pure QJSEngine based environmentsSimon Hausmann2014-06-131-0/+2
| | | | | | | | | | | 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>
* Move the JS Api into it's own folderLars Knoll2013-08-081-0/+138
Change-Id: I7ef371ff929387097862121b73a7a5863b51ccf1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>