aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml')
-rw-r--r--src/qml/qml/qqmlboundsignal.cpp6
-rw-r--r--src/qml/qml/qqmlboundsignal_p.h2
-rw-r--r--src/qml/qml/qqmlcomponent.cpp23
-rw-r--r--src/qml/qml/qqmlcontextwrapper.cpp18
-rw-r--r--src/qml/qml/qqmlcontextwrapper_p.h4
-rw-r--r--src/qml/qml/qqmllistwrapper.cpp1
-rw-r--r--src/qml/qml/qqmllocale_p.h2
-rw-r--r--src/qml/qml/qqmltypewrapper.cpp2
-rw-r--r--src/qml/qml/qqmlvaluetypewrapper.cpp10
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp61
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions.cpp28
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions_p.h2
-rw-r--r--src/qml/qml/v8/qv4domerrors_p.h2
-rw-r--r--src/qml/qml/v8/qv8debug_p.h34
-rw-r--r--src/qml/qml/v8/qv8engine.cpp17
-rw-r--r--src/qml/qml/v8/qv8engine_p.h4
-rw-r--r--src/qml/qml/v8/v8.pri1
17 files changed, 88 insertions, 129 deletions
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp
index 26fe659616..cabb76db48 100644
--- a/src/qml/qml/qqmlboundsignal.cpp
+++ b/src/qml/qml/qqmlboundsignal.cpp
@@ -76,8 +76,8 @@ QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index,
const QString &handlerName,
const QString &parameterString)
: QQmlJavaScriptExpression(&QQmlBoundSignalExpression_jsvtable),
- m_target(target),
m_index(index),
+ m_target(target),
m_extra(new ExtraData(handlerName, parameterString, expression, fileName, line, column))
{
setExpressionFunctionValid(false);
@@ -88,9 +88,9 @@ QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index,
QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index, QQmlContextData *ctxt, QObject *scope, const QV4::ValueRef &function)
: QQmlJavaScriptExpression(&QQmlBoundSignalExpression_jsvtable),
+ m_index(index),
m_v8function(function),
m_target(target),
- m_index(index),
m_extra(0)
{
setExpressionFunctionValid(true);
@@ -101,8 +101,8 @@ QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index,
QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index, QQmlContextData *ctxt, QObject *scope, QV4::Function *runtimeFunction)
: QQmlJavaScriptExpression(&QQmlBoundSignalExpression_jsvtable),
- m_target(target),
m_index(index),
+ m_target(target),
m_extra(0)
{
setExpressionFunctionValid(true);
diff --git a/src/qml/qml/qqmlboundsignal_p.h b/src/qml/qml/qqmlboundsignal_p.h
index b9f519a920..d2fec2afc8 100644
--- a/src/qml/qml/qqmlboundsignal_p.h
+++ b/src/qml/qml/qqmlboundsignal_p.h
@@ -98,10 +98,10 @@ private:
bool invalidParameterName() const { return m_extra.flag2(); }
void setInvalidParameterName(bool v) { m_extra.setFlag2Value(v); }
+ int m_index;
QV4::PersistentValue m_v8function;
QObject *m_target;
- int m_index;
// only needed when !expressionFunctionValid()
struct ExtraData {
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 63a43966b1..980fc99b92 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -1090,7 +1090,7 @@ struct QmlIncubatorObject : public QV4::Object
static QV4::ReturnedValue method_forceCompletion(QV4::CallContext *ctx);
static void destroy(Managed *that);
- static void markObjects(Managed *that, QV4::ExecutionEngine *e);
+ static void markObjects(QV4::HeapObject *that, QV4::ExecutionEngine *e);
void statusChanged(QQmlIncubator::Status);
void setInitialState(QObject *);
@@ -1416,7 +1416,7 @@ QV4::ReturnedValue QmlIncubatorObject::method_get_object(QV4::CallContext *ctx)
QV4::Scope scope(ctx);
QV4::Scoped<QmlIncubatorObject> o(scope, ctx->d()->callData->thisObject.as<QmlIncubatorObject>());
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
return QV4::QObjectWrapper::wrap(ctx->d()->engine, o->d()->incubator->object());
}
@@ -1426,7 +1426,7 @@ QV4::ReturnedValue QmlIncubatorObject::method_forceCompletion(QV4::CallContext *
QV4::Scope scope(ctx);
QV4::Scoped<QmlIncubatorObject> o(scope, ctx->d()->callData->thisObject.as<QmlIncubatorObject>());
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
o->d()->incubator->forceCompletion();
@@ -1438,7 +1438,7 @@ QV4::ReturnedValue QmlIncubatorObject::method_get_status(QV4::CallContext *ctx)
QV4::Scope scope(ctx);
QV4::Scoped<QmlIncubatorObject> o(scope, ctx->d()->callData->thisObject.as<QmlIncubatorObject>());
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
return QV4::Encode(o->d()->incubator->status());
}
@@ -1448,7 +1448,7 @@ QV4::ReturnedValue QmlIncubatorObject::method_get_statusChanged(QV4::CallContext
QV4::Scope scope(ctx);
QV4::Scoped<QmlIncubatorObject> o(scope, ctx->d()->callData->thisObject.as<QmlIncubatorObject>());
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
return o->d()->statusChanged.asReturnedValue();
}
@@ -1458,7 +1458,7 @@ QV4::ReturnedValue QmlIncubatorObject::method_set_statusChanged(QV4::CallContext
QV4::Scope scope(ctx);
QV4::Scoped<QmlIncubatorObject> o(scope, ctx->d()->callData->thisObject.as<QmlIncubatorObject>());
if (!o || ctx->d()->callData->argc < 1)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
o->d()->statusChanged = ctx->d()->callData->args[0];
@@ -1503,13 +1503,12 @@ void QmlIncubatorObject::destroy(Managed *that)
static_cast<QmlIncubatorObject *>(that)->d()->~Data();
}
-void QmlIncubatorObject::markObjects(QV4::Managed *that, QV4::ExecutionEngine *e)
+void QmlIncubatorObject::markObjects(QV4::HeapObject *that, QV4::ExecutionEngine *e)
{
- QmlIncubatorObject *o = static_cast<QmlIncubatorObject *>(that);
- Q_ASSERT(that->as<QmlIncubatorObject>());
- o->d()->valuemap.mark(e);
- o->d()->qmlGlobal.mark(e);
- o->d()->statusChanged.mark(e);
+ QmlIncubatorObject::Data *o = static_cast<QmlIncubatorObject::Data *>(that);
+ o->valuemap.mark(e);
+ o->qmlGlobal.mark(e);
+ o->statusChanged.mark(e);
Object::markObjects(that, e);
}
diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp
index 0816bc05df..df62f285e3 100644
--- a/src/qml/qml/qqmlcontextwrapper.cpp
+++ b/src/qml/qml/qqmlcontextwrapper.cpp
@@ -291,7 +291,7 @@ void QmlContextWrapper::put(Managed *m, String *name, const ValueRef value)
QString error = QLatin1String("Invalid write to global property \"") + name->toQString() +
QLatin1Char('"');
Scoped<String> e(scope, v4->currentContext()->d()->engine->newString(error));
- v4->currentContext()->throwError(e);
+ v4->throwError(e);
return;
}
@@ -335,7 +335,7 @@ void QmlContextWrapper::put(Managed *m, String *name, const ValueRef value)
if (wrapper->d()->readOnly) {
QString error = QLatin1String("Invalid write to global property \"") + name->toQString() +
QLatin1Char('"');
- v4->currentContext()->throwError(error);
+ v4->throwError(error);
return;
}
@@ -347,11 +347,11 @@ void QmlContextWrapper::destroy(Managed *that)
static_cast<QmlContextWrapper *>(that)->d()->~Data();
}
-void QmlContextWrapper::markObjects(Managed *m, ExecutionEngine *engine)
+void QmlContextWrapper::markObjects(HeapObject *m, ExecutionEngine *engine)
{
- QmlContextWrapper *This = static_cast<QmlContextWrapper*>(m);
- if (This->d()->idObjectsWrapper)
- This->d()->idObjectsWrapper->mark(engine);
+ QmlContextWrapper::Data *This = static_cast<QmlContextWrapper::Data *>(m);
+ if (This->idObjectsWrapper)
+ This->idObjectsWrapper->mark(engine);
Object::markObjects(m, engine);
}
@@ -465,10 +465,10 @@ ReturnedValue QQmlIdObjectsArray::getIndexed(Managed *m, uint index, bool *hasPr
return QObjectWrapper::wrap(This->engine(), context->idValues[index].data());
}
-void QQmlIdObjectsArray::markObjects(Managed *that, ExecutionEngine *engine)
+void QQmlIdObjectsArray::markObjects(HeapObject *that, ExecutionEngine *engine)
{
- QQmlIdObjectsArray *This = static_cast<QQmlIdObjectsArray*>(that);
- This->d()->contextWrapper->mark(engine);
+ QQmlIdObjectsArray::Data *This = static_cast<QQmlIdObjectsArray::Data *>(that);
+ This->contextWrapper->mark(engine);
Object::markObjects(that, engine);
}
diff --git a/src/qml/qml/qqmlcontextwrapper_p.h b/src/qml/qml/qqmlcontextwrapper_p.h
index cae6800f48..ae9e795a5c 100644
--- a/src/qml/qml/qqmlcontextwrapper_p.h
+++ b/src/qml/qml/qqmlcontextwrapper_p.h
@@ -93,7 +93,7 @@ struct Q_QML_EXPORT QmlContextWrapper : Object
static ReturnedValue get(Managed *m, String *name, bool *hasProperty);
static void put(Managed *m, String *name, const ValueRef value);
static void destroy(Managed *that);
- static void markObjects(Managed *m, ExecutionEngine *engine);
+ static void markObjects(HeapObject *m, ExecutionEngine *engine);
static void registerQmlDependencies(ExecutionEngine *context, const CompiledData::Function *compiledFunction);
@@ -111,7 +111,7 @@ struct QQmlIdObjectsArray : public Object
V4_OBJECT(Object)
static ReturnedValue getIndexed(Managed *m, uint index, bool *hasProperty);
- static void markObjects(Managed *that, ExecutionEngine *engine);
+ static void markObjects(HeapObject *that, ExecutionEngine *engine);
};
diff --git a/src/qml/qml/qqmllistwrapper.cpp b/src/qml/qml/qqmllistwrapper.cpp
index 13e5e49b55..b62689c454 100644
--- a/src/qml/qml/qqmllistwrapper.cpp
+++ b/src/qml/qml/qqmllistwrapper.cpp
@@ -35,6 +35,7 @@
#include <private/qv8engine_p.h>
#include <private/qqmllist_p.h>
#include <private/qv4objectproto_p.h>
+#include <qv4objectiterator_p.h>
#include <private/qv4functionobject_p.h>
diff --git a/src/qml/qml/qqmllocale_p.h b/src/qml/qml/qqmllocale_p.h
index 3787517038..233624453f 100644
--- a/src/qml/qml/qqmllocale_p.h
+++ b/src/qml/qml/qqmllocale_p.h
@@ -137,7 +137,7 @@ struct QQmlLocaleData : public QV4::Object
QV4::Object *o = ctx->d()->callData->thisObject.asObject();
QQmlLocaleData *thisObject = o ? o->as<QQmlLocaleData>() : 0;
if (!thisObject) {
- ctx->throwTypeError();
+ ctx->engine()->throwTypeError();
return 0;
}
return &thisObject->d()->locale;
diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp
index d8f282c030..ddd934c840 100644
--- a/src/qml/qml/qqmltypewrapper.cpp
+++ b/src/qml/qml/qqmltypewrapper.cpp
@@ -262,7 +262,7 @@ void QmlTypeWrapper::put(Managed *m, String *name, const ValueRef value)
QV4::ScopedObject apiprivate(scope, QJSValuePrivate::get(siinfo->scriptApi(e))->value);
if (!apiprivate) {
QString error = QLatin1String("Cannot assign to read-only property \"") + name->toQString() + QLatin1Char('\"');
- v4->currentContext()->throwError(error);
+ v4->throwError(error);
return;
} else {
apiprivate->put(name, value);
diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp
index b0125b4c13..7de15eac7d 100644
--- a/src/qml/qml/qqmlvaluetypewrapper.cpp
+++ b/src/qml/qml/qqmlvaluetypewrapper.cpp
@@ -144,7 +144,7 @@ ReturnedValue QmlValueTypeWrapper::create(QV8Engine *v8, QObject *object, int pr
Scope scope(v4);
initProto(v4);
- QmlValueTypeReference *r = v4->memoryManager->alloc<QmlValueTypeReference>(v8);
+ Scoped<QmlValueTypeReference> r(scope, v4->memoryManager->alloc<QmlValueTypeReference>(v8));
r->d()->internalClass = r->d()->internalClass->changePrototype(v4->qmlExtensions()->valueTypeWrapperPrototype);
r->d()->type = type; r->d()->object = object; r->d()->property = property;
return r->asReturnedValue();
@@ -156,7 +156,7 @@ ReturnedValue QmlValueTypeWrapper::create(QV8Engine *v8, const QVariant &value,
Scope scope(v4);
initProto(v4);
- QmlValueTypeCopy *r = v4->memoryManager->alloc<QmlValueTypeCopy>(v8);
+ Scoped<QmlValueTypeCopy> r(scope, v4->memoryManager->alloc<QmlValueTypeCopy>(v8));
r->d()->internalClass = r->d()->internalClass->changePrototype(v4->qmlExtensions()->valueTypeWrapperPrototype);
r->d()->type = type; r->d()->value = value;
return r->asReturnedValue();
@@ -242,10 +242,10 @@ ReturnedValue QmlValueTypeWrapper::method_toString(CallContext *ctx)
{
Object *o = ctx->d()->callData->thisObject.asObject();
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
QmlValueTypeWrapper *w = o->as<QmlValueTypeWrapper>();
if (!w)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
if (w->d()->objectType == QmlValueTypeWrapper::Reference) {
QmlValueTypeReference *reference = static_cast<QmlValueTypeReference *>(w);
@@ -355,7 +355,7 @@ void QmlValueTypeWrapper::put(Managed *m, String *name, const ValueRef value)
// assigning a JS function to a non-var-property is not allowed.
QString error = QLatin1String("Cannot assign JavaScript function to value-type property");
Scoped<String> e(scope, r->d()->v8->toString(error));
- v4->currentContext()->throwError(e);
+ v4->throwError(e);
return;
}
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index 0730cbc363..2acd40ae44 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -55,6 +55,7 @@
#include <QtCore/qxmlstream.h>
#include <QtCore/qstack.h>
#include <QtCore/qdebug.h>
+#include <QtCore/qbuffer.h>
#include <private/qv4objectproto_p.h>
#include <private/qv4scopedvalue_p.h>
@@ -65,7 +66,7 @@ using namespace QV4;
#define V4THROW_REFERENCE(string) { \
Scoped<Object> error(scope, ctx->engine()->newReferenceErrorObject(QStringLiteral(string))); \
- return ctx->throwError(error); \
+ return ctx->engine()->throwError(error); \
}
QT_BEGIN_NAMESPACE
@@ -420,7 +421,7 @@ ReturnedValue NodePrototype::method_get_nodeName(CallContext *ctx)
Scope scope(ctx);
Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
if (!r)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
QString name;
switch (r->d()->d->type) {
@@ -445,7 +446,7 @@ ReturnedValue NodePrototype::method_get_nodeValue(CallContext *ctx)
Scope scope(ctx);
Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
if (!r)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
if (r->d()->d->type == NodeImpl::Document ||
r->d()->d->type == NodeImpl::DocumentFragment ||
@@ -464,7 +465,7 @@ ReturnedValue NodePrototype::method_get_nodeType(CallContext *ctx)
Scope scope(ctx);
Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
if (!r)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
return Encode(r->d()->d->type);
}
@@ -474,7 +475,7 @@ ReturnedValue NodePrototype::method_get_parentNode(CallContext *ctx)
Scope scope(ctx);
Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
if (!r)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
QV8Engine *engine = ctx->d()->engine->v8Engine;
@@ -489,7 +490,7 @@ ReturnedValue NodePrototype::method_get_childNodes(CallContext *ctx)
Scope scope(ctx);
Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
if (!r)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
QV8Engine *engine = ctx->d()->engine->v8Engine;
@@ -501,7 +502,7 @@ ReturnedValue NodePrototype::method_get_firstChild(CallContext *ctx)
Scope scope(ctx);
Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
if (!r)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
QV8Engine *engine = ctx->d()->engine->v8Engine;
@@ -516,7 +517,7 @@ ReturnedValue NodePrototype::method_get_lastChild(CallContext *ctx)
Scope scope(ctx);
Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
if (!r)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
QV8Engine *engine = ctx->d()->engine->v8Engine;
@@ -531,7 +532,7 @@ ReturnedValue NodePrototype::method_get_previousSibling(CallContext *ctx)
Scope scope(ctx);
Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
if (!r)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
QV8Engine *engine = ctx->d()->engine->v8Engine;
@@ -555,7 +556,7 @@ ReturnedValue NodePrototype::method_get_nextSibling(CallContext *ctx)
Scope scope(ctx);
Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
if (!r)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
QV8Engine *engine = ctx->d()->engine->v8Engine;
@@ -579,7 +580,7 @@ ReturnedValue NodePrototype::method_get_attributes(CallContext *ctx)
Scope scope(ctx);
Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
if (!r)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
QV8Engine *engine = ctx->d()->engine->v8Engine;
@@ -899,7 +900,7 @@ ReturnedValue NamedNodeMap::getIndexed(Managed *m, uint index, bool *hasProperty
if (!r) {
if (hasProperty)
*hasProperty = false;
- return v4->currentContext()->throwTypeError();
+ return v4->throwTypeError();
}
QV8Engine *engine = v4->v8Engine;
@@ -1249,16 +1250,23 @@ void QQmlXMLHttpRequest::requestFromUrl(const QUrl &url)
}
}
- if (m_method == QLatin1String("GET"))
+ if (m_method == QLatin1String("GET")) {
m_network = networkAccessManager()->get(request);
- else if (m_method == QLatin1String("HEAD"))
+ } else if (m_method == QLatin1String("HEAD")) {
m_network = networkAccessManager()->head(request);
- else if (m_method == QLatin1String("POST"))
+ } else if (m_method == QLatin1String("POST")) {
m_network = networkAccessManager()->post(request, m_data);
- else if (m_method == QLatin1String("PUT"))
+ } else if (m_method == QLatin1String("PUT")) {
m_network = networkAccessManager()->put(request, m_data);
- else if (m_method == QLatin1String("DELETE"))
+ } else if (m_method == QLatin1String("DELETE")) {
m_network = networkAccessManager()->deleteResource(request);
+ } else if (m_method == QLatin1String("OPTIONS")) {
+ QBuffer *buffer = new QBuffer;
+ buffer->setData(m_data);
+ buffer->open(QIODevice::ReadOnly);
+ m_network = networkAccessManager()->sendCustomRequest(request, QByteArrayLiteral("OPTIONS"), buffer);
+ buffer->setParent(m_network);
+ }
QObject::connect(m_network, SIGNAL(readyRead()),
this, SLOT(readyRead()));
@@ -1526,14 +1534,14 @@ void QQmlXMLHttpRequest::dispatchCallbackImpl(const ValueRef me)
QV4::Scope scope(v4);
Scoped<Object> o(scope, me);
if (!o) {
- ctx->throwError(QStringLiteral("QQmlXMLHttpRequest: internal error: empty ThisObject"));
+ ctx->engine()->throwError(QStringLiteral("QQmlXMLHttpRequest: internal error: empty ThisObject"));
return;
}
ScopedString s(scope, v4->newString(QStringLiteral("ThisObject")));
Scoped<Object> thisObj(scope, o->get(s.getPointer()));
if (!thisObj) {
- ctx->throwError(QStringLiteral("QQmlXMLHttpRequest: internal error: empty ThisObject"));
+ ctx->engine()->throwError(QStringLiteral("QQmlXMLHttpRequest: internal error: empty ThisObject"));
return;
}
@@ -1547,7 +1555,7 @@ void QQmlXMLHttpRequest::dispatchCallbackImpl(const ValueRef me)
s = v4->newString(QStringLiteral("ActivationObject"));
Scoped<Object> activationObject(scope, o->get(s.getPointer()));
if (!activationObject) {
- v4->currentContext()->throwError(QStringLiteral("QQmlXMLHttpRequest: internal error: empty ActivationObject"));
+ v4->throwError(QStringLiteral("QQmlXMLHttpRequest: internal error: empty ActivationObject"));
return;
}
@@ -1631,10 +1639,10 @@ struct QQmlXMLHttpRequestCtor : public FunctionObject
Object *proto;
};
V4_OBJECT(FunctionObject)
- static void markObjects(Managed *that, ExecutionEngine *e) {
- QQmlXMLHttpRequestCtor *c = static_cast<QQmlXMLHttpRequestCtor *>(that);
- if (c->d()->proto)
- c->d()->proto->mark(e);
+ static void markObjects(HeapObject *that, ExecutionEngine *e) {
+ QQmlXMLHttpRequestCtor::Data *c = static_cast<QQmlXMLHttpRequestCtor::Data *>(that);
+ if (c->proto)
+ c->proto->mark(e);
FunctionObject::markObjects(that, e);
}
static ReturnedValue construct(Managed *that, QV4::CallData *)
@@ -1642,7 +1650,7 @@ struct QQmlXMLHttpRequestCtor : public FunctionObject
Scope scope(that->engine());
Scoped<QQmlXMLHttpRequestCtor> ctor(scope, that->as<QQmlXMLHttpRequestCtor>());
if (!ctor)
- return that->engine()->currentContext()->throwTypeError();
+ return that->engine()->throwTypeError();
QV8Engine *engine = that->engine()->v8Engine;
QQmlXMLHttpRequest *r = new QQmlXMLHttpRequest(engine, engine->networkAccessManager());
@@ -1724,7 +1732,8 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_open(CallContext *ctx)
method != QLatin1String("PUT") &&
method != QLatin1String("HEAD") &&
method != QLatin1String("POST") &&
- method != QLatin1String("DELETE"))
+ method != QLatin1String("DELETE") &&
+ method != QLatin1String("OPTIONS"))
V4THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Unsupported HTTP method type");
// Argument 1 - URL
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
index f222d59494..3a593d1c5b 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
@@ -1004,7 +1004,7 @@ ReturnedValue QtObject::method_createQmlObject(CallContext *ctx)
if (component.isError()) {
ScopedValue v(scope, Error::create(ctx->d()->engine, component.errors()));
- return ctx->throwError(v);
+ return ctx->engine()->throwError(v);
}
if (!component.isReady())
@@ -1028,7 +1028,7 @@ ReturnedValue QtObject::method_createQmlObject(CallContext *ctx)
if (component.isError()) {
ScopedValue v(scope, Error::create(ctx->d()->engine, component.errors()));
- return ctx->throwError(v);
+ return ctx->engine()->throwError(v);
}
Q_ASSERT(obj);
@@ -1070,7 +1070,7 @@ use \l{QtQml::Qt::createQmlObject()}{Qt.createQmlObject()}.
ReturnedValue QtObject::method_createComponent(CallContext *ctx)
{
if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 3)
- return ctx->throwError(QStringLiteral("Qt.createComponent(): Invalid arguments"));
+ return ctx->engine()->throwError(QStringLiteral("Qt.createComponent(): Invalid arguments"));
Scope scope(ctx);
@@ -1098,13 +1098,13 @@ ReturnedValue QtObject::method_createComponent(CallContext *ctx)
if (ctx->d()->callData->args[1].isInteger()) {
int mode = ctx->d()->callData->args[1].integerValue();
if (mode != int(QQmlComponent::PreferSynchronous) && mode != int(QQmlComponent::Asynchronous))
- return ctx->throwError(QStringLiteral("Qt.createComponent(): Invalid arguments"));
+ return ctx->engine()->throwError(QStringLiteral("Qt.createComponent(): Invalid arguments"));
compileMode = QQmlComponent::CompilationMode(mode);
consumedCount += 1;
} else {
// The second argument could be the parent only if there are exactly two args
if ((ctx->d()->callData->argc != 2) || !(lastArg->isObject() || lastArg->isNull()))
- return ctx->throwError(QStringLiteral("Qt.createComponent(): Invalid arguments"));
+ return ctx->engine()->throwError(QStringLiteral("Qt.createComponent(): Invalid arguments"));
}
if (consumedCount < ctx->d()->callData->argc) {
@@ -1113,11 +1113,11 @@ ReturnedValue QtObject::method_createComponent(CallContext *ctx)
if (qobjectWrapper)
parentArg = qobjectWrapper->object();
if (!parentArg)
- return ctx->throwError(QStringLiteral("Qt.createComponent(): Invalid parent object"));
+ return ctx->engine()->throwError(QStringLiteral("Qt.createComponent(): Invalid parent object"));
} else if (lastArg->isNull()) {
parentArg = 0;
} else {
- return ctx->throwError(QStringLiteral("Qt.createComponent(): Invalid parent object"));
+ return ctx->engine()->throwError(QStringLiteral("Qt.createComponent(): Invalid parent object"));
}
}
}
@@ -1187,10 +1187,10 @@ ReturnedValue QQmlBindingFunction::call(Managed *that, CallData *callData)
return This->d()->originalFunction->call(callData);
}
-void QQmlBindingFunction::markObjects(Managed *that, ExecutionEngine *e)
+void QQmlBindingFunction::markObjects(HeapObject *that, ExecutionEngine *e)
{
- QQmlBindingFunction *This = static_cast<QQmlBindingFunction*>(that);
- This->d()->originalFunction->mark(e);
+ QQmlBindingFunction::Data *This = static_cast<QQmlBindingFunction::Data *>(that);
+ This->originalFunction->mark(e);
QV4::FunctionObject::markObjects(that, e);
}
@@ -1257,10 +1257,10 @@ ReturnedValue QtObject::method_get_platform(CallContext *ctx)
// ### inefficient. Should be just a value based getter
Object *o = ctx->d()->callData->thisObject.asObject();
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
QtObject *qt = o->as<QtObject>();
if (!qt)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
if (!qt->d()->platform)
// Only allocate a platform object once
@@ -1274,10 +1274,10 @@ ReturnedValue QtObject::method_get_application(CallContext *ctx)
// ### inefficient. Should be just a value based getter
Object *o = ctx->d()->callData->thisObject.asObject();
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
QtObject *qt = o->as<QtObject>();
if (!qt)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
if (!qt->d()->application)
// Only allocate an application object once
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
index f7728aa120..7fe7d2b914 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
@@ -155,7 +155,7 @@ struct QQmlBindingFunction : public QV4::FunctionObject
static ReturnedValue call(Managed *that, CallData *callData);
- static void markObjects(Managed *that, ExecutionEngine *e);
+ static void markObjects(HeapObject *that, ExecutionEngine *e);
static void destroy(Managed *that) {
static_cast<QQmlBindingFunction *>(that)->d()->~Data();
}
diff --git a/src/qml/qml/v8/qv4domerrors_p.h b/src/qml/qml/v8/qv4domerrors_p.h
index 59ed744f5e..facf7972ad 100644
--- a/src/qml/qml/v8/qv4domerrors_p.h
+++ b/src/qml/qml/v8/qv4domerrors_p.h
@@ -72,7 +72,7 @@ QT_BEGIN_NAMESPACE
QV4::ScopedValue v(scope, scope.engine->newString(QStringLiteral(string))); \
QV4::Scoped<Object> ex(scope, scope.engine->newErrorObject(v)); \
ex->put(QV4::ScopedString(scope, scope.engine->newIdentifier(QStringLiteral("code"))).getPointer(), QV4::ScopedValue(scope, QV4::Primitive::fromInt32(error))); \
- return ctx->throwError(ex); \
+ return ctx->engine()->throwError(ex); \
}
namespace QV4 {
diff --git a/src/qml/qml/v8/qv8debug_p.h b/src/qml/qml/v8/qv8debug_p.h
deleted file mode 100644
index 75342aa070..0000000000
--- a/src/qml/qml/v8/qv8debug_p.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//#include <private/v8-debug.h>
diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp
index 39b816f97c..d472120b4e 100644
--- a/src/qml/qml/v8/qv8engine.cpp
+++ b/src/qml/qml/v8/qv8engine.cpp
@@ -305,21 +305,6 @@ QVariant QV8Engine::objectToVariant(QV4::Object *o, V8ObjectSet *visitedObjects)
return result;
}
-static QV4::ReturnedValue arrayFromStringList(QV8Engine *engine, const QStringList &list)
-{
- QV4::ExecutionEngine *e = QV8Engine::getV4(engine);
- QV4::Scope scope(e);
- QV4::Scoped<QV4::ArrayObject> a(scope, e->newArrayObject());
- int len = list.count();
- a->arrayReserve(len);
- QV4::ScopedValue v(scope);
- for (int ii = 0; ii < len; ++ii)
- a->arrayPut(ii, (v = QV4::Encode(e->newString(list.at(ii)))));
-
- a->setArrayLengthUnchecked(len);
- return a.asReturnedValue();
-}
-
static QV4::ReturnedValue arrayFromVariantList(QV8Engine *engine, const QVariantList &list)
{
QV4::ExecutionEngine *e = QV8Engine::getV4(engine);
@@ -409,7 +394,7 @@ QV4::ReturnedValue QV8Engine::fromVariant(const QVariant &variant)
QV4::ScopedValue retn(scope, QV4::SequencePrototype::fromVariant(m_v4Engine, variant, &succeeded));
if (succeeded)
return retn.asReturnedValue();
- return arrayFromStringList(this, *reinterpret_cast<const QStringList *>(ptr));
+ return QV4::Encode(m_v4Engine->newArrayObject(*reinterpret_cast<const QStringList *>(ptr)));
}
case QMetaType::QVariantList:
return arrayFromVariantList(this, *reinterpret_cast<const QVariantList *>(ptr));
diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h
index 51e857c8a2..2379689fb3 100644
--- a/src/qml/qml/v8/qv8engine_p.h
+++ b/src/qml/qml/v8/qv8engine_p.h
@@ -78,10 +78,10 @@ namespace QV4 {
// #define QML_GLOBAL_HANDLE_DEBUGGING
#define V4THROW_ERROR(string) \
- return ctx->throwError(QString::fromUtf8(string));
+ return ctx->engine()->throwError(QString::fromUtf8(string));
#define V4THROW_TYPE(string) \
- return ctx->throwTypeError(QStringLiteral(string));
+ return ctx->engine()->throwTypeError(QStringLiteral(string));
#define V8_DEFINE_EXTENSION(dataclass, datafunction) \
static inline dataclass *datafunction(QV8Engine *engine) \
diff --git a/src/qml/qml/v8/v8.pri b/src/qml/qml/v8/v8.pri
index b4eb706574..3d6a012481 100644
--- a/src/qml/qml/v8/v8.pri
+++ b/src/qml/qml/v8/v8.pri
@@ -1,5 +1,4 @@
HEADERS += \
- $$PWD/qv8debug_p.h \
$$PWD/qv8engine_p.h \
$$PWD/qv4domerrors_p.h \
$$PWD/qv4sqlerrors_p.h \