summaryrefslogtreecommitdiffstats
path: root/src/script/bridge/qscriptqobject.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Avoid calling out to public API in the QtScript implementationKent Hansen2010-02-181-58/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* 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-071-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-061-1/+1
| | | | | | | | Reviewed-by: Trust Me
* | Implement QScript::QObjectDelegate::getOwnPropertyDescriptorOlivier Goffart2010-01-051-1/+139
|/ | | | | | | This is needed for the fix for QTBUG-5749 that follow Reviewed-by: Kent Hansen Task-number: QTBUG-5749
* Fix garbage collection issue with script-owned objects with connectionsKent Hansen2009-11-301-13/+14
| | | | | | | | | | 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
* Fixed the QtScript license information in the source files to referSimon Hausmann2009-11-171-19/+1
| | | | | | | | to the LGPL only. To do this I ran replace-licenses.zsh $QTDIR/src/script release Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Replace LGPL license tags with LGPL-ONLYSimon Hausmann2009-11-171-1/+1
| | | | Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Fix QT_NO_PROPERTIESJørgen Lind2009-10-291-0/+16
| | | | | | | However, there are some stuff added to qscript that I'm really not sure about. Reviewed-by: tom
* Update src/3rdparty/javascriptcore and adapt src/script to the changes.Kent Hansen2009-09-241-54/+55
| | | | Reviewed-by: Simon Hausmann
* QtScript: Fix comparing QVariant and QObject.Olivier Goffart2009-09-211-0/+12
| | | | | | | This add a hook inside JSC to be able to implement our own comparison function when comparing objects. Reviewed-by: Kent Hansen
* use JSObject::inherits() instead of JSObject::isObject()Kent Hansen2009-09-211-3/+3
| | | | | | The functions are identical, but in recent WebKit trunk isObject() doesn't exist anymore. So this renaming is done to prepare for the import of a more recent JavaScriptCore.
* Update license headers again.Jason McDonald2009-09-091-4/+4
| | | | Reviewed-by: Trust Me
* Prospective SunCC compile fixSimon Hausmann2009-09-041-1/+1
| | | | | | Call the QScriptValue constructor without class scope. Reviewed-by: Trust me
* fix warnings on mingwThierry Bastian2009-09-021-0/+1
|
* Update tech preview license header for files that are new in 4.6.Jason McDonald2009-08-311-13/+13
| | | | Reviewed-by: Trust Me
* compile fix with namespaced Qthjk2009-08-241-4/+5
|
* use QVarLengthArray instead of QVector for holding JS argumentsKent Hansen2009-08-241-2/+1
| | | | | | It's faster. Reviewed-by: Olivier Goffart
* Fix obsolete license headers.Jason McDonald2009-08-211-1/+1
| | | | Reviewed-by: Trust Me
* add recursion guard for GC markingKent Hansen2009-08-201-3/+2
| | | | | | | To achieve behavior of the old back-end. There, the recursion guard was automatic because a mark flag was set on the object as soon as marking begun, but in JSC it appears to only be set _after_ the marking is completed.
* Fix "fixme" in QtFunction::mark()Jedrzej Nowacki2009-08-201-3/+1
| | | | | | QtFunction::mark() does not cause infinite recursion any more. Reviewed-by: Kent Hansen
* CleanupsOlivier Goffart2009-08-191-5/+3
| | | | | Remove useless variable. Use QBoolBlocker instread of custom QScript::InEval.
* Clean up.Jedrzej Nowacki2009-08-181-0/+1
| | | | | | Get rid off some compilation warnings about unused variables. Reviewed-by: Kent Hansen
* Clean up.Jedrzej Nowacki2009-08-181-28/+28
| | | | | | | Get rid of conversion functions QScript::qtStringFromJSCUString and QScript::qtStringToJSCUString. Code was moved to cast operators. Reviewed-by: Kent Hansen
* port commit 8fca9052e72d1dc983443c3a8065f804bebf77e7 from qt/masterKent Hansen2009-08-181-1/+1
| | | | QtScript must respect dynamic metaobjects when installed.
* Fix compilation on WindowsSimon Hausmann2009-08-141-0/+3
| | | | | | Don't compile moc_qscriptqobject_p.cpp separately but compile it from qscriptqobject.cpp instead, to ensure that config.h is included. That ensures that min/max are undeffed as macros.
* Fix compilation on WindowsSimon Hausmann2009-08-141-0/+1
| | | | | | In WebKit/JSC config.h needs to be included first in .cpp files, to among other things make sure that min/max are not defined as macros through windows.h.
* implement GC marking of qobject sender JS wrapperKent Hansen2009-08-141-5/+5
|
* Push frames when needed for native getter or settersOlivier Goffart2009-08-121-2/+6
| | | | | This is some other places where Qt native function may expect to have their own context
* Refactor the way the JS stack are created for native functionOlivier Goffart2009-08-121-5/+6
| | | | | | | | | | The original JavaScriptCore doesn't create stack frame or scope for native function. JSC has been patched to support that. This commit revert our patches to JSC, and implement create the stack frame from QScript Reviewed-by: Kent Hansen
* add configure options for (not) building the QtScript moduleKent Hansen2009-08-071-4/+0
| | | | | | | | | | | | | | | | | | -script (default) and -no-script. This means we can get rid of the SCRIPT feature from qfeatures, since it's now handled by the new configure variable. It also allows us to get rid of all the QT_NO_SCRIPT ifdefs from the source files, since qmake isn't going to include those files for compilation when you configure with -no-script. The QtScriptTools module will be disabled if the QtScript module is not built. You'll have to build the old QtScript back-end (will be made available in a separate package), then build the QtScriptTools module yourself. Reviewed-by: Simon Hausmann
* fix regression in enumeration of QPropertiesKent Hansen2009-08-061-1/+1
|
* port commit 47c9e7b1b3551ff6dbe71590461a45ae398a9501 from qt/masterKent Hansen2009-08-061-5/+8
|
* Updates getPropertyNames() on all javascript object to use the flagBenjamin Poulain2009-08-051-5/+5
| | | | | | | | getPropertyNames() now uses a flag to specify which property should be filtered. This flag should be used by all javascript objects. This patch fixes the changes introduced by e520df1f8678bd59adb341fb586f008a7de17fe8
* make QScriptEngine::newQMetaObject() workKent Hansen2009-08-051-62/+103
|
* adapt to commit 014c4c63066fd3920594e6a58b02f314b5c88cdfKent Hansen2009-08-041-4/+6
|
* Move the declaration on some function into qscriptengine_p.hOlivier Goffart2009-07-311-4/+0
|
* QScriptValueIterator: fix missing non-enumerable valuesTor Arne Vestbø2009-07-311-5/+6
| | | | | | | | | | Added an extra argument to JSObject::getPropertyNames() that specifies if the non-enumerable properties (those with the DontEnum attribute set) should be included or not. Tried looking at using a unsigned as an attribute-inclusion or exclusion filter, but the semantics of either the calling or the callee code would be very strange so I opted out.
* Fix license headersOlivier Goffart2009-07-291-5/+35
|
* make QScriptEngine::setGlobalObject() work to some extentKent Hansen2009-07-271-8/+17
| | | | | | | | | | | | | | | | | | | | | | | | | JSC requires that the global object is actually a JSGlobalObject instance, whereas QScriptEngine::setGlobalObject() allows any object to be set as the global object. The way we solve this is by proxying from an internal global object to the custom (user-set) object. We need to take care that the internal global object is never actually exposed through our API; a brilliantly named helper function, toUsableValue(), makes that happen. Evaluating "var a = 10" with a custom global object doesn't work yet; the variable always ends up in the internal Global Object. For variable assignments, JSC appears to bypass the normal JSObject::put() and instead use JSGlobalObject::copyGlobals{From,To}(), which means I can't intercept and proxy the assignments. This commit enough to get the Context2D example working. There's another bug with iteration of the built-in Global Object's properties (non-enumerable properties are always skipped by the JSC C++ API, whereas with QScriptValueIterator they should not be), but that's a totally separate issue.
* use engine's globalObject() instead of exec's lexicalGlobalObject()Kent Hansen2009-07-271-7/+7
|
* Remove the uncaughtException, use the JSC exception insteadBenjamin Poulain2009-07-271-3/+1
| | | | | | | | | Use the exception from JSC::exec instead of QScriptEngin::uncaughtException. A few more tests are passing for qscriptvalue and qscriptqobject. Reviewed-by: Kent Hansen
* Fix tst_QScriptExtQObject::objectDeleted()Benjamin Poulain2009-07-271-1/+2
| | | | | | | | Fix tst_QScriptExtQObject::objectDeleted(), the exception generated in the JSC script engine needs to be stored in uncaughtException of QScriptEngine. Reviewed-by: Kent Hansen
* introduce scriptEngineFromExec() helper functionKent Hansen2009-07-271-10/+11
| | | | | No need to expose the fact that we go via the Global Object to get an engine pointer.
* Implement qobjectProtoFuncFindChildren()Benjamin Poulain2009-07-221-1/+50
| | | | | | | | For matching the regular expression, the algorithm of JSCore is used instead of QRegExp, this is done to be consistent with the rest of ecmascript. Reviewed-by: Kent Hansen
* start implementing constructors for QMetaObject wrappersKent Hansen2009-07-161-4/+99
|
* fix enumeration of QObject wrapper objectsKent Hansen2009-07-161-3/+1
| | | | | Don't add method names, only signatures. Respect the SkipMethodsInEnumeration option.
* fix some memory leaksKent Hansen2009-07-151-0/+1
|
* initial attempt at implementing QScriptEngine::setGlobalObject()Kent Hansen2009-07-151-4/+4
| | | | | Doesn't actually replace the global object, but rather has the standard global object act as a proxy to the custom one.