summaryrefslogtreecommitdiffstats
path: root/src/script/bridge/qscriptqobject.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* store error and return true when throwing in getOwnProperty()Kent Hansen2009-07-151-2/+2
|
* implement QObject prototype objectKent Hansen2009-07-151-1/+4
|
* implement AutoCreateDynamicProperties optionKent Hansen2009-07-151-7/+7
|
* implement QObject wrapper caching (PreferExistingWrapperObject)Kent Hansen2009-07-151-0/+29
|
* clear script exceptions when executing Qt methodsKent Hansen2009-07-151-0/+2
| | | | | | | The argument conversion logic checks for exceptions after attempting to convert each argument; this requires that there is initially no exception, otherwise it's going to bail out even if the conversion itself succeeded.
* add GC marking guardsKent Hansen2009-07-131-6/+15
| | | | | Caller is responsible for calling marked() before mark(), otherwise you might get infinite recursion.
* implement ability to dynamically change class of script objectsKent Hansen2009-07-101-60/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | With an object created by QScriptEngine::newObject(), it should be possible to call QScriptValue::setClass() to dynamically change the behavior of that object. Similarly, it should be possible to promote plain script objects to QObject (QVariant) wrappers by calling the overload of QScriptEngine::newQObject() (newVariant()) that takes a script object as the first argument. This commit implements this capability. The premise is the (internal) QScriptObject class, which inherits JSC::JSObject. It reimplements all the methods for getting/setting properties etc. Then there's a level of indirection to facilitate dynamic change of the class: Each QScriptObject can have a delegate associated with it that will handle operations on the object. By default there is no delegate, so the object behaves as a normal JS object, as you expect. However, once a delegate is set (e.g., when QScriptValue::setScriptClass() is called), QScriptObject will give the delegate the chance to handle the object operation. In addition to a delegate implementation for QScriptClass-based objects, there are also delegates for QObject and QVariant wrappers. These replace the QObjectWrapperObject and QVariantWrapperObject classes.
* QObject.prototype.toString: return undefined if this-object is not a QObjectKent Hansen2009-07-091-1/+1
| | | | Follow behavior of old back-end. Makes qscriptable test pass.
* invoke signal handler using JSC::call()Kent Hansen2009-07-091-8/+6
| | | | | Makes sure that new stack frame is set up if the function is native, and all that.
* make QObject property setter functions workKent Hansen2009-07-091-12/+31
|
* make QObject property access use getter+setter functionsKent Hansen2009-07-091-6/+12
| | | | | Setters don't work yet. But hey, the defaultprototypes example finally works.
* use currentFrame instead of globalExec whenever we canKent Hansen2009-07-091-1/+1
|
* rewrite most of QScriptContext handlingKent Hansen2009-07-081-29/+29
| | | | Do it The right way(TM), by lazily wrapping JSC::ExecState objects.
* make more tests passKent Hansen2009-07-031-1/+13
| | | | Implement delete operator for Qt properties.
* implement string-->enum conversionKent Hansen2009-07-021-1/+9
|
* first stab at implementing Qt property getter/settersKent Hansen2009-07-021-22/+183
| | | | Not fully working yet, so disabled for now
* implement caching of slot wrapper functionsKent Hansen2009-07-021-1/+39
|
* implement marking of QObject connectionKent Hansen2009-07-021-8/+9
|
* implement QScriptValue::QObjectMember property flagKent Hansen2009-07-021-4/+5
|
* create a new QScriptContext when calling a Qt methodKent Hansen2009-07-021-2/+14
| | | | Makes the args, thisObject etc. available if QScriptable is used.
* implement QObject property flagsKent Hansen2009-07-021-0/+74
|
* add placeholder implementations of findChild() and findChildren()Kent Hansen2009-07-011-1/+25
|
* port recent changes from qt/masterKent Hansen2009-06-301-3/+17
| | | | Makes variant conversion work for signal handlers.
* make part of test not assertKent Hansen2009-06-291-0/+2
|
* implement QMetaObject bindingsKent Hansen2009-06-261-0/+140
|
* port some fixes from the "old" qtscript backend to the JSC backendKent Hansen2009-06-251-15/+37
| | | | Makes more tests pass.
* work on signal bindings (connect, disconnect, signal emission)Kent Hansen2009-06-241-72/+142
|
* Import JSC-based Qt Script from Kent's tree.Simon Hausmann2009-06-161-0/+1338