summaryrefslogtreecommitdiff
path: root/src/script/bridge
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright headersJani Heikkinen2015-02-1220-80/+80
| | | | | | | | | 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: Iffc10aac2cdaf7c7ceba051ec447f15758c3d8e0 Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
* QtScript: Fix header guardTobias Hunger2013-08-291-1/+1
| | | | | Change-Id: Ib8db978f3f5414fccfcf772f7fa9b2b7ddbc761c Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
* Doc: Fix module name formatSze Howe Koh2013-01-261-1/+1
| | | | | | | | | | | 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 <jerome.pasion@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-1020-20/+20
| | | | | | Change-Id: Ic4a2739c8caf2eac95e4a72d8d38cfb912d5fe2b Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-2420-40/+40
| | | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: Id0b72b8c895b0eab04a740bf83859c9b646dd911 Reviewed-by: Janne Anttila <janne.anttila@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove the use of the QWidgetStar metatypeid.Stephen Kelly2012-08-151-3/+2
| | | | | | | | | | 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 <ogoffart@woboq.com>
* Fix GC issues related to QObject connections and ownershipKent Hansen2012-08-092-30/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <simon.hausmann@nokia.com>
* QScriptEngine::pushContext(): Don't inherit parent context's scopeKent Hansen2012-08-081-14/+6
| | | | | | | | | | | | | | 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 <ogoffart@woboq.com>
* Fix QScriptContextInfo::functionMetaIndex() for overloaded slotsKent Hansen2012-07-132-58/+129
| | | | | | | | | | | | | | | | | | 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 <ogoffart@woboq.com>
* Ensure QObject wrappers are garbage-collected if appropriateKent Hansen2012-07-032-5/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <ogoffart@woboq.com>
* Use the new function QMetaMethod::name() instead of methodSignature()Kent Hansen2012-06-291-56/+12
| | | | | | | | | Calling methodSignature() is inefficient in Qt5 because it dynamically constructs a string. In the places where we only want the method name, we should call QMetaMethod::name() instead. Change-Id: Ie2e66945a3a275630aad1c9253bd60b9889b7cfd Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Don't crash if queued signal handler no longer existsKent Hansen2012-06-261-1/+7
| | | | | | | Task-number: QTBUG-26261 Change-Id: Ie269c56c0336b1c937d4ec551f913ae7537d0338 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Fix crash when accessing QObject properties through activation objectKent Hansen2012-06-011-0/+1
| | | | | | | | | | | | | | | | 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 <ogoffart@woboq.com>
* Add missing staticMetaObject member initializationKent Hansen2012-05-291-1/+1
| | | | | Change-Id: Ia10e82a896eb40a7af8045cb120e3fc4afd88a02 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* 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 <kent.hansen@nokia.com>
* Port qtscript to QMetaMethod-based connectNotify()Kent Hansen2012-05-011-23/+2
| | | | | | | | | | | | | | The const char *-based API is deprecated and will be removed in Qt5. Also improve the autotest so we check precisely the number of connect/disconnect notifications received. The hacks to manually call the notify functions aren't needed anymore, because the internal QMetaObject::(dis)connect() now does it for us. Change-Id: I2e5efed34ee1cba0aad8e60ea00dc9bc2a25bc6c Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Addapt QtScript to the new moc outputOlivier Goffart2012-04-251-5/+1
| | | | | | | | | As changed by change If0b8f586cbaf633eed10045adee3ba3366826c86 in qtbase. Change-Id: If6556f75451c6a2c7e78b7987dc713d1b9b30179 Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Update implementation of callQtMethod after QMetaType::UnknownType introductionJędrzej Nowacki2012-04-171-8/+10
| | | | | | | | This patch gets rid of qWarning caused by misuse of QVariant. Change-Id: I889bd3830d86ea6d69db7a7ddb160a1f4da0c9bd Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Update QObjectConnectionManager to meta-object revision 7Kent Hansen2012-04-171-10/+28
| | | | | | | Regenerate the moc output so that it's in sync with the latest moc. Change-Id: I61790556eda2f5e0fc6f9a21c32e068bcb912c56 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Adapt qtscript to QMetaMethod::signature() renamingKent Hansen2012-04-171-16/+16
| | | | | | | | | | QMetaMethod::methodSignature() should be used instead, and it returns a QByteArray. Change-Id: I81150e238dab7eda26d0466ac407a4f3ba79a7c7 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Update QObjectConnectionManager meta-object to revision 6Kent Hansen2012-02-221-11/+28
| | | | | | | | | | Support for old meta-object revisions will be removed in Qt 5. This commit brings the QObjectConnectionManager meta-object in sync with current moc output. Change-Id: Iaee8bf68cc9d0568092f7692b3422145fed91c93 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-3020-20/+20
| | | | | | | | | | 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 <rohan.mcgovern@nokia.com>
* Update obsolete contact address.Jason McDonald2012-01-2320-40/+40
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I6597406c8041227410e672b86a567e1161a0ab59 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Improve handling of QScriptEngine::ExcludeDeleteLater.Friedemann Kleint2012-01-091-3/+1
| | | | | | | | | Determine index dynamically instead of using a hard-coded index in case should further methods be added. Change-Id: I8a6a3302a0034561e887ad683141a9ac17be45c8 Task-numbers: QTBUG-23502 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Fix JS to QVariant type conversionKent Hansen2012-01-091-24/+1
| | | | | | | | | | | | | | | | | | 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 <jedrzej.nowacki@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-0920-20/+20
| | | | | Change-Id: I323b788326712d95f6213ab8a68c18cfe28b7c76 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fix QScriptEngine::ExcludeDeleteLater and metaobject-related autotestsRohan McGovern2012-01-061-1/+4
| | | | | | | | | | | | | | ba635d7e74472f3a54c0c4686966af46d9035c6f in qtbase adds a signal to QObject. This breaks some code in QtScript which hardcoded the list of expected metamethods on QObject, and some other code which hardcoded the index of the deleteLater slot. Fix it. This is a minimal fix which does not address the underlying fragility. Task-number: QTBUG-23502 Change-Id: Id1269f9d8af01e12587ba8ff2fecf942a7231aff Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Initial import from the monolithic Qt.Qt by Nokia2011-04-2721-0/+5812
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