summaryrefslogtreecommitdiffstats
path: root/src/script/bridge/qscriptqobject.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* 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.