void JSKitXMLHttpRequest::handleReplyFinished() { if (!_reply) { qCDebug(l) << "reply finished too late"; return; } _response = _reply->readAll(); qCDebug(l) << "reply finished, reply text:" << QString::fromUtf8(_response); emit readyStateChanged(); emit statusChanged(); emit statusTextChanged(); emit responseChanged(); emit responseTextChanged(); if (_onload.isCallable()) { qCDebug(l) << "going to call onload handler:" << _onload.toString(); QJSValue result = _onload.callWithInstance(_mgr->engine()->newQObject(this)); if (result.isError()) { qCWarning(l) << "JS error on onload handler:" << JSKitManager::describeError(result); } } else { qCDebug(l) << "No onload set"; } }
void JSKitXMLHttpRequest::handleReplyFinished() { if (!m_reply) { qCDebug(l) << "reply finished too late"; return; } m_response = m_reply->readAll(); qCDebug(l) << "reply finished, reply text:" << QString::fromUtf8(m_response) << "status:" << status(); emit readyStateChanged(); emit statusChanged(); emit statusTextChanged(); emit responseChanged(); emit responseTextChanged(); if (m_onload.isCallable()) { qCDebug(l) << "going to call onload handler:" << m_onload.toString(); QJSValue result = m_onload.callWithInstance(m_engine->newQObject(this)); if (result.isError()) { qCWarning(l) << "JS error on onload handler:" << JSKitManager::describeError(result); } } else { qCDebug(l) << "No onload set"; } invokeCallbacks("load", QJSValueList({m_engine->newQObject(this)})); if (m_onreadystatechange.isCallable()) { qCDebug(l) << "going to call onreadystatechange handler:" << m_onreadystatechange.toString(); QJSValue result = m_onreadystatechange.callWithInstance(m_engine->newQObject(this)); if (result.isError()) { qCWarning(l) << "JS error on onreadystatechange handler:" << JSKitManager::describeError(result); } } invokeCallbacks("readystatechange", QJSValueList({m_engine->newQObject(this)})); }