summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptengine.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactor the way the JS stack are created for native functionOlivier Goffart2009-08-121-37/+63
| | | | | | | | | | 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
* Move JSC::Debugger's events calls from JSC::evaluate() toJedrzej Nowacki2009-08-121-1/+31
| | | | | | | QSCriptEngine::evaluate() Fix broken behavior after bad integration with 538153994cacc4613aef1eb8ef77e501be7f5a88 commit
* Crash fix.Jedrzej Nowacki2009-08-121-1/+2
| | | | | | Fix GetSetAgent() in tst_qscriptengine. Reviewed-by: TrustMe
* Implement connection between JSC::Debugger and QScriptEngineAgent.Jedrzej Nowacki2009-08-111-8/+9
| | | | | | | | | | | Complete reimplementation of QScriptEngineAgentPrivate. New QScriptEngineAgentPrivate implementation makes conversion from different JSC::Debuger types and events to corresponding QScriptEngineAgent. contextPush and contextPop events are created in QScriptEngine each time contextPush or contextPop is ordered from public API
* get rid of dynamic castsKent Hansen2009-08-101-4/+9
|
* cleanup (hide the use of reinterpret_cast)Kent Hansen2009-08-101-1/+10
| | | | | Introduce a frameForContext() function so we don't have to cast all over the place.
* finish implementation of QScriptEngine::importExtension()Kent Hansen2009-08-101-24/+25
| | | | | Added the properties to the activation object: __extension__, __setupPackage__ and __postInit__.
* 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-8/+11
|
* make QScriptEngine::newQMetaObject() workKent Hansen2009-08-051-1/+1
|
* don't store QScriptEngine pointer in native function wrappersKent Hansen2009-08-051-3/+3
| | | | | We can infer it from the JSC environment when the function is actually called.
* remove unused codeOlivier Goffart2009-08-041-5/+0
|
* clear abort flag when we start a new evaluateKent Hansen2009-08-041-0/+1
| | | | | Otherwise evaluate() would _always_ return the value previously passed to abortEvaluation(), once a script had been aborted.
* move Global Object to its own fileKent Hansen2009-08-041-132/+1
|
* adapt to commit 014c4c63066fd3920594e6a58b02f314b5c88cdfKent Hansen2009-08-041-6/+7
|
* Do not crash if using popContext() while the current context have not been ↵Olivier Goffart2009-08-041-0/+5
| | | | | | pushed Reviewed-by: Kent Hansen
* Implement QScriptEngine::abortEvaluation()Tor Arne Vestbø2009-08-031-3/+15
| | | | | | 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.
* Implement QScriptEngine::setProcessEventsInterval()Tor Arne Vestbø2009-08-031-5/+35
| | | | | We're using a wrapper around TimeoutChecker, where we re-implement didTimeout() to call processEvents().
* Remove QScriptContextPrivate, QScriptContext is now a JSC::CallFrameOlivier Goffart2009-07-311-16/+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-1/+1
|
* Small Refactoring of QScriptOlivier Goffart2009-07-311-0/+20
| | | | | | | | | - 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-311-6/+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.
* attempt to return something sensible in uncaughtExceptionBacktrace()Kent Hansen2009-07-301-4/+10
| | | | | | | | JSC doesn't provide a way to get the backtrace after the exception has happened (you can only get it at the point it's thrown, by installing a debugger). As a least effort, we try to use the uncaught exception to provide a 1-line backtrace (the filename and linenumber of the innermost call where the exception happened).
* Implement QScriptEngine::pushContext end popContextOlivier Goffart2009-07-301-3/+25
| | | | Reviewed-by: Kent Hansen
* Fix license headersOlivier Goffart2009-07-291-4/+34
|
* Compile in release mode.Olivier Goffart2009-07-291-0/+1
| | | | | | Some function (such as JSValue::strictEquals) are declared inline in Operations.h and if that header is not included, that will produce link errors
* Enter a scope when enterning a native function.Olivier Goffart2009-07-291-12/+22
| | | | | | | | | | | | | | 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
* Fix tst_QScriptEngine::uncaughtExceptionOlivier Goffart2009-07-281-1/+0
| | | | | | | | | | | | The test used to test that passing 0 as line number works. There is no reason to impose the lineNumber to be >= 1, this is an arbitrary limitation. It even works when passing negative value, but as -1 is a magic number, an error on line '-1' will not have lineNumber Reviewed-by: Kent Hansen
* Fix tst_QScriptEngine::nestedEvaluateOlivier Goffart2009-07-281-1/+16
| | | | | | The 'this' value was not correctly set when evaluating Reviewed-by: Kent Hansen
* Make the 'arguments' object working when calling eval from native functionsOlivier Goffart2009-07-281-2/+7
| | | | | | | The 'arguments' is not handled by JavaScriptCore for native function. We have to do that manually Reviewed-by: Kent Hansen
* Change JavaScriptCore so it throw error when passing invalid regexp flagOlivier Goffart2009-07-281-1/+8
| | | | | | | | | As specified in the specification. The QScriptEngine::newRegExp on the other hand used to work with invalid flags. Reviewed-by: Kent Hansen
* compileKent Hansen2009-07-271-3/+3
|
* make QScriptEngine::setGlobalObject() work to some extentKent Hansen2009-07-271-20/+128
| | | | | | | | | | | | | | | | | | | | | | | | | 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-33/+28
| | | | | | | | | | | 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).
* The line number is correctly reported for exceptionBenjamin Poulain2009-07-271-0/+1
| | | | | Enable the tests checking the line number of exception. Add a lower bound on the lineNumber of QScriptEngin::evaluate()
* Remove the uncaughtException, use the JSC exception insteadBenjamin Poulain2009-07-271-9/+6
| | | | | | | | | 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_QScriptValue::callOlivier Goffart2009-07-271-2/+5
| | | | | | | | | | We have to set the CallFrame correctly in QScriptEngine::evaluate() in order to ger the 'arguments' object and all the local stuff working. The code Assert if dynamicGlobalObject is not set, so set it to the global object. Reviewed-by: Kent Hansen
* use custom JSGlobalData clientdata to keep pointer to script engineKent Hansen2009-07-271-1/+11
| | | | Better than relying on a custom Global Object.
* move engine-specific GC marking to QScriptEnginePrivateKent Hansen2009-07-271-40/+44
|
* use scriptEngineFromExec() in a few more placesKent Hansen2009-07-271-3/+3
|
* introduce scriptEngineFromExec() helper functionKent Hansen2009-07-271-0/+27
| | | | | No need to expose the fact that we go via the Global Object to get an engine pointer.
* Implement QScriptString as a wraper around the JSC::IdentifierOlivier Goffart2009-07-231-1/+2
|
* Try best to convert a regexp to a ECMAScript expressionOlivier Goffart2009-07-231-1/+40
|
* set correct property flags in newFunction()Kent Hansen2009-07-171-2/+3
|
* do the correct prototype checkKent Hansen2009-07-161-2/+1
| | | | There was a bug in commit 1d56e14605d74aefb955bdd81ee4083131252c9e
* start implementing constructors for QMetaObject wrappersKent Hansen2009-07-161-7/+12
|
* fix bug in built-in print() functionKent Hansen2009-07-161-3/+2
| | | | D'oh, inverse logic.
* Convert the strings or number value to jscvalue when they are used with an ↵Olivier Goffart2009-07-161-9/+11
| | | | | | | engine Also change the stringValue not to be a pointer. This fixes a memory leak.
* only set default prototype if resulting object has built-in Object prototype ↵Kent Hansen2009-07-161-1/+4
| | | | | | as its prototype port of commit 4182e9c4b2cbfcd0604c57da210e97d68cbbbb52 in qt/master.
* compile when JIT is enabledKent Hansen2009-07-151-0/+1
| | | | NativeFunctionWrapper is typedef for JSFunction