summaryrefslogtreecommitdiffstats
path: root/src/script/bridge
Commit message (Collapse)AuthorAgeFilesLines
...
* finish implementation of QVariant.prototype.toString()Kent Hansen2009-08-061-16/+24
| | | | Behave like the old back-end.
* make iteration work for the global object againKent Hansen2009-08-062-6/+8
| | | | Follow-up to commit 520378cfedd63544a9689687256d2c89352ee561
* Updates getPropertyNames() on all javascript object to use the flagBenjamin Poulain2009-08-056-17/+17
| | | | | | | | 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-052-64/+106
|
* add type info and attribute getters for function wrappersKent Hansen2009-08-052-0/+17
|
* don't store QScriptEngine pointer in native function wrappersKent Hansen2009-08-052-26/+28
| | | | | We can infer it from the JSC environment when the function is actually called.
* remove unused codeOlivier Goffart2009-08-041-1/+0
|
* move Global Object to its own fileKent Hansen2009-08-043-0/+266
|
* adapt to commit 014c4c63066fd3920594e6a58b02f314b5c88cdfKent Hansen2009-08-046-16/+26
|
* Move the declaration on some function into qscriptengine_p.hOlivier Goffart2009-07-313-11/+0
|
* Small Refactoring of QScriptOlivier Goffart2009-07-314-52/+26
| | | | | | | | | - Create a scope (activation object) for the native constructor in QScriptClass - put the isCalledasConstructor in the activation object (so i can clean up the QScriptContext - Remove the code duplication in all native functions. Aknoweldged-by: Kent
* QScriptValueIterator: fix missing non-enumerable valuesTor Arne Vestbø2009-07-316-17/+23
| | | | | | | | | | 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.
* Add missing fileOlivier Goffart2009-07-301-0/+88
|
* Move QScriptActivationObject to his own fileOlivier Goffart2009-07-303-37/+100
|
* set calledAsConstructor to true when function is called as constructorKent Hansen2009-07-292-0/+5
|
* Fix license headersOlivier Goffart2009-07-2910-44/+344
|
* Enter a scope when enterning a native function.Olivier Goffart2009-07-291-1/+68
| | | | | | | | | | | | | | so native function that would call engine->evaluate("var b = 'foo'); would not change the global object. The change in qscriptengine.cpp makes sure that the correct scope is used for the execution of QScriptEngine::evaluate. The changes in qscriptfunction.cpp push a new scope for native function calls. We might want to move that into QScriptContext later Reviewed-by: Kent Hansen
* make QScriptEngine::setGlobalObject() work to some extentKent Hansen2009-07-272-8/+25
| | | | | | | | | | | | | | | | | | | | | | | | | 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
|
* don't rely on custom global object to get GC callbackKent Hansen2009-07-271-2/+2
| | | | | | | | | | | Install custom ClientData on JSGlobalData instance instead. Also some cleanups to avoid globalObject et al being accessed directly. Killed the proxying scheme employed in setGlobalObject() since it didn't work; if you stored the original Global Object and replaced it with another object, then added properties to the new object, they would show up in the old object, too (because the old object would always proxy to whatever the current Global Object was).
* 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-272-18/+20
| | | | | 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
* We cant rely on property attributes from JavaScriptCore for the setter and ↵Olivier Goffart2009-07-162-12/+0
| | | | getter
* start implementing constructors for QMetaObject wrappersKent Hansen2009-07-162-4/+110
|
* 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-152-1/+13
|
* implement AutoCreateDynamicProperties optionKent Hansen2009-07-151-7/+7
|
* implement enumeration of custom script classesKent Hansen2009-07-151-1/+14
|
* implement QObject wrapper caching (PreferExistingWrapperObject)Kent Hansen2009-07-152-1/+48
|
* 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-132-8/+19
| | | | | Caller is responsible for calling marked() before mark(), otherwise you might get infinite recursion.
* mark object data if we have itKent Hansen2009-07-131-0/+2
|
* implement ability to dynamically change class of script objectsKent Hansen2009-07-109-117/+800
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* make native object constructors workKent Hansen2009-07-091-10/+8
| | | | | With commit 6985212c8909c89183b232ca28b96a2c8a2f1385, context->thisObject() now returns the right thing.
* use currentFrame instead of globalExec whenever we canKent Hansen2009-07-091-1/+1
|
* rewrite most of QScriptContext handlingKent Hansen2009-07-083-65/+56
| | | | 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-022-24/+223
| | | | Not fully working yet, so disabled for now
* implement caching of slot wrapper functionsKent Hansen2009-07-022-1/+42
|
* implement marking of QObject connectionKent Hansen2009-07-021-8/+9
|