summaryrefslogtreecommitdiffstats
path: root/src/script
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote branch 'qt/4.7' into qml-4.7Qt Continuous Integration System2010-03-102-50/+73
|\ | | | | | | | | Conflicts: src/declarative/util/qdeclarativestateoperations.cpp
| * Don't needlessly call pushContext() when reading propertiesKent Hansen2010-03-051-15/+18
| | | | | | | | | | | | | | It's only necessary to push a QScriptContext when properties are read from an object that inherits QScriptable. Postpone the decision of pushing a context until we know whether the object is a QScriptable.
| * QtScript: Don't needlessly make deep copies of function namesKent Hansen2010-03-052-35/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QObject binding uses the function name to determine whether a meta-method is an overload. This was implemented quite naively by copying the name from the signature into another array before comparing it. This could cause several unnecessary memory allocations, since storing the name is really only needed when there is an exception (e.g. ambiguous call). Instead, use strncmp to compare only the relevant characters of the original (non-copied) method signature. This makes normal slot invocation from QtScript up to 15% faster. Reviewed-by: Jedrzej Nowacki
* | Integrate QML's object ownership with the JS collectorAaron Kennedy2010-03-094-0/+25
|/ | | | | | | QML now behaves in a way similar to QtScript when it comes to QObject ownership. QT-2803
* QScript: Fix crash when converting a null value to a variant.Olivier Goffart2010-03-041-1/+3
| | | | | | Fixes test tst_QScriptValue::equals(engine->newVariant(QVariant(123)) <=> engine->newArray(10)) Reviewed-by: Jedrzej Nowacki
* QScript: Test against QMetaType::QVariant instead of against the stringOlivier Goffart2010-03-042-28/+20
| | | | | | | now that QVariant is known to QMetaType, we can test for the metatype id instead of doing string comparison Reviewed-by: Kent Hansen
* Fixes tst_QScriptExtQObject::connectAndDisconnectOlivier Goffart2010-03-041-8/+6
| | | | | | | | | Now that QVariant is known to QMetaType, it has an ID. This is much more robust as before. This would have fail if QVariant, would have been registered by the user. Reviewed-by: Kent Hansen
* Perform latin1 conversion directly on JSC::UStringKent Hansen2010-03-013-28/+46
| | | | | | | | | This conversion needs to be as fast as possible since it's performed every time you access a QObject property from QtScript. Hence, we should avoid going via QString and instead do the conversion ourselves. Reviewed-by: Jedrzej Nowacki
* Avoid conversion between JavaScriptCore String type and QStringKent Hansen2010-03-014-18/+18
| | | | | | | Use JSC::UString internally. Only when the public API demands it should a JSC::UString be converted to a QString. Reviewed-by: Jedrzej Nowacki
* Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into master-s60axis2010-02-262-3/+11
|\ | | | | | | | | | | Conflicts: qmake/generators/symbian/initprojectdeploy_symbian.cpp qmake/generators/symbian/symmake_abld.h
| * Fix memory leak when lazily binding QScriptValue to an engineKent Hansen2010-02-222-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid the engine's list of free script values from growing without bounds. When a QScriptValue is initially not bound, its private will be allocated from the normal heap (and not from the engine's pool of privates, because there is no engine at this point). But when a value is later bound (e.g. by setting it as a property of an object, or by passing it as argument to QScriptValue::call()) and is subsequently destroyed, its private will be handed to the engine, which will add it to its free-list (hence the memory is not freed). This allocation/deallocation asymmetry causes this list go keep growing. The solution is to limit the size of the free-list, and free the memory of the private immediately when the list has reached a certain size. Task-number: QTBUG-8400 Reviewed-by: Olivier Goffart
* | QScriptValue::isQMetaObject crash fix.Jedrzej Nowacki2010-02-241-1/+1
| | | | | | | | | | | | | | | | QScriptValue::isQMetaObject shouldn't crash for a value that internally is represented as a non JSObjects values. Additional check was added to QScriptEnginePrivate::isQMetaObject. Reviewed-by: Kent Hansen
* | Second attempt at work-around for MSVC2008 compiler crashKent Hansen2010-02-221-0/+5
| | | | | | | | | | | | Turn off optimizations in qscriptengine.cpp. I tried to turn it off/on for a selective few functions, but without success.
* | Work around MSVC2008 compiler crashKent Hansen2010-02-192-1/+27
| | | | | | | | | | | | | | | | | | "e:\pulse\work\91088\src\script\api\qscriptengine.h(360) : fatal error C1001: An internal error has occurred in the compiler. (compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c[0x510A0530:0x00000007]', line 243) To work around this problem, try simplifying or changing the program near the locations listed above." Apparently the compiler doesn't like that a few functions are inlined.
* | Avoid calling out to public API in the QtScript implementationKent Hansen2010-02-188-359/+513
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's no reason to construct QScriptValues when JSC::JSValues can be operated on directly. A benchmark showed that ~10% of the time for reading a QObject property from a script was spent just creating and destroying QScriptValue temporaries. It's time to finally get rid of this potential bottleneck, not just in the QObject integration but everywhere. This change refactors the code so that all internal operations are performed on JSC::JSValue (most importantly, conversion from/to Qt types), and the public API functions are just thin wrappers around these. E.g. instead of doing enginePrivate->scriptValueFromJSCValue(jsValue).toQObject() the implementation now does QScriptEnginePrivate::toQObject(jsValue) Other operations are delegated to the engine implementation in similar style. Task-number: QTBUG-8304 Reviewed-by: Jedrzej Nowacki
* | Move property helper functions to QScriptEnginePrivateKent Hansen2010-02-184-206/+288
| | | | | | | | | | | | More preparation for operating purely on JSC::JSValue internally. Reviewed-by: Jedrzej Nowacki
* | Move more script value conversion code to helper functionsKent Hansen2010-02-182-65/+152
| | | | | | | | | | | | In preparation of operating purely on JSC::JSValue internally. Reviewed-by: Jedrzej Nowacki
* | Cleanup: Move value conversion code to helper functionsKent Hansen2010-02-183-11/+60
| | | | | | | | | | | | In preparation of doing this conversion in more places. Reviewed-by: Jedrzej Nowacki
* | Move implementation of QScriptValue construction functions to private classKent Hansen2010-02-182-91/+133
| | | | | | | | | | | | | | | | In preparation of getting rid of QScriptValue construction internally; the implementation should only call the private functions that operate directly on JSC::JSValues. Reviewed-by: Jedrzej Nowacki
* | Cleanup: Move number conversion functions to QScriptEnginePrivateKent Hansen2010-02-183-84/+81
| | | | | | | | | | | | | | Also rename ToUint{16,32} to ToUInt{16,32} to follow the Qt naming (it takes precedence over the ECMA one). Reviewed-by: Jedrzej Nowacki
* | Move some helper function declarations outside QT_NO_QOBJECT guardKent Hansen2010-02-181-13/+14
| | | | | | | | | | | | | | These are not dependent on QObject, I don't know how they ended up inside there. Reviewed-by: Jedrzej Nowacki
* | Cleanup: Move exception helper functions to QScriptEnginePrivateKent Hansen2010-02-183-35/+35
| | | | | | | | | | | | Because that's where they belong. Reviewed-by: Jedrzej Nowacki
* | Optimization: Avoid calling out to public API functionKent Hansen2010-02-151-2/+1
| | | | | | | | | | | | | | | | All the public QScriptEngine::create() function does is call the private implementation anyway, so call QScriptEnginePrivate::create() directly. Reviewed-by: Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
* | Merge branch 'kinetic-declarativeui' of ↵Warwick Allison2010-02-044-7/+263
|\ \ | | | | | | | | | | | | | | | | | | | | | git://git-nokia.trolltech.com.au/qtsoftware/qt/kinetic Conflicts: src/xmlpatterns/type/qprimitives_p.h tools/linguist/lupdate/main.cpp
| * | Compile.Warwick Allison2010-02-031-0/+1
| | |
| * | Merge branch '4.6' of git://scm.dev.nokia.troll.no/qt/qt into ↵Warwick Allison2010-02-021-4/+9
| |\ \ | | |/ | | | | | | | | | | | | | | | kinetic-declarativeui Conflicts: tools/linguist/lupdate/main.cpp
| * | Merge branch '4.6' of ../qt into kinetic-declarativeuiAaron Kennedy2010-01-201-1/+8
| |\ \ | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qobject.cpp
| * \ \ Merge branch '4.6' of ../qt into kinetic-declarativeuiAaron Kennedy2010-01-191-1/+2
| |\ \ \
| * | | | Fix possible crashAaron Kennedy2010-01-152-4/+9
| | | | | | | | | | | | | | | | | | | | The QScriptValue does not always have a valid QScriptEngine.
| * | | | Merge branch 'kinetic-declarativeui' of scm.dev.nokia.troll.no:qt/kinetic ↵Aaron Kennedy2010-01-1467-70/+233
| |\ \ \ \ | | | | | | | | | | | | | | | | | | into kinetic-declarativeui
| | * \ \ \ Merge branch '4.6' of git://scm.dev.nokia.troll.no/qt/qt into ↵Warwick Allison2010-01-1467-70/+233
| | |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | kinetic-declarativeui Conflicts: bin/syncqt src/corelib/io/qurl.cpp
| * | | | | | Support calling in QScriptDeclarativeClassAaron Kennedy2010-01-144-3/+58
| |/ / / / /
| * | | | | CompileAaron Kennedy2010-01-121-1/+1
| | | | | |
| * | | | | Optimization: Add QScriptDeclarativeClass::ValueAaron Kennedy2010-01-113-5/+199
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This class is essentially the same as QScriptValue, but it is faster as it doesn't reference objects. Thus, they might be collected if the gc runs. For return values from QScriptDeclarativeClass this isn't a problem, of course.
| * | | | | Correctly determine QScriptValue::isQObject() for QObjects using theMichael Brasser2009-12-173-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QScriptDeclarativeClass. This allows us to pass QObjects to QML-defined functions which expect a QVariant (and will presumably help in other cases where we expect transparent QObject <-> QVariant conversion in the engine). Task-number: QTBUG-6178 Reviewed-by: Aaron Kennedy
| * | | | | Introduce experimental binding optimizerAaron Kennedy2009-12-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Enable with QML_EXPERIMENTAL=1
| * | | | | Quick fix for translation.Michael Brasser2009-12-091-3/+4
| | | | | |
* | | | | | Use RefPtr to store QScriptProgram's EvalExecutableKent Hansen2010-02-012-6/+7
| |_|_|_|/ |/| | | | | | | | | | | | | | | | | | | Otherwise we crash with latest WebKit trunk because the SourceProvider is prematurely destructed.
* | | | | Don't crash when comparing JSCore value without engine to non-JSCore valueKent Hansen2010-01-271-4/+9
| |_|_|/ |/| | | | | | | | | | | | | | | Task-number: None, discovering while doing test refactoring Reviewed-by: Jedrzej Nowacki
* | | | Remove QtScript connection when receiver QObject has been deletedKent Hansen2010-01-191-1/+8
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't want to have to listen to the destroyed() signal for every receiver object of a connection, and likewise we don't want to create a QObject to handle each connection; instead, remove the connection lazily at signal emission time after we've detected that the receiver has been deleted. Task-number: QTBUG-7313 Reviewed-by: Simon Hausmann
* | | don't assert when calling QtScript-wrapped method of deleted QObjectKent Hansen2010-01-181-1/+2
| |/ |/| | | | | | | | | Make it behave the same as the old (4.5) back-end. Reviewed-by: Jedrzej Nowacki
* | Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into ↵Qt Continuous Integration System2010-01-1167-69/+69
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4.6-integration * '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (71 commits) QNAM HTTP Code: Cache socket state inside ensureConnection() tst_qhttpnetworkconnection: Test also HEAD in some tests tst_qhttpnetworkconnection: Relax condition in getMultipleWithPriorities QNAM HTTP Code: When starting new request, prefer connected sockets. typo fix Added the 'framecapture' WebKit example to the default build. Fix code example fix typo in qreadwritelock's documentation QNAM HTTP: Don't call d_func() so often QNAM HTTP: Fix readBuffer maximum size. QNAM HTTP: Optimize eatWhitespace() QNAM HTTP: Check if socket already tries to connect. network internals: fix build on S60 [syncqt] Make -separate-module work with WebKit's directory structure doc: Corrected explanation of when append() does nothing. doc: Added clarification about allocating space for the 0 terminator. Add a way to access the normalised URL in QUrl. [syncqt] Make it possible to synchronize headers for a separate module [syncqt] Make it possible to override the base directory network internals: start HTTP GET requests right away when called ...
| * \ Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into ↵Qt Continuous Integration System2010-01-0767-69/+69
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4.6-integration * '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1: QIODevice: Fix readAll() Temporary hackiesh solution to prevent BOM in the xml data. Fixed qxmlstream autotest when using shadow builds. Attempt at readding the capital P headers for Phonon Remove special Phonon processing from syncqt. Use the lowercase/shortname.h headers for Phonon includes Fixes a crash when setting focus on a widget with a focus proxy. Update copyright year to 2010 doc: Clarified activeSubControls and subControls. Remove warning "statement with no effect" doc: Clarified that .lnk files are System files on Windows.
| | * | Update copyright year to 2010Jason McDonald2010-01-0667-69/+69
| | | | | | | | | | | | | | | | Reviewed-by: Trust Me
* | | | Correctly determine QScriptValue::isQObject() for QObjects using theMichael Brasser2010-01-113-4/+14
|/ / / | | | | | | | | | | | | | | | | | | | | | QScriptDeclarativeClass. Task-number: QTBUG-6178 Reviewed-by: Kent Hansen Reviewed-by: Aaron Kennedy
* | | Implement QScript::QObjectDelegate::getOwnPropertyDescriptorOlivier Goffart2010-01-054-1/+164
|/ / | | | | | | | | | | | | This is needed for the fix for QTBUG-5749 that follow Reviewed-by: Kent Hansen Task-number: QTBUG-5749
* | Fix translation context for qsTr.Michael Brasser2009-12-101-3/+4
|/ | | | | | | Use the base of the file name as the translation context. (This was the original behavior before the switch to JSC.) Reviewed-by: Kent Hansen
* Fix garbage collection issue with script-owned objects with connectionsKent Hansen2009-11-302-23/+25
| | | | | | | | | | This reinstates the pre-4.6 behavior: A script-owned C++ object that's not referenced anymore should be garbage collected, even if it has connections. In order to achieve this, the "weak" reference to the C++ object's wrapper must be invalidated. Task-number: QTBUG-6366 Reviewed-by: Simon Hausmann
* Fix miracously exported WTF symbols in QtScript with the Maemo 5 toolchain.Lars Knoll2009-11-271-1/+1
| | | | | | | Rename the WTF namespace. Task-number: http://bugreports.qt.nokia.com/browse/QTBUG-5513 Reviewed-by: Simon Hausmann
* Don't crash in eval() function when QtScript debugger is attachedKent Hansen2009-11-231-2/+8
| | | | | | | | | | | | | | | | | | | | | The built-in eval() function bypasses the script registration performed by QScriptEngine::evaluate(), so if we get an atStatement() callback from JSC from that script, the scriptID-to-sourceProvider lookup will fail. In this case, just return from atStatement() without delivering the positionChange() callback to the QScriptEngineAgent, since the agent will not have received the scriptLoad() callback for that script anyway. This is a change in behavior from 4.5, but we consider it the minimum-impact fix at this point to keep 4.6.0 from crashing. The only downside is that debugging will effectively be "disabled" for the script passed to eval(), but that's a lot better than crashing. Task-number: QTBUG-6108 Reviewed-by: Jedrzej Nowacki