Showing the changes to libraries/script-engine/src/XMLHttpRequestClass.cpp (1 of 2 files). Show all
Unified · Split
| @@ -63,7 +63,7 @@ QString XMLHttpRequestClass::getStatusText() const { · 62 unmodified lines | ||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | void XMLHttpRequestClass::abort() { |
| 66 | − _abortRequest(); | |
| 66 | + abortRequest(); | |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | void XMLHttpRequestClass::setRequestHeader(const QString& name, const QString& value) { |
| @@ -76,18 +76,18 @@ void XMLHttpRequestClass::requestMetaDataChanged() { · 6 unmodified lines | ||
| 76 | 76 | // If this is a redirect, abort the current request and start a new one |
| 77 | 77 | if (redirect.isValid() && _numRedirects < MAXIMUM_REDIRECTS) { |
| 78 | 78 | _numRedirects++; |
| 79 | − _abortRequest(); | |
| 79 | + abortRequest(); | |
| 80 | 80 | |
| 81 | 81 | QUrl newUrl = _url.resolved(redirect.toUrl().toString()); |
| 82 | 82 | _request.setUrl(newUrl); |
| 83 | − _doSend(); | |
| 83 | + doSend(); | |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | void XMLHttpRequestClass::requestDownloadProgress(qint64 bytesReceived, qint64 bytesTotal) { |
| 88 | 88 | if (_readyState == OPENED && bytesReceived > 0) { |
| 89 | − _setReadyState(HEADERS_RECEIVED); | |
| 90 | − _setReadyState(LOADING); | |
| 89 | + setReadyState(HEADERS_RECEIVED); | |
| 90 | + setReadyState(LOADING); | |
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
| @@ -113,7 +113,7 @@ QScriptValue XMLHttpRequestClass::getResponseHeader(const QString& name) const { · 19 unmodified lines | ||
| 113 | 113 | return QScriptValue::NullValue; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | −void XMLHttpRequestClass::_setReadyState(ReadyState readyState) { | |
| 116 | +void XMLHttpRequestClass::setReadyState(ReadyState readyState) { | |
| 117 | 117 | if (readyState != _readyState) { |
| 118 | 118 | _readyState = readyState; |
| 119 | 119 | if (_onReadyStateChange.isFunction()) { |
| @@ -135,7 +135,7 @@ void XMLHttpRequestClass::open(const QString& method, const QString& url, bool a · 15 unmodified lines | ||
| 135 | 135 | } |
| 136 | 136 | _request.setUrl(_url); |
| 137 | 137 | _method = method; |
| 138 | − _setReadyState(OPENED); | |
| 138 | + setReadyState(OPENED); | |
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | |
| @@ -150,7 +150,7 @@ void XMLHttpRequestClass::send(const QString& data) { · 8 unmodified lines | ||
| 150 | 150 | _sendData->setData(data.toUtf8()); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | − _doSend(); | |
| 153 | + doSend(); | |
| 154 | 154 | |
| 155 | 155 | if (!_async) { |
| 156 | 156 | QEventLoop loop; |
| @@ -160,10 +160,10 @@ void XMLHttpRequestClass::send(const QString& data) { · 3 unmodified lines | ||
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | −void XMLHttpRequestClass::_doSend() { | |
| 163 | +void XMLHttpRequestClass::doSend() { | |
| 164 | 164 | _reply = _manager.sendCustomRequest(_request, _method.toLatin1(), _sendData); |
| 165 | 165 | |
| 166 | − _connectToReply(_reply); | |
| 166 | + connectToReply(_reply); | |
| 167 | 167 | |
| 168 | 168 | if (_timeout > 0) { |
| 169 | 169 | _timer.start(_timeout); |
| @@ -175,9 +175,9 @@ void XMLHttpRequestClass::requestTimeout() { · 5 unmodified lines | ||
| 175 | 175 | if (_onTimeout.isFunction()) { |
| 176 | 176 | _onTimeout.call(QScriptValue::NullValue); |
| 177 | 177 | } |
| 178 | − _abortRequest(); | |
| 178 | + abortRequest(); | |
| 179 | 179 | _errorCode = QNetworkReply::TimeoutError; |
| 180 | − _setReadyState(DONE); | |
| 180 | + setReadyState(DONE); | |
| 181 | 181 | emit requestComplete(); |
| 182 | 182 | } |
| 183 | 183 | |
| @@ -203,29 +203,29 @@ void XMLHttpRequestClass::requestFinished() { · 19 unmodified lines | ||
| 203 | 203 | _responseData = QScriptValue(QString(_rawResponseData.data())); |
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | − _setReadyState(DONE); | |
| 206 | + setReadyState(DONE); | |
| 207 | 207 | emit requestComplete(); |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | −void XMLHttpRequestClass::_abortRequest() { | |
| 210 | +void XMLHttpRequestClass::abortRequest() { | |
| 211 | 211 | // Disconnect from signals we don't want to receive any longer. |
| 212 | 212 | disconnect(&_timer, SIGNAL(timeout()), this, SLOT(requestTimeout())); |
| 213 | 213 | if (_reply) { |
| 214 | − _disconnectFromReply(_reply); | |
| 214 | + disconnectFromReply(_reply); | |
| 215 | 215 | _reply->abort(); |
| 216 | 216 | delete _reply; |
| 217 | 217 | _reply = NULL; |
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | −void XMLHttpRequestClass::_connectToReply(QNetworkReply* reply) { | |
| 221 | +void XMLHttpRequestClass::connectToReply(QNetworkReply* reply) { | |
| 222 | 222 | connect(reply, SIGNAL(finished()), this, SLOT(requestFinished())); |
| 223 | 223 | connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(requestError(QNetworkReply::NetworkError))); |
| 224 | 224 | connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(requestDownloadProgress(qint64, qint64))); |
| 225 | 225 | connect(reply, SIGNAL(metaDataChanged()), this, SLOT(requestMetaDataChanged())); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | −void XMLHttpRequestClass::_disconnectFromReply(QNetworkReply* reply) { | |
| 228 | +void XMLHttpRequestClass::disconnectFromReply(QNetworkReply* reply) { | |
| 229 | 229 | disconnect(reply, SIGNAL(finished()), this, SLOT(requestFinished())); |
| 230 | 230 | disconnect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(requestError(QNetworkReply::NetworkError))); |
| 231 | 231 | disconnect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(requestDownloadProgress(qint64, qint64))); |