summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix header guardLars Knoll2012-09-251-0/+1
| | | | | Change-Id: I22bba8d2d175d787913d1e2269ad2ca8ff762043 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Doc: Changed title of Qt Script module pageGeir Vattekar2012-09-241-1/+1
| | | | | Change-Id: I9d4f8b6b3af98bb8cc7a4b773a5c663691e5476b Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-24233-3858/+3858
| | | | | | | | | 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>
* centralize load(qt_build_config)s in .qmake.confOswald Buddenhagen2012-09-113-6/+0
| | | | | Change-Id: I1d95fe8089d8384563654630b9f4b201245887b9 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* Fix MinGW-w64 compilationJonathan Liu2012-09-041-1/+1
| | | | | | | | | | ENABLE_EXECUTABLE_ALLOCATOR_FIXED requires sys/mman.h which is not available with MinGW-w64. Change-Id: I6e76ce0c570e5819657debf813f0e80cef907dd4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Yuchen Deng <loaden@gmail.com> Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
* 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 <simon.hausmann@nokia.com>
* Remove the use of the QWidgetStar metatypeid.Stephen Kelly2012-08-152-12/+7
| | | | | | | | | | 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>
* Make QScriptEngine::uncaughtExceptionBacktrace() work againKent Hansen2012-08-156-21/+83
| | | | | | | | | | | 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 <ogoffart@woboq.com>
* Add default conversion for types long and ulongKent Hansen2012-08-142-0/+30
| | | | | | | | | | | | | | 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 <ogoffart@woboq.com>
* Suppress JavaScriptCore 'LEAK' messages at application exitKent Hansen2012-08-132-0/+5
| | | | | | | | | | | | | | | | | | In debug mode, if a QScriptEngine was never destroyed, JavaScriptCore would output a message like LEAK: 120 Structure on stderr at exit. This is not terribly helpful to users; also, it's not common for Qt classes to produce such output. Since JavaScriptCore's only usage of the logging facility is for reporting these "leaks", we can disable logging altogether. Task-number: QTBUG-18201 Change-Id: Id598bd1f48129d821a954cc49d8e3ab715d78426 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* make use of QT_PRIVATE to specify private Qt dependenciesOswald Buddenhagen2012-08-111-3/+1
| | | | | Change-Id: I05b18befb71ef0483ee5a40dab6163f0612782e0 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* follow rename of qt_module_config.prf to qt_module.prfOswald Buddenhagen2012-08-112-2/+2
| | | | | Change-Id: Ied05f26ee735d63a89a5bcf9b7afbeaa8e70809c Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* Fix GC issues related to QObject connections and ownershipKent Hansen2012-08-094-38/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Add qtscriptglobal.h for the qtscript.git module EXPORT macrosThiago Macieira2012-08-0910-1/+80
| | | | | | | | No library other than the core libraries should depend on their export macros being in qglobal.h. Change-Id: I6ded70813f6296ca5aa1d7d3cdb38503a5538424 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* QScriptEngine::pushContext(): Don't inherit parent context's scopeKent Hansen2012-08-083-22/+9
| | | | | | | | | | | | | | 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 JIT crash on x86-64 (avoid 32-bit branch offset overflow)Kent Hansen2012-08-068-39/+84
| | | | | | | | | Cherry-picked from webkit commit a5b3261a8c4386b4e14ce40a34c7fc933a5f7001 Task-number: QTBUG-23871 Change-Id: Ia028fe072b349e3a7883ae0f6f7298941cc1bc9e Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
* Fixed compile without QtWidgets, unify "is module available?" syntaxRohan McGovern2012-07-301-1/+1
| | | | | | | | | | | If QtWidgets is not available, disable a few examples which need it. Standardize on isEmpty(QT.widgets.name) in preference to contains(QT_CONFIG,no-widgets). Change-Id: I00335149a75911dd4ab42a4ce659889d548a8be3 Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com> Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
* Fix QScriptContextInfo::functionMetaIndex() for overloaded slotsKent Hansen2012-07-133-60/+130
| | | | | | | | | | | | | | | | | | 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>
* Check that property descriptor members are valid before using themKent Hansen2012-07-121-2/+2
| | | | | | | | | | | | | | | | | Even if getPropertyDescriptor() returns true, it's not guaranteed that PropertyDescriptor::setter() or PropertyDescriptor::value() returns a valid JSC value. This code is in an "#ifdef QT_BUILD_SCRIPT_LIB" block, i.e. a patch we added on top of the original JSC sources. The lack of checks caused the getter-in-prototype and indexed-accessors tests from the V8 test suite to assert in debug mode. Task-number: QTBUG-17915 Change-Id: I568d83f2f80b28871ea0d934a8e33078ac8aa3ad Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Ensure QObject wrappers are garbage-collected if appropriateKent Hansen2012-07-034-10/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* doc: add a few missing properties to the ECMAScript referenceKent Hansen2012-06-291-0/+26
| | | | | | | Task-number: QTBUG-15213 Change-Id: I6618cbde2032d6ced780057930f43fa967087262 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* doc: remove wrong information about Error object stack propertyKent Hansen2012-06-291-7/+0
| | | | | | | | | | Since the switch to JavaScriptCore, Error objects no longer have the non-standard "stack" property, and we're not going to hack JavaScriptCore to support it. Task-number: QTBUG-15956 Change-Id: I085f24fbb179bbf3d1609cbc13e963fa51b4dbbc 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>
* build system cleanupsOswald Buddenhagen2012-06-253-19/+3
| | | | | | | | | | | | | | | - load(qt_module) => load(qt_build_config) - remove: - CONFIG+=module (obsolete) - setup of PKGCONFIG* variables (automated now) - code relating to module version headers (automated now) - %mastercontent assignment (automated now) - QT_BUILD_*_LIB defines (automated now) - pointless QPRO_PWD assignments - qmake -project boilerplate Change-Id: I618bc1db930a372e7f713f21f21b2cfedc839258 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* auto-generate module prisOswald Buddenhagen2012-06-252-3/+4
| | | | | Change-Id: I060145658caaa4b4d39c323c6004e594ff44f98f Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Compile with clang's libc++Bradley T. Hughes2012-06-232-2/+4
| | | | | | | | | | | | | | An overload for std::swap() what works with std::pair<A,B> is included in libc++ (but not libstdc++). Avoid ambiguity in HashTable.h by omitting the version there and using the std::swap() version. Collector.cpp needs to include pthread.h directly, as it is not automatically included by libc++'s headers (libstdc++ does pull in pthread.h though). Change-Id: I20ffe5a745900d1cfa1e489ebf4376e454eded5f Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix possible type collision with ICUKonstantin Ritt2012-06-151-1/+1
| | | | | | | | | | | see https://bugs.gentoo.org/show_bug.cgi?id=407315 The UChar32 is declared as signed 32-bit int since ICU 2.4, no chance they'll fix their code. Change-Id: I9691507c8ca14a04610e9b13ae13f416929ffa08 Reviewed-by: Davide Pesavento <davidepesa@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Skip a test case that started failing after the upgrade to Unicode 6.1Konstantin Ritt2012-06-151-141/+47
| | | | | | | | | | | U+10C1 and U+10CD has been added in the Unicode 6.1 and assigned with general category Lu (Uppercase Letter). toLower(Lu) can never be Lu, thus the failing testcases are just wrong -> omit them. This also avoids using of QUnicodeTables internals in JSC. Change-Id: I6aa6dab686dc3e3556ebe83c395c5d93e42cfb4f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Don't build scripttools when Qt is configured with -no-widgetsKent Hansen2012-06-061-1/+2
| | | | | Change-Id: I9fabf055a959b27cd44fb2e179f98bfae9d7d297 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* don't reference $$QT_SOURCE/BUILD_TREE - they're unavailable hereOswald Buddenhagen2012-06-062-3/+3
| | | | | Change-Id: I88316acb4cfc867689dfa636dd7554ac0976275f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Modularize QtScript documentation.Casper van Donderen2012-06-0532-48/+5041
| | | | | Change-Id: I042d9bafe4f48a8cd23306f0864b6872776d0153 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Disable C++11 support when building QtScriptBradley T. Hughes2012-06-041-0/+1
| | | | | | | | As the existing comment shows, the WebKit code cannot be built with C++11 support enabled. Change-Id: Ic900fb1dc73420fcc3fcec9e7d574f7dece0e036 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* 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 <ogoffart@woboq.com>
* Fix crash when accessing QObject properties through activation objectKent Hansen2012-06-012-0/+5
| | | | | | | | | | | | | | | | 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>
* Fix scripttools compilation when some features are disabledKent Hansen2012-06-014-0/+44
| | | | | | | Task-number: QTBUG-20378 Change-Id: Ia1dc574824cb1d58c237d60675d1b8a5f8f44c43 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Don't crash in debugger if QScriptEngine is deletedKent Hansen2012-06-012-1/+3
| | | | | | | Task-number: QTBUG-21548 Change-Id: I925a920c8685cf4cf40c7ad03c2d519e2f2121fb Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Add missing staticMetaObject member initializationKent Hansen2012-05-291-1/+1
| | | | | Change-Id: Ia10e82a896eb40a7af8045cb120e3fc4afd88a02 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* 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 <kent.hansen@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Simplify QVariant::convert and QVariant::canConvert calls.Jędrzej Nowacki2012-05-212-4/+4
| | | | | | | QVariant::Type casts are not necessary in Qt5. Change-Id: I43833e869379db8937839612dfb6162f878870cb Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* qMalloc, qFree and qRealloc are deprecated.Debao Zhang2012-05-202-9/+9
| | | | | | | | Use the stdlib version directly instead Change-Id: Ib289b37c9a00b7da1926e20cc1c1b5a52388fb2f Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Update the includes after QIcon was moved back to QtGuiOlivier Goffart2012-05-203-3/+3
| | | | | Change-Id: I203a7c48f2280b22a8b224a82a07c29ffbae3c78 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Fixed MSVC2011 buildAndreas Holzammer2012-05-165-10/+10
| | | | | | | | | | | | JavaScriptCore fix is relevant to changed ctor of the std::pair in C++11. Due to that change some code has been broken. Fix makes using std::pair compliant to both standards Change-Id: I77a1fe4b137480b51c24267b7aacb5b688dbddb3 (Partially cherry picked from commit 9a06d491e8e63293e4cc877b00f3a59188283785) Reviewed-by: Janne Anttila <janne.anttila@digia.com> Reviewed-by: Kervala <kervala@gmail.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Doc: Fix \sa usageMarius Storm-Olsen2012-05-101-1/+1
| | | | | | | | Ensure comma between elements (1 missing), single space and curly- braces around title elements, etc. Change-Id: I0c8e0f0a8ca2cd942fa69424440eeec3ae88af27 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Revert "JSCore build fix for WEC7"Andreas Holzammer2012-05-101-11/+0
| | | | | | | | | | | | | | | It's reverted, as there seems to be at least two implementations of the stl in WEC7. One for each BSP SDK and one shipped with the compiler, which is in this case Visual Studio 2008. The Compiler has a stl with std::min etc. Visual Studio GUI also uses the compiler version of the stl first. It seems to be that the environment was setup wrongly. Checksdk also uses the right order. This reverts commit 8b65d84145f0f415d0963caa7b49da07ac67148d. Change-Id: Ic00d87777e822d9a7c2ee16ce60cad3782293245 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Change uses of {to,from}Ascii to {to,from}Latin1Thiago Macieira2012-05-033-4/+4
| | | | | | | | | | 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 <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>
* Fix some deprecation warnings in QtScript.Friedemann Kleint2012-04-306-14/+24
| | | | | Change-Id: I98d4826fcc2e3687d45edfccca956891ca0466cf Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
* JSCore build fix for WEC7Janne Anttila2012-04-191-0/+11
| | | | | | | | | | | WEC7 does not have std::ptrdiff_t type and std::min/std::max, introduced the missing types and functions in JSCore platform.h Task-number: QTBUG-22497 Change-Id: I0bf2bff2a80bdff36253f233b30cc95e1c772e23 Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com> (cherry picked from commit 7f8612853273f9dc120a7bc096f10821eb48fd2b)