summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptengine_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Refactor the way the JS stack are created for native functionOlivier Goffart2009-08-121-18/+4
| | | | | | | | | | 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
* get rid of dynamic castsKent Hansen2009-08-101-0/+3
|
* cleanup (hide the use of reinterpret_cast)Kent Hansen2009-08-101-2/+3
| | | | | Introduce a frameForContext() function so we don't have to cast all over the place.
* 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
* port commit 47c9e7b1b3551ff6dbe71590461a45ae398a9501 from qt/masterKent Hansen2009-08-061-3/+5
|
* remove unused codeOlivier Goffart2009-08-041-1/+0
|
* Implement QScriptEngine::abortEvaluation()Tor Arne Vestbø2009-08-031-0/+1
| | | | | | We store the abort-state in the TimeoutChecker, since that's where we'll mostly access it, but the abort result is stored in the QScriptEngine's d-pointer.
* Remove QScriptContextPrivate, QScriptContext is now a JSC::CallFrameOlivier Goffart2009-07-311-1/+2
| | | | | | | | | | | | | | There will not be instances of QScriptContext anymore. Pointer to QScriptContext are just pointer to JSC::CallFrame This simplifies the code as we do not need to manage the memory for the QScriptContext anymore. It is compatible because it is not possible to create QScriptContext. They were all created by QScriptEngine. QScriptContext constructor is private. Aknoweldged-by: Kent
* Move the declaration on some function into qscriptengine_p.hOlivier Goffart2009-07-311-11/+18
|
* Small Refactoring of QScriptOlivier Goffart2009-07-311-0/+18
| | | | | | | | | - 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
* Fix license headersOlivier Goffart2009-07-291-4/+34
|
* Fix tst_QScriptEngine::nestedEvaluateOlivier Goffart2009-07-281-0/+1
| | | | | | The 'this' value was not correctly set when evaluating Reviewed-by: Kent Hansen
* make QScriptEngine::setGlobalObject() work to some extentKent Hansen2009-07-271-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+3
| | | | | | | | | | | 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-1/+0
| | | | | | | | | Use the exception from JSC::exec instead of QScriptEngin::uncaughtException. A few more tests are passing for qscriptvalue and qscriptqobject. Reviewed-by: Kent Hansen
* move engine-specific GC marking to QScriptEnginePrivateKent Hansen2009-07-271-0/+1
|
* introduce scriptEngineFromExec() helper functionKent Hansen2009-07-271-27/+0
| | | | | No need to expose the fact that we go via the Global Object to get an engine pointer.
* start implementing constructors for QMetaObject wrappersKent Hansen2009-07-161-0/+1
|
* fix some memory leaksKent Hansen2009-07-151-0/+1
|
* initial attempt at implementing QScriptEngine::setGlobalObject()Kent Hansen2009-07-151-1/+14
| | | | | Doesn't actually replace the global object, but rather has the standard global object act as a proxy to the custom one.
* Merge branch 'qtscript-jsc-backend' of ↵Jedrzej Nowacki2009-07-131-60/+2
|\ | | | | | | git@scm.dev.nokia.troll.no:qt/qt-webkit into qtscript-jsc-backend
| * implement ability to dynamically change class of script objectsKent Hansen2009-07-101-60/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | fix checkSyntax autotest.Jedrzej Nowacki2009-07-131-0/+3
| |
* | fix autotest canEvaluate.Jedrzej Nowacki2009-07-131-1/+2
|/
* Fix autotest checking QScriptValue::objectId method.Jedrzej Nowacki2009-07-091-7/+4
| | | | (QScriptValue::objectId() and QScriptEnigne::objectById)
* rewrite most of QScriptContext handlingKent Hansen2009-07-081-1/+6
| | | | Do it The right way(TM), by lazily wrapping JSC::ExecState objects.
* Fix engineDelete autotest.Jedrzej Nowacki2009-07-081-0/+15
|
* work on QScriptEngine::uncaughtException()Kent Hansen2009-07-071-0/+1
| | | | | | 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.
* implement QScriptEngine::availableExtensions()Kent Hansen2009-07-061-0/+4
|
* start implementing QScriptClass extensionsKent Hansen2009-07-031-1/+7
| | | | Callable seems to work, HasInstance not quite there yet.
* implement a fair amount of the QScriptClass functionalityKent Hansen2009-07-021-1/+57
| | | | | Enumeration is missing, as is the ability to change the class of an object after it has been created.
* first stab at implementing Qt property getter/settersKent Hansen2009-07-021-0/+1
| | | | Not fully working yet, so disabled for now
* implement setting of default prototype in newQObject()Kent Hansen2009-06-301-0/+3
|
* implement QMetaObject bindingsKent Hansen2009-06-261-0/+5
|
* work on signal bindings (connect, disconnect, signal emission)Kent Hansen2009-06-241-0/+16
|
* make more qscriptengine tests runKent Hansen2009-06-241-1/+4
| | | | | Not everything passes but at least nothing asserts anymore, so the test runs to completion.
* Import JSC-based Qt Script from Kent's tree.Simon Hausmann2009-06-161-0/+157