summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptvalue.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Unify QScriptValue::toObject() and QScriptEngine::toObject()Benjamin Poulain2009-08-031-19/+1
| | | | | | | QScriptValue::toObject() call QScriptEngine::toObject() so the code is not duplicated. Reviewed-by: Kent Hansen
* Move the declaration on some function into qscriptengine_p.hOlivier Goffart2009-07-311-7/+0
|
* Fix license headersOlivier Goffart2009-07-291-7/+37
|
* don't allow defining getter/setter for __proto__ propertyKent Hansen2009-07-281-4/+9
|
* make more tests pass for QScriptValue::setProperty()Kent Hansen2009-07-281-23/+53
| | | | | | JSC doesn't provide a way of un-defining a getter/setter. If deleting e.g. only the setter, we remember the getter, delete the property, then re-establish the getter.
* make QScriptEngine::setGlobalObject() work to some extentKent Hansen2009-07-271-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 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-16/+7
| | | | | | | | | Use the exception from JSC::exec instead of QScriptEngin::uncaughtException. A few more tests are passing for qscriptvalue and qscriptqobject. Reviewed-by: Kent Hansen
* Clear the exceptions before calling a function.Olivier Goffart2009-07-241-4/+24
| | | | | | | | So the exception we get as result are the one thrown by the function. (fix tst_QScriptEngine::newRegExp test) Reviewed-by: Kent Hansen
* Implement QScriptString as a wraper around the JSC::IdentifierOlivier Goffart2009-07-231-64/+75
|
* make QScriptValue::{call,construct}() use JSC::{call,construct}()Kent Hansen2009-07-231-56/+4
| | | | | Support has been added to the JSC functions to support host functions as well, so now we can use them directly.
* More tests fixed (QScriptValue::toString)Olivier Goffart2009-07-221-0/+8
| | | | | | Handle Exception in a toString function Reviewed-by: Kent Hansen
* Fix the return value of a function call that throws an error.Ariya Hidayat2009-07-171-1/+3
|
* Fix the return value of a constructor that throws an error.Ariya Hidayat2009-07-171-1/+3
|
* implement cyclic prototype chain checkKent Hansen2009-07-171-1/+12
|
* make QScriptValue::toString() et al work when there's an exceptionKent Hansen2009-07-171-11/+75
| | | | | JSC refuses to call functions when there's an exception that hasn't been dealt with, so save the exception and restore it afterwards.
* We cant rely on property attributes from JavaScriptCore for the setter and ↵Olivier Goffart2009-07-161-3/+3
| | | | getter
* Convert the strings or number value to jscvalue when they are used with an ↵Olivier Goffart2009-07-161-12/+14
| | | | | | | engine Also change the stringValue not to be a pointer. This fixes a memory leak.
* don't try to be so cleverKent Hansen2009-07-151-7/+4
| | | | | | If we implement the ability to change the global object, the global object pointer can change, so we need to keep a reference to the object if it's stored in a QScriptValue.
* implement ability to dynamically change class of script objectsKent Hansen2009-07-101-25/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* use JSC::call() and JSC::construct()Kent Hansen2009-07-091-54/+2
|
* Fix autotest checking QScriptValue::objectId method.Jedrzej Nowacki2009-07-091-7/+2
| | | | (QScriptValue::objectId() and QScriptEnigne::objectById)
* use currentFrame instead of globalExec whenever we canKent Hansen2009-07-091-27/+27
|
* support callees that are not function objectsKent Hansen2009-07-091-4/+4
| | | | E.g. QScriptClass-based objects.
* rewrite most of QScriptContext handlingKent Hansen2009-07-081-5/+90
| | | | Do it The right way(TM), by lazily wrapping JSC::ExecState objects.
* Fix engineDelete autotest.Jedrzej Nowacki2009-07-081-2/+27
|
* work on QScriptEngine::uncaughtException()Kent Hansen2009-07-071-2/+10
| | | | | | It's possible that JSC evaluate() returns a completion of type Throw without hadException() being true, so we need to store the exception value explicitly.
* fix QScriptValue::construct() when argument is not array-likeKent Hansen2009-07-061-4/+2
|
* make QScriptClass::HasInstance extension workKent Hansen2009-07-061-1/+1
|
* make more tests passKent Hansen2009-07-031-4/+0
|
* implement a fair amount of the QScriptClass functionalityKent Hansen2009-07-021-7/+15
| | | | | Enumeration is missing, as is the ability to change the class of an object after it has been created.
* implement QScriptValue::QObjectMember property flagKent Hansen2009-07-021-0/+2
|
* use the JSC::Getter and JSC::Setter flagsKent Hansen2009-07-021-4/+2
|
* implement QScriptValue::isQMetaObject() and QScriptValue::toQMetaObject()Kent Hansen2009-06-261-10/+8
|
* implement QMetaObject bindingsKent Hansen2009-06-261-2/+2
|
* work on signal bindings (connect, disconnect, signal emission)Kent Hansen2009-06-241-3/+3
|
* make more qscriptengine tests runKent Hansen2009-06-241-4/+10
| | | | | Not everything passes but at least nothing asserts anymore, so the test runs to completion.
* make most of the qscriptvalue tests passKent Hansen2009-06-231-69/+138
| | | | call(), construct() etc.
* use JSC::asObject()Kent Hansen2009-06-231-40/+36
|
* Import JSC-based Qt Script from Kent's tree.Simon Hausmann2009-06-161-0/+2303