summaryrefslogtreecommitdiffstats
path: root/src/script/api
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-02-057-33/+33
|\ | | | | | | Change-Id: Ib100dac4eccddf7a72382b7d1ead7d504a572347
| * Merge branch 'release' into stableSergio Ahumada2013-01-311-1/+1
| |\ | | | | | | | | | Change-Id: If3a1efe3888b872702d75e25d1943ff79d57e9c6
| | * Fix QtScript crash on 64bit with JIT.v5.0.1Friedemann Kleint2013-01-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During back-trace generation we calculate a code offset towards JIT generated code. Using JITCode::offsetOf() will crash/assert if the offset doesn't fit into 32 bits, because the generated code can only encode relative offsets in 32-bits and not 64-bits. However in this context - backtrace generation - we just want to calculate the offset and are not interested in this architectural limitation, therefore we can just calculate the offset ourselves using the fully sized uintptr_t. Initial-patch-by: [email protected] Task-number: QTCREATORBUG-8629 Task-number: QTBUG-23463 Change-Id: I0efadd5ed20855409122e1fcc9236fdfbc4f62a4 Reviewed-by: Olivier Goffart <[email protected]>
| * | Doc: Fix module name formatSze Howe Koh2013-01-266-32/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow the conventions at http://qt-project.org/wiki/Spelling_Module_Names_in_Qt_Documentation QtScript -> Qt Script QtScriptTools -> Qt Script Tools Change-Id: Icf6b2ea3829247475f8902334b615f9a9206cc51 Reviewed-by: Jerome Pasion <[email protected]>
* | | Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-2814-56/+0
|/ / | | | | | | | | | | | | | | | | The macro was made empty in qtbase/ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: I7fed9ff47fd84f6cf2b418658a1ee3e7130539ac Reviewed-by: Jędrzej Nowacki <[email protected]>
* / Update copyright year in Digia's license headersSergio Ahumada2013-01-1032-32/+32
|/ | | | | | Change-Id: Ic4a2739c8caf2eac95e4a72d8d38cfb912d5fe2b Reviewed-by: Akseli Salovaara <[email protected]> Reviewed-by: Sergio Ahumada <[email protected]>
* Doc: Replace outdated macroChristian Stenger2012-12-071-2/+2
| | | | | Change-Id: I7750e9af3eee8cee5be202094acd1d3efc4b52b0 Reviewed-by: Jerome Pasion <[email protected]>
* Fix header guardLars Knoll2012-09-251-0/+1
| | | | | Change-Id: I22bba8d2d175d787913d1e2269ad2ca8ff762043 Reviewed-by: Simon Hausmann <[email protected]>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-2433-87/+87
| | | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: Id0b72b8c895b0eab04a740bf83859c9b646dd911 Reviewed-by: Janne Anttila <[email protected]> Reviewed-by: Sergio Ahumada <[email protected]> Reviewed-by: Lars Knoll <[email protected]>
* Capture full backtrace when a native function calls back into JSKent Hansen2012-08-221-2/+10
| | | | | | | | | | | | | | | | | | | | | | Commit df0ec196031d33850324dc5eeed2d71f61413885 assumed that JSC's Interpreter::throwException function is called exactly once when an exception occurs. That's wrong. If there is a native call inbetween two JS calls on the stack, the call stack will be unwound to the point of the native call frame, and throwException will return. After the native (C) call frame has been unwound, throwException will be called again to unwind remaining JS call frames, and so on. This was causing QtScript to discard the backtrace belonging to the inner-most JS frames; the backtrace would be regenerated from a partially unwound state. Fix this by ignoring subsequent calls to the uncaughtException() callback once a backtrace has been captured; the backtrace is already cleared before each evaluation is started. Task-number: QTBUG-26889 Change-Id: I03e1d60fbac5e592cff1dd5ef70f397cf94454ae Reviewed-by: Simon Hausmann <[email protected]>
* Remove the use of the QWidgetStar metatypeid.Stephen Kelly2012-08-151-9/+5
| | | | | | | | | | It is to be removed, and is obsoleted by QMetaType::PointerToQObject. By using QMetaType::PointerToQObject, we also gain the feature that all pointers to types derived from QObject return true for QScriptValue::isQObject(). Change-Id: I18392b5b6cde3a45d060c37612d987a5cf8e8f18 Reviewed-by: Olivier Goffart <[email protected]>
* Make QScriptEngine::uncaughtExceptionBacktrace() work againKent Hansen2012-08-154-21/+80
| | | | | | | | | | | This function has been broken since Qt 4.6 (when the JavaScriptCore- based back-end was introduced). Fix it by introducing a callback in JSC that allows us to capture the stack when an uncaught exception occurs. Task-number: QTBUG-6139 Change-Id: I4a829323c9fb0c8b2f16a2e5d6f0aeb13cc32561 Reviewed-by: Olivier Goffart <[email protected]>
* Add default conversion for types long and ulongKent Hansen2012-08-141-0/+22
| | | | | | | | | | | | | | Such conversion is not guaranteed to be lossless on all platforms, but it's still reasonable to support these types by default. JSC::JSValue already had constructors for them. The type matching / overload resolution in the QObject binding already handled long and ulong, but the value conversion itself was missing, for some reason. Task-number: QTBUG-2124 Change-Id: I14ff29a8e949403234b7659c0aca8b48bcdbda0e Reviewed-by: Olivier Goffart <[email protected]>
* Fix GC issues related to QObject connections and ownershipKent Hansen2012-08-092-8/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue 1: Even if a sender object was only weakly referenced, the connection's slot function would still get marked. If the slot was a closure, its scope could hold a reference to the sender object, so by marking the closure, the sender would get marked, too - even if there were no other references to the closure outside of the QObject connection structure. This would cause the sender object to stay alive, rather than being garbage-collected (i.e., it leaked). Issue 2: It's possible that a closure used as a slot in a connection for one QObject holds the only reference to another QObject that has connections of its own. In that case, if the first object is explicitly referenced, the second object (and its connections) should get marked. But depending on the order in which the connections were marked, the second object might get treated incorrectly. This commit solves both issues by introducing an iterative scheme for marking connections. The first pass marks only connections whose sender object is referenced elsewhere in the JS environment. The second pass marks connections whose sender object is referenced by slots of the connections marked in the first pass. And so on, until no more connections should be marked. At that point, any remaining unmarked connections are effectively dead (belonging to QObjects that can be reclaimed by the GC). Task-number: QTBUG-26590 Change-Id: I50aa66f7fe407a6827b6f2a12e027275a2fb4655 Reviewed-by: Simon Hausmann <[email protected]>
* Add qtscriptglobal.h for the qtscript.git module EXPORT macrosThiago Macieira2012-08-099-1/+79
| | | | | | | | No library other than the core libraries should depend on their export macros being in qglobal.h. Change-Id: I6ded70813f6296ca5aa1d7d3cdb38503a5538424 Reviewed-by: Kent Hansen <[email protected]>
* QScriptEngine::pushContext(): Don't inherit parent context's scopeKent Hansen2012-08-082-8/+3
| | | | | | | | | | | | | | This was a regression introduced in Qt 4.6 (JavaScriptCore-based backend). pushContext() should always create a context with a "clean" scope (only the Global Object and the context's own activation object should be in the scope chain). The scope chain API is internal, but the wrong behavior could still be observed e.g. through QScriptEngine::evaluate(). Task-number: QTBUG-18188 Change-Id: I138dabc665d7275fb85d3b5e1b473d56096a989e Reviewed-by: Olivier Goffart <[email protected]>
* Fix QScriptContextInfo::functionMetaIndex() for overloaded slotsKent Hansen2012-07-131-2/+1
| | | | | | | | | | | | | | | | | | This was a regression against the pre-JavaScriptCore implementation, where we used to store the selected method index as an internal member of the QScriptContext(Private). But in the JSC-based implementation, QScriptContext is implemented as a pointer to a JSC::CallFrame, and there are no unused fields in CallFrame where the method index can be stashed. Refactor the Qt method call logic so that the method selection is separate from the actual processing of the target method. This way, QScriptContextInfo can compute the method index the same way that the actual method call did. Task-number: QTBUG-6133 Change-Id: I619fa8b91542d0b6ab5a44b00266cc0705c95823 Reviewed-by: Olivier Goffart <[email protected]>
* Ensure QObject wrappers are garbage-collected if appropriateKent Hansen2012-07-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Address the "###" comment. When QScriptEngine::newQObject() is called with the option PreferExistingWrapperObject, the resulting wrapper object is cached by the engine, in case it will be needed later (e.g., by a subsequent newQObject() call for the same QObject, with the same wrap options). But if a QObject wrapper object is only referenced by the QtScript internals (i.e., not reachable from the JSC stack/heap, or kept in a QScriptValue), the wrapper should not be kept alive if the ownership is ScriptOwnership, or if the ownership is AutoOwnership and the C++ object has no parent. If the wrapper is marked in that case, it won't get collected, and hence the C++ object will be kept alive, too. In practice, QtScript appears to leak memory (the objects will only be destroyed when the engine is destroyed). Our copy of JSC doesn't have a concept of weak references; the ClientData callback in the JSC markRoots() function (which causes QScriptEnginePrivate::mark() to be called) was moved to the end. This enables the wrapper and connection marking logic to determine whether a wrapper can be safely discarded (if it hasn't been marked by JSC by this point, it must be a weak reference). Task-number: QTBUG-21993 Change-Id: I61f6aafc91f080b80d3f5859148e645b80d9b653 Reviewed-by: Olivier Goffart <[email protected]>
* Doc: Modularize QtScript documentation.Casper van Donderen2012-06-057-43/+43
| | | | | Change-Id: I042d9bafe4f48a8cd23306f0864b6872776d0153 Reviewed-by: Kent Hansen <[email protected]>
* Fix crash when converting invalid JSValue to stringKent Hansen2012-06-011-0/+2
| | | | | | | | JSC::JSValue::toString() expects that the input is valid. Task-number: QTBUG-21896 Change-Id: I3199fcba94be5426cb3d193b57d16176daae83a0 Reviewed-by: Olivier Goffart <[email protected]>
* Fix crash when accessing QObject properties through activation objectKent Hansen2012-06-011-0/+4
| | | | | | | | | | | | | | | | Since objects in the scope chain have to be JSActivationObjects, QScriptContext::setActivationObject() creates a proxy object that should delegate access to the actual object. This case was not handled in the toQObject() conversion function, so for activation property access through evaluation (where the this-object would be the proxy object, not the actual QObject), the this-object conversion to QObject would fail, and the assert "this-object must be a QObject" was triggered. Task-number: QTBUG-21760 Change-Id: I40e868d9717ec76e0df18d5848c6ad99546ba34f Reviewed-by: Olivier Goffart <[email protected]>
* Deprecate the Encoding argument of qsTranslateLars Knoll2012-05-211-19/+19
| | | | | | | | | | This is the same as change 4822a821facbbf834c6aab5a8a7da2b3e43f09f7 in qtdeclarative. We always assume the js source code is Utf8 encoded, as also on the C++ side. Change-Id: I4f49484241718dfc4a2bb39a674b54df46aa8c8d Reviewed-by: Kent Hansen <[email protected]> Reviewed-by: Friedemann Kleint <[email protected]>
* Simplify QVariant::convert and QVariant::canConvert calls.Jędrzej Nowacki2012-05-211-2/+2
| | | | | | | QVariant::Type casts are not necessary in Qt5. Change-Id: I43833e869379db8937839612dfb6162f878870cb Reviewed-by: Kent Hansen <[email protected]>
* Change uses of {to,from}Ascii to {to,from}Latin1Thiago Macieira2012-05-031-2/+2
| | | | | | | | | | This operation should be a no-op anyway, since at this point in time, the fromAscii and toAscii functions simply call their fromLatin1 and toLatin1 counterparts. Task-number: QTBUG-21872 Change-Id: I4f44512856ea99112d8eb6d341d6058c1fc439dc Reviewed-by: Kent Hansen <[email protected]>
* Fix some deprecation warnings in QtScript.Friedemann Kleint2012-04-302-5/+9
| | | | | Change-Id: I98d4826fcc2e3687d45edfccca956891ca0466cf Reviewed-by: Thiago Macieira <[email protected]>
* Add missing case in QScriptEnginePrivate::createJędrzej Nowacki2012-04-171-0/+1
| | | | | | | | | Currently QMetaType::UnknownType, instead of QMetaType::Void, is used to check if a type id is valid or not. Change-Id: Ib185e3f28ef675c57d9b8b0d2eb4e4f124999131 Reviewed-by: Kent Hansen <[email protected]> Reviewed-by: Stephen Kelly <[email protected]>
* Adapt qtscript to QMetaMethod::signature() renamingKent Hansen2012-04-171-6/+6
| | | | | | | | | | QMetaMethod::methodSignature() should be used instead, and it returns a QByteArray. Change-Id: I81150e238dab7eda26d0466ac407a4f3ba79a7c7 Reviewed-by: Jędrzej Nowacki <[email protected]> Reviewed-by: Olivier Goffart <[email protected]> Reviewed-by: Stephen Kelly <[email protected]>
* Make QScriptValue QObject handling consistent.Stephen Kelly2012-03-061-6/+16
| | | | | | | | | | | The behaviour has been inconsistent since ae85d7c965e7d50404c056a77c73bfe00267fa12 in qtbase which added special handling of QObjects to QVariant. Change-Id: Ie75faa3cc3387cff8894cdba025c93f2cc2ea491 Reviewed-by: Jędrzej Nowacki <[email protected]> Reviewed-by: Olivier Goffart <[email protected]> Reviewed-by: Kent Hansen <[email protected]>
* Fix compilation, use DefaultCodec.Friedemann Kleint2012-03-061-1/+1
| | | | | Change-Id: I0d1036eb75de9fcd2663ec5476d3b13edb2e264e Reviewed-by: Friedemann Kleint <[email protected]>
* Remove the usage of deprecated qdoc macros.Casper van Donderen2012-03-063-35/+35
| | | | | | | | | | QDoc now has support for Doxygen style commands for italics, bold and list items. This change applies that change in QDoc to the actual documentation. Task-number: QTBUG-24578 Change-Id: I7733d18ce1e3459ef618802060d176c9211d3d5f Reviewed-by: Kent Hansen <[email protected]>
* Remove use of QT_ASCII_CAST_WARN_CONSTRUCTOR.Stephen Kelly2012-02-231-2/+2
| | | | | | | Fixes build after I0b4df4c99600cacbaafbf0bc4270cd4978600956 Change-Id: If85e4ee8c2fd43baa24cf8608ad2f81ea112ae7c Reviewed-by: Jędrzej Nowacki <[email protected]>
* Fix link for QObject integration documentation in QScriptEngineTeemu Katajisto2012-02-211-1/+1
| | | | | | | | | Picked from 4.8 commit 3826203f744a2147bebf5f088de0d524156f59fd Task-number: QTBUG-8323 Change-Id: I360f7592cb6a0906ab7bf402963109b7aa1edebe Reviewed-by: Casper van Donderen <[email protected]>
* Use new plugins system in Qt Script.Friedemann Kleint2012-02-171-2/+3
| | | | | Change-Id: Ie28cc00899abaa3f42a0f43ed199e3c14d45df3e Reviewed-by: Lars Knoll <[email protected]>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-3032-32/+32
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I752b02a8155143626d22bd86082177550bd1cfb4 Reviewed-by: Rohan McGovern <[email protected]>
* Update obsolete contact address.Jason McDonald2012-01-2332-64/+64
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I6597406c8041227410e672b86a567e1161a0ab59 Reviewed-by: Rohan McGovern <[email protected]>
* Remove the use of QT_MODULE()Gunnar Sletta2012-01-1913-13/+0
| | | | | Change-Id: Ie234485162d162935e96adec388361b771342c86 Reviewed-by: Lars Knoll <[email protected]>
* Fix JS to QVariant type conversionKent Hansen2012-01-091-2/+2
| | | | | | | | | | | | | | | | | | 1) The special case for LastType (QVariant) should be done before the general conversion, to avoid calling convertValue() with targetType == -1 (which is useless and causes a qWarning). 2) moc is about to be changed to use QMetaType::QVariant instead of QVariant::LastType to represent the QVariant type. But to keep the CI happy in the transition period we have to check for both. The LastType check will be removed once qtbase has been updated. 3) Get rid of the variantFromValue function in qscriptqobject. It was identical to QScriptEnginePrivate::jscValueToVariant. Change-Id: Ie418facc06c6c7308bc60a3ff66b9a78b109d3d3 Reviewed-by: Jędrzej Nowacki <[email protected]> Reviewed-by: Friedemann Kleint <[email protected]>
* Update copyright year in license headers.Jason McDonald2012-01-0932-32/+32
| | | | | Change-Id: I323b788326712d95f6213ab8a68c18cfe28b7c76 Reviewed-by: Rohan McGovern <[email protected]>
* Fix warnings about deprecated assignments of QAtomicInt.Friedemann Kleint2011-10-311-2/+0
| | | | | | | | QScriptContextInfoPrivate inherits QSharedData, no need to assign ref. Change-Id: I36ebf64952517b218a3fa9eac5ce1a794988acaa Reviewed-by: Bradley T. Hughes <[email protected]>
* Use QBasicAtomicInt load() and store() instead of implicit castingBradley T. Hughes2011-10-101-7/+7
| | | | | | | | | The implicit casts will be unavailable in the near future. Change-Id: I7305bed90fdcd50e910b207dc41caa8d34467c54 Reviewed-on: http://codereview.qt-project.org/6352 Sanity-Review: Qt Sanity Bot <[email protected]> Reviewed-by: Lars Knoll <[email protected]>
* Fix translation context for QML files in a QRC.Michael Brasser2011-07-291-1/+6
| | | | | | | | | Task-number: QTBUG-17255 Change-Id: Id4685f2531af1113947c55184870e3b3cd874c32 Reviewed-on: http://codereview.qt.nokia.com/2355 Reviewed-by: Qt Sanity Bot <[email protected]> Reviewed-by: Kent Hansen <[email protected]>
* Replace all QAtomicInt ref variables by QSharedData inheritance.Jedrzej Nowacki2011-07-115-13/+10
| | | | | | | | | | There is no need to do reference counting by hand. QSharedData class provide good encapsulation of reference counter. Change-Id: I2611a51c2fa6673ccca69fe8ff83741ffac06ee9 Reviewed-on: http://codereview.qt.nokia.com/1378 Reviewed-by: Qt Sanity Bot <[email protected]> Reviewed-by: Olivier Goffart <[email protected]>
* Use QAtomicInt instead of QBasicAtomicIntThiago Macieira2011-07-086-9/+6
| | | | | | | | | | | | None of these classes are POD, so they don't need to use the POD version of QAtomicInt. Change-Id: Ic7b134c85c4b314560ae79250e05159ffde74dfe Merge-request: 1 Reviewed-by: Jedrzej Nowacki <[email protected]> Reviewed-on: http://codereview.qt.nokia.com/1377 Reviewed-by: Qt Sanity Bot <[email protected]> Reviewed-by: Nierob <[email protected]>
* Doc: Fixed qdoc warnings.David Boddie2011-05-201-1/+1
|
* Removed some superfluous semicolonsThorbjørn Lindeijer2011-05-101-9/+9
| | | | | Reviewed-by: Kai Koehne (cherry picked from commit 0b877b48dc990ca6bb806be668d60f6ced470de2)
* Initial import from the monolithic Qt.Qt by Nokia2011-04-2733-0/+13379
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12