| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
|
|
|
|
|
| |
pushed
Reviewed-by: Kent Hansen
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
We're using a wrapper around TimeoutChecker, where we
re-implement didTimeout() to call processEvents().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
| |
Reviewed-by: Kent Hansen
|
| |
|
|
|
|
|
|
| |
Some function (such as JSValue::strictEquals) are declared inline in
Operations.h and if that header is not included, that will produce link
errors
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
The 'this' value was not correctly set when evaluating
Reviewed-by: Kent Hansen
|
|
|
|
|
|
|
| |
The 'arguments' is not handled by JavaScriptCore for native function. We
have to do that manually
Reviewed-by: Kent Hansen
|
|
|
|
|
|
|
|
|
| |
As specified in the specification.
The QScriptEngine::newRegExp on the other hand used to work with invalid
flags.
Reviewed-by: Kent Hansen
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
| |
Enable the tests checking the line number of exception.
Add a lower bound on the lineNumber of QScriptEngin::evaluate()
|
|
|
|
|
|
|
|
|
| |
Use the exception from JSC::exec instead of
QScriptEngin::uncaughtException.
A few more tests are passing for qscriptvalue and qscriptqobject.
Reviewed-by: Kent Hansen
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Better than relying on a custom Global Object.
|
| |
|
| |
|
|
|
|
|
| |
No need to expose the fact that we go via the Global Object
to get an engine pointer.
|
| |
|
| |
|
| |
|
|
|
|
| |
There was a bug in commit 1d56e14605d74aefb955bdd81ee4083131252c9e
|
| |
|
|
|
|
| |
D'oh, inverse logic.
|
|
|
|
|
|
|
| |
engine
Also change the stringValue not to be a pointer. This fixes a memory
leak.
|
|
|
|
|
|
| |
as its prototype
port of commit 4182e9c4b2cbfcd0604c57da210e97d68cbbbb52 in qt/master.
|
|
|
|
| |
NativeFunctionWrapper is typedef for JSFunction
|
|
|
|
|
|
|
| |
For some reason our Global Object is not marked by the collector.
This fixes the case when you invoke GC explicitly by calling
collectGarbage(), but the issue is probably still there when GC
is invoked implicitly.
|
| |
|
|
|
|
|
| |
Doesn't actually replace the global object, but rather has the
standard global object act as a proxy to the custom one.
|
| |
|
| |
|
|
|
|
| |
allow stuff to run, even though it's likely to crash/not work...
|
|
|
|
|
| |
Caller is responsible for calling marked() before mark(),
otherwise you might get infinite recursion.
|
|\
| |
| |
| | |
git@scm.dev.nokia.troll.no:qt/qt-webkit into qtscript-jsc-backend
|
| |
| |
| |
| |
| |
| | |
Also, have pushContext() return currentContext() for now, to
avoid crashing, and disable processing of __postInit__ property
in importExtension() for same reason.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
|
|/ |
|
|
|
|
| |
The old engine did it as well. Makes more tests pass.
|
|
|
|
| |
(QScriptValue::objectId() and QScriptEnigne::objectById)
|