diff options
Diffstat (limited to 'src/qml/qml/qqmlxmlhttprequest.cpp')
-rw-r--r-- | src/qml/qml/qqmlxmlhttprequest.cpp | 346 |
1 files changed, 173 insertions, 173 deletions
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index 08842e714c..5673acec89 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -116,7 +116,7 @@ class DocumentImpl; class NodeImpl { public: - NodeImpl() : type(Element), document(0), parent(0) {} + NodeImpl() : type(Element), document(nullptr), parent(nullptr) {} virtual ~NodeImpl() { qDeleteAll(children); qDeleteAll(attributes); @@ -157,7 +157,7 @@ public: class DocumentImpl : public QQmlRefCount, public NodeImpl { public: - DocumentImpl() : root(0) { type = Document; } + DocumentImpl() : root(nullptr) { type = Document; } virtual ~DocumentImpl() { delete root; } @@ -276,25 +276,25 @@ public: static void initClass(ExecutionEngine *engine); // JS API - static ReturnedValue method_get_nodeName(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_get_nodeValue(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_get_nodeType(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_get_namespaceUri(const BuiltinFunction *b, QV4::CallData *callData); - - static ReturnedValue method_get_parentNode(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_get_childNodes(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_get_firstChild(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_get_lastChild(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_get_previousSibling(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_get_nextSibling(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_get_attributes(const BuiltinFunction *b, QV4::CallData *callData); - - //static ReturnedValue ownerDocument(const BuiltinFunction *b, QV4::CallData *callData); - //static ReturnedValue namespaceURI(const BuiltinFunction *b, QV4::CallData *callData); - //static ReturnedValue prefix(const BuiltinFunction *b, QV4::CallData *callData); - //static ReturnedValue localName(const BuiltinFunction *b, QV4::CallData *callData); - //static ReturnedValue baseURI(const BuiltinFunction *b, QV4::CallData *callData); - //static ReturnedValue textContent(const BuiltinFunction *b, QV4::CallData *callData); + static ReturnedValue method_get_nodeName(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_get_nodeValue(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_get_nodeType(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_get_namespaceUri(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + + static ReturnedValue method_get_parentNode(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_get_childNodes(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_get_firstChild(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_get_lastChild(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_get_previousSibling(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_get_nextSibling(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_get_attributes(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + + //static ReturnedValue ownerDocument(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + //static ReturnedValue namespaceURI(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + //static ReturnedValue prefix(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + //static ReturnedValue localName(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + //static ReturnedValue baseURI(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + //static ReturnedValue textContent(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); static ReturnedValue getProto(ExecutionEngine *v4); @@ -306,18 +306,18 @@ void Heap::NodePrototype::init() Scope scope(internalClass->engine); ScopedObject o(scope, this); - o->defineAccessorProperty(QStringLiteral("nodeName"), QV4::NodePrototype::method_get_nodeName, 0); - o->defineAccessorProperty(QStringLiteral("nodeValue"), QV4::NodePrototype::method_get_nodeValue, 0); - o->defineAccessorProperty(QStringLiteral("nodeType"), QV4::NodePrototype::method_get_nodeType, 0); - o->defineAccessorProperty(QStringLiteral("namespaceUri"), QV4::NodePrototype::method_get_namespaceUri, 0); + o->defineAccessorProperty(QStringLiteral("nodeName"), QV4::NodePrototype::method_get_nodeName, nullptr); + o->defineAccessorProperty(QStringLiteral("nodeValue"), QV4::NodePrototype::method_get_nodeValue, nullptr); + o->defineAccessorProperty(QStringLiteral("nodeType"), QV4::NodePrototype::method_get_nodeType, nullptr); + o->defineAccessorProperty(QStringLiteral("namespaceUri"), QV4::NodePrototype::method_get_namespaceUri, nullptr); - o->defineAccessorProperty(QStringLiteral("parentNode"), QV4::NodePrototype::method_get_parentNode, 0); - o->defineAccessorProperty(QStringLiteral("childNodes"), QV4::NodePrototype::method_get_childNodes, 0); - o->defineAccessorProperty(QStringLiteral("firstChild"), QV4::NodePrototype::method_get_firstChild, 0); - o->defineAccessorProperty(QStringLiteral("lastChild"), QV4::NodePrototype::method_get_lastChild, 0); - o->defineAccessorProperty(QStringLiteral("previousSibling"), QV4::NodePrototype::method_get_previousSibling, 0); - o->defineAccessorProperty(QStringLiteral("nextSibling"), QV4::NodePrototype::method_get_nextSibling, 0); - o->defineAccessorProperty(QStringLiteral("attributes"), QV4::NodePrototype::method_get_attributes, 0); + o->defineAccessorProperty(QStringLiteral("parentNode"), QV4::NodePrototype::method_get_parentNode, nullptr); + o->defineAccessorProperty(QStringLiteral("childNodes"), QV4::NodePrototype::method_get_childNodes, nullptr); + o->defineAccessorProperty(QStringLiteral("firstChild"), QV4::NodePrototype::method_get_firstChild, nullptr); + o->defineAccessorProperty(QStringLiteral("lastChild"), QV4::NodePrototype::method_get_lastChild, nullptr); + o->defineAccessorProperty(QStringLiteral("previousSibling"), QV4::NodePrototype::method_get_previousSibling, nullptr); + o->defineAccessorProperty(QStringLiteral("nextSibling"), QV4::NodePrototype::method_get_nextSibling, nullptr); + o->defineAccessorProperty(QStringLiteral("attributes"), QV4::NodePrototype::method_get_attributes, nullptr); } @@ -355,10 +355,10 @@ class Attr : public Node { public: // JS API - static ReturnedValue method_name(const BuiltinFunction *b, QV4::CallData *callData); + static ReturnedValue method_name(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); // static void specified(CallContext *); - static ReturnedValue method_value(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_ownerElement(const BuiltinFunction *b, QV4::CallData *callData); + static ReturnedValue method_value(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_ownerElement(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); // static void schemaTypeInfo(CallContext *); // static void isId(CallContext *c); @@ -370,7 +370,7 @@ class CharacterData : public Node { public: // JS API - static ReturnedValue method_length(const BuiltinFunction *b, QV4::CallData *callData); + static ReturnedValue method_length(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); // C++ API static ReturnedValue prototype(ExecutionEngine *v4); @@ -380,8 +380,8 @@ class Text : public CharacterData { public: // JS API - static ReturnedValue method_isElementContentWhitespace(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_wholeText(const BuiltinFunction *b, QV4::CallData *callData); + static ReturnedValue method_isElementContentWhitespace(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_wholeText(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); // C++ API static ReturnedValue prototype(ExecutionEngine *); @@ -398,10 +398,10 @@ class Document : public Node { public: // JS API - static ReturnedValue method_xmlVersion(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_xmlEncoding(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_xmlStandalone(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_documentElement(const BuiltinFunction *b, QV4::CallData *callData); + static ReturnedValue method_xmlVersion(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_xmlEncoding(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_xmlStandalone(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_documentElement(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); // C++ API static ReturnedValue prototype(ExecutionEngine *); @@ -420,10 +420,10 @@ void NodeImpl::release() document->release(); } -ReturnedValue NodePrototype::method_get_nodeName(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue NodePrototype::method_get_nodeName(const FunctionObject *b, const Value *thisObject, const Value *, int) { Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r) THROW_TYPE_ERROR(); @@ -445,10 +445,10 @@ ReturnedValue NodePrototype::method_get_nodeName(const BuiltinFunction *b, QV4:: return Encode(scope.engine->newString(name)); } -ReturnedValue NodePrototype::method_get_nodeValue(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue NodePrototype::method_get_nodeValue(const FunctionObject *b, const Value *thisObject, const Value *, int) { QV4::Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r) THROW_TYPE_ERROR(); @@ -464,30 +464,30 @@ ReturnedValue NodePrototype::method_get_nodeValue(const BuiltinFunction *b, QV4: return Encode(scope.engine->newString(r->d()->d->data)); } -ReturnedValue NodePrototype::method_get_nodeType(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue NodePrototype::method_get_nodeType(const FunctionObject *b, const Value *thisObject, const Value *, int) { QV4::Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r) THROW_TYPE_ERROR(); return Encode(r->d()->d->type); } -ReturnedValue NodePrototype::method_get_namespaceUri(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue NodePrototype::method_get_namespaceUri(const FunctionObject *b, const Value *thisObject, const Value *, int) { QV4::Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r) THROW_TYPE_ERROR(); return Encode(scope.engine->newString(r->d()->d->namespaceUri)); } -ReturnedValue NodePrototype::method_get_parentNode(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue NodePrototype::method_get_parentNode(const FunctionObject *b, const Value *thisObject, const Value *, int) { QV4::Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r) THROW_TYPE_ERROR(); @@ -497,20 +497,20 @@ ReturnedValue NodePrototype::method_get_parentNode(const BuiltinFunction *b, QV4 return Encode::null(); } -ReturnedValue NodePrototype::method_get_childNodes(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue NodePrototype::method_get_childNodes(const FunctionObject *b, const Value *thisObject, const Value *, int) { QV4::Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r) THROW_TYPE_ERROR(); return NodeList::create(scope.engine, r->d()->d); } -ReturnedValue NodePrototype::method_get_firstChild(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue NodePrototype::method_get_firstChild(const FunctionObject *b, const Value *thisObject, const Value *, int) { QV4::Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r) THROW_TYPE_ERROR(); @@ -520,10 +520,10 @@ ReturnedValue NodePrototype::method_get_firstChild(const BuiltinFunction *b, QV4 return Node::create(scope.engine, r->d()->d->children.constFirst()); } -ReturnedValue NodePrototype::method_get_lastChild(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue NodePrototype::method_get_lastChild(const FunctionObject *b, const Value *thisObject, const Value *, int) { QV4::Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r) THROW_TYPE_ERROR(); @@ -533,10 +533,10 @@ ReturnedValue NodePrototype::method_get_lastChild(const BuiltinFunction *b, QV4: return Node::create(scope.engine, r->d()->d->children.constLast()); } -ReturnedValue NodePrototype::method_get_previousSibling(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue NodePrototype::method_get_previousSibling(const FunctionObject *b, const Value *thisObject, const Value *, int) { QV4::Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r) THROW_TYPE_ERROR(); @@ -555,10 +555,10 @@ ReturnedValue NodePrototype::method_get_previousSibling(const BuiltinFunction *b return Encode::null(); } -ReturnedValue NodePrototype::method_get_nextSibling(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue NodePrototype::method_get_nextSibling(const FunctionObject *b, const Value *thisObject, const Value *, int) { QV4::Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r) THROW_TYPE_ERROR(); @@ -577,10 +577,10 @@ ReturnedValue NodePrototype::method_get_nextSibling(const BuiltinFunction *b, QV return Encode::null(); } -ReturnedValue NodePrototype::method_get_attributes(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue NodePrototype::method_get_attributes(const FunctionObject *b, const Value *thisObject, const Value *, int) { QV4::Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r) THROW_TYPE_ERROR(); @@ -644,7 +644,7 @@ ReturnedValue Element::prototype(ExecutionEngine *engine) ScopedObject p(scope, engine->newObject()); ScopedObject pp(scope); p->setPrototype((pp = NodePrototype::getProto(engine))); - p->defineAccessorProperty(QStringLiteral("tagName"), NodePrototype::method_get_nodeName, 0); + p->defineAccessorProperty(QStringLiteral("tagName"), NodePrototype::method_get_nodeName, nullptr); d->elementPrototype.set(engine, p); engine->v8Engine->freezeObject(p); } @@ -659,49 +659,49 @@ ReturnedValue Attr::prototype(ExecutionEngine *engine) ScopedObject p(scope, engine->newObject()); ScopedObject pp(scope); p->setPrototype((pp = NodePrototype::getProto(engine))); - p->defineAccessorProperty(QStringLiteral("name"), method_name, 0); - p->defineAccessorProperty(QStringLiteral("value"), method_value, 0); - p->defineAccessorProperty(QStringLiteral("ownerElement"), method_ownerElement, 0); + p->defineAccessorProperty(QStringLiteral("name"), method_name, nullptr); + p->defineAccessorProperty(QStringLiteral("value"), method_value, nullptr); + p->defineAccessorProperty(QStringLiteral("ownerElement"), method_ownerElement, nullptr); d->attrPrototype.set(engine, p); engine->v8Engine->freezeObject(p); } return d->attrPrototype.value(); } -ReturnedValue Attr::method_name(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue Attr::method_name(const FunctionObject *b, const Value *thisObject, const Value *, int) { QV4::Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r) RETURN_UNDEFINED(); return Encode(scope.engine->newString(r->d()->d->name)); } -ReturnedValue Attr::method_value(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue Attr::method_value(const FunctionObject *b, const Value *thisObject, const Value *, int) { QV4::Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r) RETURN_UNDEFINED(); return Encode(scope.engine->newString(r->d()->d->data)); } -ReturnedValue Attr::method_ownerElement(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue Attr::method_ownerElement(const FunctionObject *b, const Value *thisObject, const Value *, int) { QV4::Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r) RETURN_UNDEFINED(); return Node::create(scope.engine, r->d()->d->parent); } -ReturnedValue CharacterData::method_length(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue CharacterData::method_length(const FunctionObject *b, const Value *thisObject, const Value *, int) { QV4::Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r) RETURN_UNDEFINED(); @@ -716,28 +716,28 @@ ReturnedValue CharacterData::prototype(ExecutionEngine *v4) ScopedObject p(scope, v4->newObject()); ScopedObject pp(scope); p->setPrototype((pp = NodePrototype::getProto(v4))); - p->defineAccessorProperty(QStringLiteral("data"), NodePrototype::method_get_nodeValue, 0); - p->defineAccessorProperty(QStringLiteral("length"), method_length, 0); + p->defineAccessorProperty(QStringLiteral("data"), NodePrototype::method_get_nodeValue, nullptr); + p->defineAccessorProperty(QStringLiteral("length"), method_length, nullptr); d->characterDataPrototype.set(v4, p); v4->v8Engine->freezeObject(p); } return d->characterDataPrototype.value(); } -ReturnedValue Text::method_isElementContentWhitespace(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue Text::method_isElementContentWhitespace(const FunctionObject *b, const Value *thisObject, const Value *, int) { QV4::Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r) RETURN_UNDEFINED(); return Encode(QStringRef(&r->d()->d->data).trimmed().isEmpty()); } -ReturnedValue Text::method_wholeText(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue Text::method_wholeText(const FunctionObject *b, const Value *thisObject, const Value *, int) { QV4::Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r) RETURN_UNDEFINED(); @@ -752,8 +752,8 @@ ReturnedValue Text::prototype(ExecutionEngine *v4) ScopedObject p(scope, v4->newObject()); ScopedObject pp(scope); p->setPrototype((pp = CharacterData::prototype(v4))); - p->defineAccessorProperty(QStringLiteral("isElementContentWhitespace"), method_isElementContentWhitespace, 0); - p->defineAccessorProperty(QStringLiteral("wholeText"), method_wholeText, 0); + p->defineAccessorProperty(QStringLiteral("isElementContentWhitespace"), method_isElementContentWhitespace, nullptr); + p->defineAccessorProperty(QStringLiteral("wholeText"), method_wholeText, nullptr); d->textPrototype.set(v4, p); v4->v8Engine->freezeObject(p); } @@ -783,10 +783,10 @@ ReturnedValue Document::prototype(ExecutionEngine *v4) ScopedObject p(scope, v4->newObject()); ScopedObject pp(scope); p->setPrototype((pp = NodePrototype::getProto(v4))); - p->defineAccessorProperty(QStringLiteral("xmlVersion"), method_xmlVersion, 0); - p->defineAccessorProperty(QStringLiteral("xmlEncoding"), method_xmlEncoding, 0); - p->defineAccessorProperty(QStringLiteral("xmlStandalone"), method_xmlStandalone, 0); - p->defineAccessorProperty(QStringLiteral("documentElement"), method_documentElement, 0); + p->defineAccessorProperty(QStringLiteral("xmlVersion"), method_xmlVersion, nullptr); + p->defineAccessorProperty(QStringLiteral("xmlEncoding"), method_xmlEncoding, nullptr); + p->defineAccessorProperty(QStringLiteral("xmlStandalone"), method_xmlStandalone, nullptr); + p->defineAccessorProperty(QStringLiteral("documentElement"), method_documentElement, nullptr); d->documentPrototype.set(v4, p); v4->v8Engine->freezeObject(p); } @@ -797,7 +797,7 @@ ReturnedValue Document::load(ExecutionEngine *v4, const QByteArray &data) { Scope scope(v4); - DocumentImpl *document = 0; + DocumentImpl *document = nullptr; QStack<NodeImpl *> nodeStack; QXmlStreamReader reader(data); @@ -885,7 +885,7 @@ ReturnedValue Document::load(ExecutionEngine *v4, const QByteArray &data) bool Node::isNull() const { - return d()->d == 0; + return d()->d == nullptr; } ReturnedValue NamedNodeMap::getIndexed(const Managed *m, uint index, bool *hasProperty) @@ -967,40 +967,40 @@ ReturnedValue NodeList::create(ExecutionEngine *v4, NodeImpl *data) return (v4->memoryManager->allocObject<NodeList>(data))->asReturnedValue(); } -ReturnedValue Document::method_documentElement(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue Document::method_documentElement(const FunctionObject *b, const Value *thisObject, const Value *, int) { Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r || r->d()->d->type != NodeImpl::Document) RETURN_UNDEFINED(); return Node::create(scope.engine, static_cast<DocumentImpl *>(r->d()->d)->root); } -ReturnedValue Document::method_xmlStandalone(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue Document::method_xmlStandalone(const FunctionObject *b, const Value *thisObject, const Value *, int) { Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r || r->d()->d->type != NodeImpl::Document) RETURN_UNDEFINED(); return Encode(static_cast<DocumentImpl *>(r->d()->d)->isStandalone); } -ReturnedValue Document::method_xmlVersion(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue Document::method_xmlVersion(const FunctionObject *b, const Value *thisObject, const Value *, int) { Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r || r->d()->d->type != NodeImpl::Document) RETURN_UNDEFINED(); return Encode(scope.engine->newString(static_cast<DocumentImpl *>(r->d()->d)->version)); } -ReturnedValue Document::method_xmlEncoding(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue Document::method_xmlEncoding(const FunctionObject *b, const Value *thisObject, const Value *, int) { Scope scope(b); - Scoped<Node> r(scope, callData->thisObject.as<Node>()); + Scoped<Node> r(scope, thisObject->as<Node>()); if (!r || r->d()->d->type != NodeImpl::Document) RETURN_UNDEFINED(); @@ -1098,7 +1098,7 @@ private: QQmlXMLHttpRequest::QQmlXMLHttpRequest(QNetworkAccessManager *manager) : m_state(Unsent), m_errorFlag(false), m_sendFlag(false) - , m_redirectCount(0), m_gotXml(false), m_textCodec(0), m_network(0), m_nam(manager) + , m_redirectCount(0), m_gotXml(false), m_textCodec(nullptr), m_network(nullptr), m_nam(manager) , m_responseType() , m_parsedDocument() { @@ -1443,7 +1443,7 @@ void QQmlXMLHttpRequest::finished() dispatchCallback(); m_thisObject.clear(); - m_qmlContext.setContextData(0); + m_qmlContext.setContextData(nullptr); } @@ -1516,7 +1516,7 @@ QV4::ReturnedValue QQmlXMLHttpRequest::xmlResponseBody(QV4::ExecutionEngine* eng #if QT_CONFIG(textcodec) QTextCodec* QQmlXMLHttpRequest::findTextCodec() const { - QTextCodec *codec = 0; + QTextCodec *codec = nullptr; if (!m_charset.isEmpty()) codec = QTextCodec::codecForName(m_charset); @@ -1528,10 +1528,10 @@ QTextCodec* QQmlXMLHttpRequest::findTextCodec() const } if (!codec && m_mime == "text/html") - codec = QTextCodec::codecForHtml(m_responseEntityBody, 0); + codec = QTextCodec::codecForHtml(m_responseEntityBody, nullptr); if (!codec) - codec = QTextCodec::codecForUtfText(m_responseEntityBody, 0); + codec = QTextCodec::codecForUtfText(m_responseEntityBody, nullptr); if (!codec) codec = QTextCodec::codecForName("UTF-8"); @@ -1595,7 +1595,7 @@ void QQmlXMLHttpRequest::destroyNetwork() if (m_network) { m_network->disconnect(); m_network->deleteLater(); - m_network = 0; + m_network = nullptr; } } @@ -1653,21 +1653,21 @@ struct QQmlXMLHttpRequestCtor : public FunctionObject void setupProto(); - static ReturnedValue method_open(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_setRequestHeader(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_send(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_abort(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_getResponseHeader(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_getAllResponseHeaders(const BuiltinFunction *b, QV4::CallData *callData); - - static ReturnedValue method_get_readyState(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_get_status(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_get_statusText(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_get_responseText(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_get_responseXML(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_get_response(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_get_responseType(const BuiltinFunction *b, QV4::CallData *callData); - static ReturnedValue method_set_responseType(const BuiltinFunction *b, QV4::CallData *callData); + static ReturnedValue method_open(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_setRequestHeader(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_send(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_abort(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_getResponseHeader(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_getAllResponseHeaders(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + + static ReturnedValue method_get_readyState(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_get_status(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_get_statusText(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_get_responseText(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_get_responseXML(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_get_response(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_get_responseType(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); + static ReturnedValue method_set_responseType(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); }; } @@ -1709,12 +1709,12 @@ void QQmlXMLHttpRequestCtor::setupProto() p->defineDefaultProperty(QStringLiteral("getAllResponseHeaders"), method_getAllResponseHeaders); // Read-only properties - p->defineAccessorProperty(QStringLiteral("readyState"), method_get_readyState, 0); - p->defineAccessorProperty(QStringLiteral("status"),method_get_status, 0); - p->defineAccessorProperty(QStringLiteral("statusText"),method_get_statusText, 0); - p->defineAccessorProperty(QStringLiteral("responseText"),method_get_responseText, 0); - p->defineAccessorProperty(QStringLiteral("responseXML"),method_get_responseXML, 0); - p->defineAccessorProperty(QStringLiteral("response"),method_get_response, 0); + p->defineAccessorProperty(QStringLiteral("readyState"), method_get_readyState, nullptr); + p->defineAccessorProperty(QStringLiteral("status"),method_get_status, nullptr); + p->defineAccessorProperty(QStringLiteral("statusText"),method_get_statusText, nullptr); + p->defineAccessorProperty(QStringLiteral("responseText"),method_get_responseText, nullptr); + p->defineAccessorProperty(QStringLiteral("responseXML"),method_get_responseXML, nullptr); + p->defineAccessorProperty(QStringLiteral("response"),method_get_response, nullptr); // Read-write properties p->defineAccessorProperty(QStringLiteral("responseType"), method_get_responseType, method_set_responseType); @@ -1729,19 +1729,19 @@ void QQmlXMLHttpRequestCtor::setupProto() // XMLHttpRequest methods -ReturnedValue QQmlXMLHttpRequestCtor::method_open(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue QQmlXMLHttpRequestCtor::method_open(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) { Scope scope(b); - Scoped<QQmlXMLHttpRequestWrapper> w(scope, callData->thisObject.as<QQmlXMLHttpRequestWrapper>()); + Scoped<QQmlXMLHttpRequestWrapper> w(scope, thisObject->as<QQmlXMLHttpRequestWrapper>()); if (!w) V4THROW_REFERENCE("Not an XMLHttpRequest object"); QQmlXMLHttpRequest *r = w->d()->request; - if (callData->argc() < 2 || callData->argc() > 5) + if (argc < 2 || argc > 5) THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count"); // Argument 0 - Method - QString method = callData->args[0].toQStringNoThrow().toUpper(); + QString method = argv[0].toQStringNoThrow().toUpper(); if (method != QLatin1String("GET") && method != QLatin1String("PUT") && method != QLatin1String("HEAD") && @@ -1753,23 +1753,23 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_open(const BuiltinFunction *b, QV4: THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Unsupported HTTP method type"); // Argument 1 - URL - QUrl url = QUrl(callData->args[1].toQStringNoThrow()); + QUrl url = QUrl(argv[1].toQStringNoThrow()); if (url.isRelative()) url = scope.engine->callingQmlContext()->resolvedUrl(url); bool async = true; // Argument 2 - async (optional) - if (callData->argc() > 2) { - async = callData->args[2].booleanValue(); + if (argc > 2) { + async = argv[2].booleanValue(); } // Argument 3/4 - user/pass (optional) QString username, password; - if (callData->argc() > 3) - username = callData->args[3].toQStringNoThrow(); - if (callData->argc() > 4) - password = callData->args[4].toQStringNoThrow(); + if (argc > 3) + username = argv[3].toQStringNoThrow(); + if (argc > 4) + password = argv[4].toQStringNoThrow(); // Clear the fragment (if any) url.setFragment(QString()); @@ -1781,22 +1781,22 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_open(const BuiltinFunction *b, QV4: return r->open(w, scope.engine->callingQmlContext(), method, url, async ? QQmlXMLHttpRequest::AsynchronousLoad : QQmlXMLHttpRequest::SynchronousLoad); } -ReturnedValue QQmlXMLHttpRequestCtor::method_setRequestHeader(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue QQmlXMLHttpRequestCtor::method_setRequestHeader(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) { Scope scope(b); - Scoped<QQmlXMLHttpRequestWrapper> w(scope, callData->thisObject.as<QQmlXMLHttpRequestWrapper>()); + Scoped<QQmlXMLHttpRequestWrapper> w(scope, thisObject->as<QQmlXMLHttpRequestWrapper>()); if (!w) V4THROW_REFERENCE("Not an XMLHttpRequest object"); QQmlXMLHttpRequest *r = w->d()->request; - if (callData->argc() != 2) + if (argc != 2) THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count"); if (r->readyState() != QQmlXMLHttpRequest::Opened || r->sendFlag()) THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state"); - QString name = callData->args[0].toQStringNoThrow(); - QString value = callData->args[1].toQStringNoThrow(); + QString name = argv[0].toQStringNoThrow(); + QString value = argv[1].toQStringNoThrow(); // ### Check that name and value are well formed @@ -1828,10 +1828,10 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_setRequestHeader(const BuiltinFunct RETURN_UNDEFINED(); } -ReturnedValue QQmlXMLHttpRequestCtor::method_send(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue QQmlXMLHttpRequestCtor::method_send(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) { Scope scope(b); - Scoped<QQmlXMLHttpRequestWrapper> w(scope, callData->thisObject.as<QQmlXMLHttpRequestWrapper>()); + Scoped<QQmlXMLHttpRequestWrapper> w(scope, thisObject->as<QQmlXMLHttpRequestWrapper>()); if (!w) V4THROW_REFERENCE("Not an XMLHttpRequest object"); QQmlXMLHttpRequest *r = w->d()->request; @@ -1841,21 +1841,21 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_send(const BuiltinFunction *b, QV4: THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state"); QByteArray data; - if (callData->argc() > 0) { - if (const ArrayBuffer *buffer = callData->args[0].as<ArrayBuffer>()) { + if (argc > 0) { + if (const ArrayBuffer *buffer = argv[0].as<ArrayBuffer>()) { data = buffer->asByteArray(); } else { - data = callData->args[0].toQStringNoThrow().toUtf8(); + data = argv[0].toQStringNoThrow().toUtf8(); } } return r->send(w, scope.engine->callingQmlContext(), data); } -ReturnedValue QQmlXMLHttpRequestCtor::method_abort(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue QQmlXMLHttpRequestCtor::method_abort(const FunctionObject *b, const Value *thisObject, const Value *, int) { Scope scope(b); - Scoped<QQmlXMLHttpRequestWrapper> w(scope, callData->thisObject.as<QQmlXMLHttpRequestWrapper>()); + Scoped<QQmlXMLHttpRequestWrapper> w(scope, thisObject->as<QQmlXMLHttpRequestWrapper>()); if (!w) V4THROW_REFERENCE("Not an XMLHttpRequest object"); QQmlXMLHttpRequest *r = w->d()->request; @@ -1863,15 +1863,15 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_abort(const BuiltinFunction *b, QV4 return r->abort(w, scope.engine->callingQmlContext()); } -ReturnedValue QQmlXMLHttpRequestCtor::method_getResponseHeader(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue QQmlXMLHttpRequestCtor::method_getResponseHeader(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) { Scope scope(b); - Scoped<QQmlXMLHttpRequestWrapper> w(scope, callData->thisObject.as<QQmlXMLHttpRequestWrapper>()); + Scoped<QQmlXMLHttpRequestWrapper> w(scope, thisObject->as<QQmlXMLHttpRequestWrapper>()); if (!w) V4THROW_REFERENCE("Not an XMLHttpRequest object"); QQmlXMLHttpRequest *r = w->d()->request; - if (callData->argc() != 1) + if (argc != 1) THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count"); if (r->readyState() != QQmlXMLHttpRequest::Loading && @@ -1879,18 +1879,18 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_getResponseHeader(const BuiltinFunc r->readyState() != QQmlXMLHttpRequest::HeadersReceived) THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state"); - return Encode(scope.engine->newString(r->header(callData->args[0].toQStringNoThrow()))); + return Encode(scope.engine->newString(r->header(argv[0].toQStringNoThrow()))); } -ReturnedValue QQmlXMLHttpRequestCtor::method_getAllResponseHeaders(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue QQmlXMLHttpRequestCtor::method_getAllResponseHeaders(const FunctionObject *b, const Value *thisObject, const Value *, int argc) { Scope scope(b); - Scoped<QQmlXMLHttpRequestWrapper> w(scope, callData->thisObject.as<QQmlXMLHttpRequestWrapper>()); + Scoped<QQmlXMLHttpRequestWrapper> w(scope, thisObject->as<QQmlXMLHttpRequestWrapper>()); if (!w) V4THROW_REFERENCE("Not an XMLHttpRequest object"); QQmlXMLHttpRequest *r = w->d()->request; - if (callData->argc() != 0) + if (argc != 0) THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count"); if (r->readyState() != QQmlXMLHttpRequest::Loading && @@ -1902,10 +1902,10 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_getAllResponseHeaders(const Builtin } // XMLHttpRequest properties -ReturnedValue QQmlXMLHttpRequestCtor::method_get_readyState(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue QQmlXMLHttpRequestCtor::method_get_readyState(const FunctionObject *b, const Value *thisObject, const Value *, int) { Scope scope(b); - Scoped<QQmlXMLHttpRequestWrapper> w(scope, callData->thisObject.as<QQmlXMLHttpRequestWrapper>()); + Scoped<QQmlXMLHttpRequestWrapper> w(scope, thisObject->as<QQmlXMLHttpRequestWrapper>()); if (!w) V4THROW_REFERENCE("Not an XMLHttpRequest object"); QQmlXMLHttpRequest *r = w->d()->request; @@ -1913,10 +1913,10 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_get_readyState(const BuiltinFunctio return Encode(r->readyState()); } -ReturnedValue QQmlXMLHttpRequestCtor::method_get_status(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue QQmlXMLHttpRequestCtor::method_get_status(const FunctionObject *b, const Value *thisObject, const Value *, int) { Scope scope(b); - Scoped<QQmlXMLHttpRequestWrapper> w(scope, callData->thisObject.as<QQmlXMLHttpRequestWrapper>()); + Scoped<QQmlXMLHttpRequestWrapper> w(scope, thisObject->as<QQmlXMLHttpRequestWrapper>()); if (!w) V4THROW_REFERENCE("Not an XMLHttpRequest object"); QQmlXMLHttpRequest *r = w->d()->request; @@ -1931,10 +1931,10 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_get_status(const BuiltinFunction *b return Encode(r->replyStatus()); } -ReturnedValue QQmlXMLHttpRequestCtor::method_get_statusText(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue QQmlXMLHttpRequestCtor::method_get_statusText(const FunctionObject *b, const Value *thisObject, const Value *, int) { Scope scope(b); - Scoped<QQmlXMLHttpRequestWrapper> w(scope, callData->thisObject.as<QQmlXMLHttpRequestWrapper>()); + Scoped<QQmlXMLHttpRequestWrapper> w(scope, thisObject->as<QQmlXMLHttpRequestWrapper>()); if (!w) V4THROW_REFERENCE("Not an XMLHttpRequest object"); QQmlXMLHttpRequest *r = w->d()->request; @@ -1949,10 +1949,10 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_get_statusText(const BuiltinFunctio return Encode(scope.engine->newString(r->replyStatusText())); } -ReturnedValue QQmlXMLHttpRequestCtor::method_get_responseText(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue QQmlXMLHttpRequestCtor::method_get_responseText(const FunctionObject *b, const Value *thisObject, const Value *, int) { Scope scope(b); - Scoped<QQmlXMLHttpRequestWrapper> w(scope, callData->thisObject.as<QQmlXMLHttpRequestWrapper>()); + Scoped<QQmlXMLHttpRequestWrapper> w(scope, thisObject->as<QQmlXMLHttpRequestWrapper>()); if (!w) V4THROW_REFERENCE("Not an XMLHttpRequest object"); QQmlXMLHttpRequest *r = w->d()->request; @@ -1964,10 +1964,10 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_get_responseText(const BuiltinFunct return Encode(scope.engine->newString(r->responseBody())); } -ReturnedValue QQmlXMLHttpRequestCtor::method_get_responseXML(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue QQmlXMLHttpRequestCtor::method_get_responseXML(const FunctionObject *b, const Value *thisObject, const Value *, int) { Scope scope(b); - Scoped<QQmlXMLHttpRequestWrapper> w(scope, callData->thisObject.as<QQmlXMLHttpRequestWrapper>()); + Scoped<QQmlXMLHttpRequestWrapper> w(scope, thisObject->as<QQmlXMLHttpRequestWrapper>()); if (!w) V4THROW_REFERENCE("Not an XMLHttpRequest object"); QQmlXMLHttpRequest *r = w->d()->request; @@ -1983,10 +1983,10 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_get_responseXML(const BuiltinFuncti } } -ReturnedValue QQmlXMLHttpRequestCtor::method_get_response(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue QQmlXMLHttpRequestCtor::method_get_response(const FunctionObject *b, const Value *thisObject, const Value *, int) { Scope scope(b); - Scoped<QQmlXMLHttpRequestWrapper> w(scope, callData->thisObject.as<QQmlXMLHttpRequestWrapper>()); + Scoped<QQmlXMLHttpRequestWrapper> w(scope, thisObject->as<QQmlXMLHttpRequestWrapper>()); if (!w) V4THROW_REFERENCE("Not an XMLHttpRequest object"); QQmlXMLHttpRequest *r = w->d()->request; @@ -2010,29 +2010,29 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_get_response(const BuiltinFunction } -ReturnedValue QQmlXMLHttpRequestCtor::method_get_responseType(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue QQmlXMLHttpRequestCtor::method_get_responseType(const FunctionObject *b, const Value *thisObject, const Value *, int) { Scope scope(b); - Scoped<QQmlXMLHttpRequestWrapper> w(scope, callData->thisObject.as<QQmlXMLHttpRequestWrapper>()); + Scoped<QQmlXMLHttpRequestWrapper> w(scope, thisObject->as<QQmlXMLHttpRequestWrapper>()); if (!w) V4THROW_REFERENCE("Not an XMLHttpRequest object"); QQmlXMLHttpRequest *r = w->d()->request; return Encode(scope.engine->newString(r->responseType())); } -ReturnedValue QQmlXMLHttpRequestCtor::method_set_responseType(const BuiltinFunction *b, QV4::CallData *callData) +ReturnedValue QQmlXMLHttpRequestCtor::method_set_responseType(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) { Scope scope(b); - Scoped<QQmlXMLHttpRequestWrapper> w(scope, callData->thisObject.as<QQmlXMLHttpRequestWrapper>()); + Scoped<QQmlXMLHttpRequestWrapper> w(scope, thisObject->as<QQmlXMLHttpRequestWrapper>()); if (!w) V4THROW_REFERENCE("Not an XMLHttpRequest object"); QQmlXMLHttpRequest *r = w->d()->request; - if (callData->argc() < 1) + if (argc < 1) THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count"); // Argument 0 - response type - r->setResponseType(callData->args[0].toQStringNoThrow()); + r->setResponseType(argv[0].toQStringNoThrow()); return Encode::undefined(); } |