aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsapi
Commit message (Collapse)AuthorAgeFilesLines
* Doc: Fix broken linksSze Howe Koh2013-12-301-2/+0
| | | | | Change-Id: I4c4577edde96978a986606bf30fbb925f871bd42 Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
* Encapsulate the current context and fix it's usageLars Knoll2013-12-043-16/+16
| | | | | | | | | | | 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>
* Fixup the implementation mess for QJSValue(QString)Lars Knoll2013-12-043-10/+111
| | | | | | | | | | | | | | | Until now we were using a QV4::String without engine to represent this case. But this leads to lots of quirks, where we ended up trying to access the engine (or the internalclass/vtable) of this string anyway. Now just represent it by using an QString in QJSValuePrivate, and use an empty value to represent it. This adds a little bit of code to QJSValue and QJSEngine, but is more stable and maintainable in the longer term. Change-Id: I3358165ee64e788274225743a95dfb13346225cc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix various compiler warnings in order to remove warn_off in the near futureErik Verbruggen2013-11-041-5/+6
| | | | | Change-Id: Ic0492fbe31a1e134674bc6c20381f735dd6d5b7a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Correctly catch exceptions in the API methodsLars Knoll2013-10-292-57/+47
| | | | | | | | Replace all C++ try/catch statements with engine->hasException checks. Change-Id: I7c04e02664ec6b4d256478c6e18f6b20ae4f7bc1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Properly propagate parse errorsLars Knoll2013-10-291-7/+7
| | | | | | | | Replace all try/catch statements used when parsing with checks for engine->hasException. Change-Id: I4493cb600d5a3eb095c2003bb88bd031403e47c9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Touch up QJSEngine::evaluate documentation.Mitch Curtis2013-10-141-4/+4
| | | | | Change-Id: I350ad1ccb8a6cf522787e4579292fa4ba1c8e043 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup exception handlingSimon Hausmann2013-10-033-3/+0
| | | | | | | | | | The code in the Exception class operates entirely on the engine's data, so move it into ExecutionEngine instead. This eliminates the need for a QV4::Exception class and catches and old code that tries to still do catch (Exception &) instead of catch (...) Change-Id: Ie608bec6af652038aca6c9423c225a4d7eb13b39 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change exception handling APISimon Hausmann2013-10-023-32/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix ObjectIterator API to be GC safeLars Knoll2013-10-022-16/+55
| | | | | Change-Id: I3a9c48d53d8dbadcb9b32c00fcef1f89447c4b8c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove some uses of raw Object pointersLars Knoll2013-09-301-4/+8
| | | | | Change-Id: I7c715f33d197ebbf6f0c00040099b27ed7221d42 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove more direct QV4::Value usageLars Knoll2013-09-282-2/+2
| | | | | | | | Remove Value::fromString(String *), and make Encode safe against encoding raw Managed * pointers. Change-Id: Ibca4668e1cbeaf85c78169d14386281659d33ef6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Make Encode not inherit from ValueLars Knoll2013-09-281-6/+6
| | | | | | | | This allows Encoding of Returned<> pointers, and directly assigning them to a Value. Change-Id: I0f22b9921ca5712538f22029fa5449242649e01c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move more API over to use ValueRefLars Knoll2013-09-262-3/+5
| | | | | Change-Id: I372f1f3e3e78d45912a913f437e622e0acfc9646 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix Persistent/WeakValue APILars Knoll2013-09-263-19/+25
| | | | | | | Don't use unprotected Values in the API anymore. Change-Id: I8851628227fca374de24701bc8ee0908b5ae3923 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert the remaining vtable methods to be GC safeLars Knoll2013-09-221-3/+4
| | | | | Change-Id: I679d1833609c41d71e8436ec0ba8a4624f0c4dd0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* convert Managed::put() API to be GC safeLars Knoll2013-09-221-1/+1
| | | | | Change-Id: I09198ce372fa545372db389fac26828d21ad5731 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use a StringRef for Managed::get()Lars Knoll2013-09-222-6/+8
| | | | | | | | | 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>
* Use StringRef for most methods in ObjectLars Knoll2013-09-221-6/+14
| | | | | Change-Id: I8e2dad0e9e34c5a549952bc0765cd57f6aa8aadf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Don't use Value::emptyValue() anymore.Lars Knoll2013-09-222-3/+2
| | | | | | | | | | 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>
* Further work towards an exact GCLars Knoll2013-09-221-1/+1
| | | | | | | | | | | Add some more convenience in the helper classes in qscopedvalue_p.h Make accesses to CallData safer, and change ExecutionEngine::newObject() to return a safe pointer. Change-Id: I980909754ce9681cf6faa1355bab3a1e5d6dd186 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert more methods to return a Returned<>Lars Knoll2013-09-181-2/+3
| | | | | Change-Id: If294c9c4f574824c308b63a11da1337226180105 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Make QJSValue::prototype() gc safeLars Knoll2013-09-181-3/+8
| | | | | Change-Id: Ia93af291f97fd2b6473267e95520bc0759034029 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert most remaining return values from Value to ReturnedValueLars Knoll2013-09-183-18/+30
| | | | | Change-Id: If8b0c3b91be50678693868c10fefc3678008834d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert more methods to use ReturnedValueLars Knoll2013-09-182-9/+13
| | | | | | | Change Exception.value() and a few other places. Change-Id: I53ce17e5656e260138b1ac7f6d467e4636c0a0b9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use a ReturnedValue for Managed::getIndexed()Lars Knoll2013-09-181-1/+1
| | | | | Change-Id: I0371ed21c4ef99564d3ffa1082dd109e890a78bf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use ReturnedValue for Managed::get().Lars Knoll2013-09-182-5/+15
| | | | | Change-Id: Ia8f35d227b69d32e1f6a041283abbbd083aa34ca Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use ReturnedValue for Managed::construct()Lars Knoll2013-09-181-1/+1
| | | | | Change-Id: I9e702d60c4e1b7ba19a699ff7a8d53876d6cd5f7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename QV4::ValueScope to QV4::ScopeLars Knoll2013-09-181-3/+3
| | | | | | | | 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-3/+4
| | | | | | | | 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/+4
| | | | | Change-Id: Ief2d75e9789dd367c603d90dc0fe5316a0d055e3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix wrong return typeAlex Blasche2013-09-171-1/+1
| | | | | | | | | | | | | | Android g++4.8 errors out with jsapi/qjsvalueiterator.cpp: In member function 'QString QJSValueIterator::name() const': jsapi/qjsvalueiterator.cpp:155:16: error: converting 'false' to pointer type for argument 1 of 'QString::QString(const char*)' [-Werror=conversion-null] return false; Change-Id: I589418e34c7e1ae72f2bf547067ea8e5944119b8 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use a ReturnedValue when converting to String or ObjectLars Knoll2013-09-121-1/+1
| | | | | | | | 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>
* Continue conversion to using scoped valuesLars Knoll2013-09-111-2/+2
| | | | | | | | | | | This converts all methods in qv4runtime_p.h to not use raw values in arguments anymore. The conversion of return values will be done in a separate commit. Change-Id: Ie6e8f3bed459d09cb831f7f87920b7eada161502 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move CallData onto the JS stackLars Knoll2013-09-111-11/+12
| | | | | Change-Id: I22e853acfd2da337344b581bb0412c5f9930c510 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Merge branch 'stable' into devSergio Ahumada2013-09-061-3/+3
| | | | | | | | | Conflicts: src/qml/debugger/qv8debugservice.cpp src/qml/qml/v8/qv8engine.cpp tests/auto/quick/qquickitem/qquickitem.pro Change-Id: Ic4a1dcdd8b8a84155d2f2abefdf1da5c3a56af31
* Move prototype pointer into QV4::InternalClassLars Knoll2013-09-021-12/+5
| | | | | | | | | | | | | The prototype is actually the same for most objects. By moving it into the internal class, we can save 8 bytes per object, as well as allowing for some future optimizations. Also fix a bug in the implementation of the Error prototype objects. Change-Id: I4d4b641055f644a9b088f27be34bfdb0446279b7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* change calling convention for JS function callsLars Knoll2013-09-021-9/+11
| | | | | | | | | | | | 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>
* Export QJSValuePrivateAlex Blasche2013-08-081-1/+2
| | | | | | | | Declarative components of QtLocation require it. Change-Id: Ie520d3131718c15c0908c784d9486a5674570a54 Reviewed-by: 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-0810-0/+2304
Change-Id: I7ef371ff929387097862121b73a7a5863b51ccf1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>