Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | don't crash during GC if no prototype has been set for a metatype | Kent Hansen | 2009-07-10 | 1 | -4/+7 |
| | | | | | | Also, have pushContext() return currentContext() for now, to avoid crashing, and disable processing of __postInit__ property in importExtension() for same reason. | ||||
* | implement ability to dynamically change class of script objects | Kent Hansen | 2009-07-10 | 12 | -381/+886 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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. | ||||
* | some small fixes/experiments | Kent Hansen | 2009-07-10 | 1 | -4/+20 |
| | |||||
* | QObject.prototype.toString: return undefined if this-object is not a QObject | Kent Hansen | 2009-07-09 | 1 | -1/+1 |
| | | | | Follow behavior of old back-end. Makes qscriptable test pass. | ||||
* | register QScriptValue as meta-type | Kent Hansen | 2009-07-09 | 1 | -0/+2 |
| | | | | The old engine did it as well. Makes more tests pass. | ||||
* | invoke signal handler using JSC::call() | Kent Hansen | 2009-07-09 | 1 | -8/+6 |
| | | | | | Makes sure that new stack frame is set up if the function is native, and all that. | ||||
* | make QObject property setter functions work | Kent Hansen | 2009-07-09 | 1 | -12/+31 |
| | |||||
* | use JSC::call() and JSC::construct() | Kent Hansen | 2009-07-09 | 1 | -54/+2 |
| | |||||
* | create a new frame when calling native constructors | Kent Hansen | 2009-07-09 | 2 | -5/+33 |
| | | | | See commit 103439f4c8a70740d6475af1b1b58deede12d2c3 | ||||
* | make QObject property access use getter+setter functions | Kent Hansen | 2009-07-09 | 1 | -6/+12 |
| | | | | | Setters don't work yet. But hey, the defaultprototypes example finally works. | ||||
* | Fix autotest checking QScriptValue::objectId method. | Jedrzej Nowacki | 2009-07-09 | 4 | -19/+29 |
| | | | | (QScriptValue::objectId() and QScriptEnigne::objectById) | ||||
* | make native object constructors work | Kent Hansen | 2009-07-09 | 1 | -10/+8 |
| | | | | | With commit 6985212c8909c89183b232ca28b96a2c8a2f1385, context->thisObject() now returns the right thing. | ||||
* | create a default-constructed object when calling native constructors | Kent Hansen | 2009-07-09 | 1 | -0/+11 |
| | | | | | | | | | | | | It's up to the implementation of the constructor to decide whether it wants to initialize the default-constructed object, or create and return a new one; just like for JS constructors. We need this functionality in QtScript so that QScriptContext::thisObject() will return the right thing. The built-in constructors (RegExp etc.) should be modified to initialize the default-constructed object instead of always creating a new object (only when RegExp is called as a function should it create a new object). | ||||
* | make arguments object work for native functions | Kent Hansen | 2009-07-09 | 2 | -1/+3 |
| | | | | There's an off-by-one issue that we just work around for now. | ||||
* | implement attributes for arguments.{callee,length} | Kent Hansen | 2009-07-09 | 2 | -0/+11 |
| | | | | Should be DontEnum, as per ECMA-262. | ||||
* | create a new frame when executing native getter/setter functions | Kent Hansen | 2009-07-09 | 2 | -4/+38 |
| | | | | | | Frames are created when calling JS functions, so they should be when calling native functions as well. This makes QScriptContext behave correctly in these cases (see getSetProperty autotest). | ||||
* | use currentFrame instead of globalExec whenever we can | Kent Hansen | 2009-07-09 | 3 | -48/+48 |
| | |||||
* | support callees that are not function objects | Kent Hansen | 2009-07-09 | 2 | -5/+5 |
| | | | | E.g. QScriptClass-based objects. | ||||
* | store frame's callee as a normal JSObject | Kent Hansen | 2009-07-09 | 4 | -22/+21 |
| | | | | | It's possible for any JSObject to be a callee; all it needs to do is implement getCallData(). | ||||
* | rewrite most of QScriptContext handling | Kent Hansen | 2009-07-08 | 9 | -147/+350 |
| | | | | Do it The right way(TM), by lazily wrapping JSC::ExecState objects. | ||||
* | try to get arguments object to work for host call frames | Kent Hansen | 2009-07-08 | 1 | -11/+20 |
| | |||||
* | make JSC::CallFrame::callee() an InternalFunction | Kent Hansen | 2009-07-08 | 4 | -16/+16 |
| | | | | | This makes it possible to obtain the callee for native (host) functions as well. | ||||
* | Fix engineDelete autotest. | Jedrzej Nowacki | 2009-07-08 | 4 | -4/+110 |
| | |||||
* | work on QScriptEngine::uncaughtException() | Kent Hansen | 2009-07-07 | 3 | -8/+22 |
| | | | | | | 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. | ||||
* | mark the QScriptClass object prototype | Kent Hansen | 2009-07-07 | 1 | -0/+2 |
| | |||||
* | start to implement QScriptEngine::importExtension() | Kent Hansen | 2009-07-06 | 1 | -5/+200 |
| | |||||
* | implement QScriptEngine::availableExtensions() | Kent Hansen | 2009-07-06 | 2 | -3/+75 |
| | |||||
* | fix QScriptValue::construct() when argument is not array-like | Kent Hansen | 2009-07-06 | 2 | -4/+8 |
| | |||||
* | make QScriptClass::HasInstance extension work | Kent Hansen | 2009-07-06 | 2 | -2/+2 |
| | |||||
* | start implementing QScriptClass extensions | Kent Hansen | 2009-07-03 | 2 | -1/+50 |
| | | | | Callable seems to work, HasInstance not quite there yet. | ||||
* | make more tests pass | Kent Hansen | 2009-07-03 | 2 | -4/+2 |
| | |||||
* | Attributes and deletion of String object properties | Kent Hansen | 2009-07-03 | 4 | -0/+29 |
| | | | | As per ECMA-262. | ||||
* | make more tests pass | Kent Hansen | 2009-07-03 | 1 | -1/+13 |
| | | | | Implement delete operator for Qt properties. | ||||
* | implement a fair amount of the QScriptClass functionality | Kent Hansen | 2009-07-02 | 4 | -15/+209 |
| | | | | | Enumeration is missing, as is the ability to change the class of an object after it has been created. | ||||
* | implement string-->enum conversion | Kent Hansen | 2009-07-02 | 1 | -1/+9 |
| | |||||
* | first stab at implementing Qt property getter/setters | Kent Hansen | 2009-07-02 | 4 | -24/+230 |
| | | | | Not fully working yet, so disabled for now | ||||
* | implement caching of slot wrapper functions | Kent Hansen | 2009-07-02 | 2 | -1/+42 |
| | |||||
* | implement marking of QObject connection | Kent Hansen | 2009-07-02 | 1 | -8/+9 |
| | |||||
* | implement QScriptValue::QObjectMember property flag | Kent Hansen | 2009-07-02 | 3 | -4/+12 |
| | |||||
* | use the JSC::Getter and JSC::Setter flags | Kent Hansen | 2009-07-02 | 1 | -4/+2 |
| | |||||
* | create a new QScriptContext when calling a Qt method | Kent Hansen | 2009-07-02 | 1 | -2/+14 |
| | | | | Makes the args, thisObject etc. available if QScriptable is used. | ||||
* | implement QObject property flags | Kent Hansen | 2009-07-02 | 1 | -0/+74 |
| | |||||
* | add placeholder implementations of findChild() and findChildren() | Kent Hansen | 2009-07-01 | 1 | -1/+25 |
| | |||||
* | don't crash if isFunction() is called with invalid JS value | Kent Hansen | 2009-06-30 | 1 | -1/+1 |
| | |||||
* | implement setting of default prototype in newQObject() | Kent Hansen | 2009-06-30 | 2 | -14/+51 |
| | |||||
* | implement name-based connection, make more tests work | Kent Hansen | 2009-06-30 | 1 | -7/+13 |
| | |||||
* | port recent changes from qt/master | Kent Hansen | 2009-06-30 | 2 | -7/+20 |
| | | | | Makes variant conversion work for signal handlers. | ||||
* | make part of test not assert | Kent Hansen | 2009-06-29 | 1 | -0/+2 |
| | |||||
* | dummy QScriptContextInfo implementation | Kent Hansen | 2009-06-29 | 1 | -25/+81 |
| | | | | | It doesn't give useful information but at least apps that try to use it (e.g. the qscriptjstestsuite autotest) won't assert now. | ||||
* | disable the JIT for now | Kent Hansen | 2009-06-29 | 1 | -0/+2 |
| | | | | Eases debugging. |