aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmljavascriptexpression.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Convert ExecutionContext to new storage schemeLars Knoll2014-07-221-1/+1
| | | | | Change-Id: I9fcc13da5360f37cef3149b114ed9263b9b74281 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix some documentation errors.Friedemann Kleint2014-03-241-1/+0
| | | | | Change-Id: I5d4b3e26742202c4b634d0001fd3658c7263c50a Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-02-181-55/+58
|\ | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4functionobject.cpp src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h Change-Id: Id164f6c3b45501aa466908659ec4e3b957323753
| * Fix crash when the currently running binding is deleted.Michael Brasser2014-02-151-55/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stop capturing properties once the expression is deleted. The following example triggers invalid read/write memcheck errors when trying to capture propFromParentScope: Item { property real testProp: { if (x == 0) testProp = 7 return propFromParentScope } } Which can eventually lead to a crash. Task-number: QTBUG-36798 Change-Id: I233de2c81498884df0563e8ce155752845aafcfb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Rename some filesLars Knoll2014-01-311-1/+1
|/ | | | | | | | | | | | Rename qv4value_def_p.h -> qv4value_p.h and qv4value_p.h to qv4value_inl_p.h. It makes more sense to have the class definition in the file that is named after the class and move the inline methods into a _inl file. Doing this now, as I expect we'll be needing a few more _inl files soon. Change-Id: Ib59e9380e9e976254c6b4369574157f39b1b5f51 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Encapsulate the current context and fix it's usageLars Knoll2013-12-041-3/+3
| | | | | | | | | | | Encapsulate accesses to the current context, and rework the way we push and pop this context from the context stack. Largely a cleanup, but simplifies the code in the long term Change-Id: I409e378490d0ab027be6a4c01a4031b2ea35c51d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Ensure the this object is set correctly to the scope object in binding ↵Simon Hausmann2013-11-051-2/+2
| | | | | | | | | expressions This is a regression from 5.1 Change-Id: I61ad372a02d937c195dad74bd9fcb8fd4410d97a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix various compiler warnings in order to remove warn_off in the near futureErik Verbruggen2013-11-041-3/+2
| | | | | Change-Id: Ic0492fbe31a1e134674bc6c20381f735dd6d5b7a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix the remaining try/catch statements in C++Lars Knoll2013-10-291-15/+14
| | | | | Change-Id: I2421dc48fb271b66bd476fb16a32a88fcc4c5177 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Properly propagate parse errorsLars Knoll2013-10-291-9/+9
| | | | | | | | Replace all try/catch statements used when parsing with checks for engine->hasException. Change-Id: I4493cb600d5a3eb095c2003bb88bd031403e47c9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove internal method from public APILars Knoll2013-10-191-3/+3
| | | | | | | | QQmlError is public API and shouldn't expose an internal method. Change-Id: I7caf06af9340fefec5c96103395fe74acbf19497 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Change exception handling APISimon Hausmann2013-10-021-51/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the exception handling API in the engine slightly, encapsulating any use of direct throw statements and catch blocks with concrete types. In the future we need to be able to change the way these are implemented, in order to ensure that the correct stack unwinding code is triggered for throw and re-throw. This patch separates the C++ exception object thrown from the V4 exception (that includes value, throwing context pointer) and stores the latter inside the engine. In order for that to compile, ExecutionEngine::StackTrace and StackFrame had to move into the QV4 namespace directly. In addition the syntax for catching exceptions changes from try { ... } catch (QV4::Exception &ex) { ex.accept(context); QV4::ScopedValue exceptionValue(scope, ex.value()); } to try { ... } catch (...) { QV4::ScopedValue exception(scope, context->catchException()); } Context::catchException() checks if there's a "current" exception in the engine, and if not assumes that we caught an unrelated exception and consequently re-throws. partiallyUnwind() is also gone and replaced with rethrowException(), in order to encapsulate the re-throw. Lastly, in the future nesting try/catch blocks isn't going to be possible due to limitations in the common C++ ABI with regards to foreign exceptions. Change-Id: Ic81c75b057a2147e3176d8e0b4d326c14278b47d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove most uses of Value from qml/qmlLars Knoll2013-09-301-9/+11
| | | | | Change-Id: I409a8505a9e01f86d777bc694d24516d1c8f0c4d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Value::fromBool, ... to a new Primitive classLars Knoll2013-09-281-2/+2
| | | | | | | | This will simplify finding the remaining direct usages of QV4::Value that need fixing. Change-Id: I223099727436d5748027c84c53d9dfc4028e38ed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix Persistent/WeakValue APILars Knoll2013-09-261-9/+9
| | | | | | | Don't use unprotected Values in the API anymore. Change-Id: I8851628227fca374de24701bc8ee0908b5ae3923 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use a StringRef for Managed::get()Lars Knoll2013-09-221-1/+2
| | | | | | | | | also store "toString" and "valueOf" as identifiers in the engine and fix two places where we compared strings the wrong way. Change-Id: I70612221e72d43ed0e3c496e4209681bf254cded Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Don't use Value::emptyValue() anymore.Lars Knoll2013-09-221-3/+3
| | | | | | | | | | emptyValue is special and reserved for usage inside the engine to mark missing values. The main to use cases are when converting property descriptors, and to mark holes in array data. Change-Id: I0ed357e65102b1041bf9a878e6e9a4ae0657523b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert most remaining return values from Value to ReturnedValueLars Knoll2013-09-181-19/+17
| | | | | Change-Id: If8b0c3b91be50678693868c10fefc3678008834d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert more methods to use ReturnedValueLars Knoll2013-09-181-15/+22
| | | | | | | Change Exception.value() and a few other places. Change-Id: I53ce17e5656e260138b1ac7f6d467e4636c0a0b9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use ReturnedValue for Managed::get().Lars Knoll2013-09-181-1/+1
| | | | | Change-Id: Ia8f35d227b69d32e1f6a041283abbbd083aa34ca Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename QV4::ValueScope to QV4::ScopeLars Knoll2013-09-181-1/+1
| | | | | | | | The class is going to be used all over the place, so let's give it a short name :) Change-Id: If61543cb2c885e7fbb95c8fc4d0e870097c352ed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Require a ValueScope for ScopedCallData as wellLars Knoll2013-09-181-1/+1
| | | | | | | | This brings things more in line with ScopedValue, and also simplifies cleanup of Scoped values. Change-Id: If5f1466b4e13c629d56c1e7c638937f61ba48f77 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use a ReturnedValue for Managed::call()Lars Knoll2013-09-181-2/+3
| | | | | Change-Id: Ief2d75e9789dd367c603d90dc0fe5316a0d055e3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use a ReturnedValue when converting to String or ObjectLars Knoll2013-09-121-3/+3
| | | | | | | | Also rename Value::toQString() to Value::toQStringNoThrow(), and add a throwing toQString() method for JS use. Change-Id: I821b33fc61abb7d08839df965fd337685f61a545 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move CallData onto the JS stackLars Knoll2013-09-111-7/+6
| | | | | Change-Id: I22e853acfd2da337344b581bb0412c5f9930c510 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* change calling convention for JS function callsLars Knoll2013-09-021-2/+7
| | | | | | | | | | | | This allows faster pass through of the data if we have nested calls. Also make sure we always reserve at least QV4::Global::ReservedArgumentCount Values on the stack to avoid stack corruption. Change-Id: I42976460f1ef11a333d4adda70fba8daac66acf3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove QV4::DiagnosticMessageLars Knoll2013-08-201-16/+10
| | | | | | | | | | QQmlError provides the same functionality, so let's rather use that where required. Remove the dependency of codegen onto the ExecutionContext that was only required for error handling. Change-Id: Ib0b61c0e138f89ff989c32996c93c339e4b62223 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into ↵Simon Hausmann2013-06-241-0/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | wip/v4 Conflicts: src/imports/qtquick2/plugins.qmltypes src/qml/debugger/qv8debugservice.cpp src/qml/qml/qml.pri src/qml/qml/qqmlcompiler.cpp src/qml/qml/qqmlcomponent.cpp src/qml/qml/qqmlcontext.cpp src/qml/qml/qqmldata_p.h src/qml/qml/qqmlengine_p.h src/qml/qml/qqmljavascriptexpression.cpp src/qml/qml/qqmlxmlhttprequest.cpp src/qml/qml/v4/qv4bindings.cpp src/qml/qml/v4/qv4irbuilder.cpp src/qml/qml/v4/qv4jsonobject_p.h src/qml/qml/v8/qqmlbuiltinfunctions.cpp src/qml/qml/v8/qv8bindings.cpp src/qml/qml/v8/qv8contextwrapper.cpp src/qml/qml/v8/qv8listwrapper.cpp src/qml/qml/v8/qv8qobjectwrapper.cpp src/qml/qml/v8/qv8qobjectwrapper_p.h src/qml/qml/v8/qv8sequencewrapper_p_p.h src/qml/qml/v8/qv8typewrapper.cpp src/qml/qml/v8/qv8valuetypewrapper.cpp src/qml/types/qqmldelegatemodel.cpp src/quick/items/context2d/qquickcanvasitem.cpp src/quick/items/context2d/qquickcontext2d.cpp sync.profile tests/auto/qml/qjsengine/tst_qjsengine.cpp tests/benchmarks/qml/animation/animation.pro tools/qmlprofiler/qmlprofiler.pro Change-Id: I18a76b8a81d87523247fa03a44ca334b1a2360c9
| * QQmlError.object now holds the scope object that caused exceptions.Mark Visser2013-05-081-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | Exception errors sent via QQmlEngine::warnings lacked a pointer to the containing scope. I added an object property to QQmlError, and the necessary code to fill it with the QObject* scope from binding exception callbacks. Task-number: QTBUG-30930 Change-Id: I2a987e8cefc3a2a474d338893e9ebcb77c167adf Reviewed-by: Kai Koehne <kai.koehne@digia.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* | Remove the context argument from Managed::callLars Knoll2013-06-221-1/+1
| | | | | | | | | | Change-Id: I0895f9a94af47c8aab1dc93579921737e9516f7d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Fix two more errors in the worker script auto testLars Knoll2013-06-181-1/+2
| | | | | | | | | | Change-Id: Ib1359a985efae18cd4fc8344b81092af57f1a9d4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Fix syntax error propagationSimon Hausmann2013-06-131-7/+18
| | | | | | | | | | | | | | | | | | For syntax errors we use the DiagnosticMessage type in qv4context.cpp, that contains detailed information about the error. We must catch that error correctly in QQmlVME::run and report it to the engine. Change-Id: I8f53c7db8dbdc6afa72396f3c25537690a6f5841 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Move QV8QObjectWrapper::newQObject into QV4::QObjectWrapperSimon Hausmann2013-06-051-1/+1
| | | | | | | | | | | | | | | | ...where it is just called wrap(), because it doesn't always create a new JS wrapper for the QObject. Change-Id: Ieed0fc97174eb51cd04df0149e715c234a5822bd Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix uninitialized return value for QQmlJavaScriptExpression::evaluateSimon Hausmann2013-06-021-1/+1
| | | | | | | | | | | | | | | | | | In case of an exception, we'd return an uninitialized value. (visible when running tst_qqmlecmascript in valgrind) Change-Id: I2c95a112b09ba527e61088904fa7daff003be05d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Cleanup the context wrapper codeLars Knoll2013-05-301-2/+3
| | | | | | | | | | | | | | | | Remove the QV8ContextWrapper class and move the code out of the v8 directory. Change-Id: I00c02f7310a3e43bd105c5bc5af034ce652cfd49 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Remove some leftovers from the v8bindingsLars Knoll2013-05-291-14/+0
| | | | | | | | | | | | | | | | The shared context concept was only used there, so remove code that was referring to it. Change-Id: I5ae56049a83818c898ef1cc4e68a5333a9374656 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Fix file and line number reporting of QML/JS errorsSimon Hausmann2013-05-271-7/+15
| | | | | | | | | | | | | | | | | | | | | | * Replace QUrl with QString in V4 for the source location (we don't need URL parsing) * Replace line number and file in QV4::Exception with the information we retrieve from the stack trace of the exception. Fixes about five tst_qqmlecmascript tests that relied on correct file/line number information Change-Id: I2a3daa72be6c5587fd965211ea8f6fb77142e7ee Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Small cleanupLars Knoll2013-05-261-9/+0
| | | | | | | | | | | | | | | | | | We don't do rewriting for bindings anymore. Remove a method overload that's not really needed anymore. Change-Id: I9d57d30dce4848cb06c88c3f042ccf30e6d41aab Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Get rid of Get/SetHiddenValue in the v8 APILars Knoll2013-05-241-2/+2
| | | | | | | | | | | | | | | | | | | | It was only used to mark an object as something to be used as a binding. Simply use one of the free bits in QV4::Managed for that. Also changed a bit more code over from v8 to v4. Change-Id: I6e787e611041e058fe109df1d7a13598655f8eba Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Add support for direct binding evaluation in QV4ScriptLars Knoll2013-05-241-2/+35
| | | | | | | | | | | | | | | | | | This way there is no need to rewrite the binding expressions anymore, instead we can directly compile them into a binding function. Change-Id: I91a0c540d066976e363590fe9ccde6a81ee92b1d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Replace usage of v8::Script and qmlModeCompile with QV4::ScriptLars Knoll2013-05-221-34/+11
| | | | | | | | | | Change-Id: I114a0b7faed39be313cde5617a0ce4a06dece7e2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Get rid of v8::TryCatch and v8::MessageLars Knoll2013-05-211-24/+0
| | | | | | | | | | | | | | They are now unused, so let's remove them from the v8 API. Change-Id: I9c1b39632cb88785ae6fdda671580e0426ae97ba Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Convert the remaining TryCatch statements to use QV4::ExceptionLars Knoll2013-05-211-44/+33
| | | | | | | | | | | | | | | | v8::Script::Run doesn't catch the exception anymore. Instead we handle this on the calling side, removing all needs for v8::TryCatch. Change-Id: I946269a6734f50c728c4f153c00cd19db48f1a6a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Fix return value for QQmlJavascriptExpression::evaluateLars Knoll2013-05-211-2/+2
| | | | | | | | | | Change-Id: Idf95ee51b7d50682476371c7f49537930fdf96f1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Cleanup QQmlDelayedErrorLars Knoll2013-05-211-20/+18
| | | | | | | | | | | | | | | | Remove dependency onto v8::Message and simplify conversion from QV4::Exception to QQmlError. Change-Id: Icfdfd7a2749210b2df9fda6cd5de94114b8adcfa Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Move QQmlJavascriptExression::evaluate over to v4Lars Knoll2013-05-211-21/+28
| | | | | | | | | | Change-Id: Ic4093dc5413f43af55a74a0e0f8c316ac1c6d974 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Convert qqmljavascriptexpression to use QV4::PersistentValueLars Knoll2013-05-081-5/+4
| | | | | | | | | | Change-Id: Idd704b55be61dd78c59fffdf966fc8497af852d6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Change some v8::Persistent to QV4::PersistentValueLars Knoll2013-05-071-12/+14
| | | | | | | | | | Change-Id: I2c4e98cf7e778de9aafabdbd68e6682106343d12 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Get rid of v8::LocalLars Knoll2013-05-061-18/+18
| | | | | | | | | | | | | | | | | | The class was doing exactly the same thing as v8::Handle in our implementation. Removing it cleans up quite a bit of code. Change-Id: I37a3dcdef062fc388751e9ef0a158b5926ba2efb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>