| Index: third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
|
| diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
|
| index 21df5410f6d061dd15ce66f08bea2ea2a21066a6..e2c7f10d550bfc39a052aebbc8bbab786af2a00f 100644
|
| --- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
|
| +++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
|
| @@ -78,6 +78,7 @@
|
| #include "platform/weborigin/Suborigin.h"
|
| #include "public/platform/WebURLRequest.h"
|
| #include "wtf/Assertions.h"
|
| +#include "wtf/AutoReset.h"
|
| #include "wtf/StdLibExtras.h"
|
| #include "wtf/text/CString.h"
|
| #include <memory>
|
| @@ -1604,26 +1605,22 @@ void XMLHttpRequest::endLoading() {
|
| this, m_method, m_url);
|
|
|
| if (m_loader) {
|
| - const bool hasError = m_error;
|
| // Set |m_error| in order to suppress the cancel notification (see
|
| // XMLHttpRequest::didFail).
|
| - m_error = true;
|
| - m_loader->cancel();
|
| - m_error = hasError;
|
| - m_loader = nullptr;
|
| + AutoReset<bool> scope(&m_error, true);
|
| + m_loader.release()->cancel();
|
| }
|
|
|
| m_sendFlag = false;
|
| changeState(kDone);
|
|
|
| - if (!getExecutionContext() || !getExecutionContext()->isDocument() ||
|
| - !document() || !document()->frame() || !document()->frame()->page())
|
| + if (!getExecutionContext() || !getExecutionContext()->isDocument())
|
| return;
|
|
|
| - if (status() >= 200 && status() < 300) {
|
| + if (document() && document()->frame() && document()->frame()->page() &&
|
| + FetchUtils::isOkStatus(status()))
|
| document()->frame()->page()->chromeClient().ajaxSucceeded(
|
| document()->frame());
|
| - }
|
| }
|
|
|
| void XMLHttpRequest::didSendData(unsigned long long bytesSent,
|
|
|