Chromium Code Reviews| 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 5e72a29c9afc3c8ba06b9c108e09435ff03696a5..b55fd3f6a8cea1eb785193392a3b829aa9ece13a 100644 |
| --- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp |
| +++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp |
| @@ -1094,10 +1094,7 @@ void XMLHttpRequest::abort() { |
| } |
| void XMLHttpRequest::dispose() { |
| - if (m_loader) { |
| - m_error = true; |
| - m_loader->cancel(); |
| - } |
| + contextDestroyed(getExecutionContext()); |
|
haraken
2017/01/27 09:47:57
I'd prefer not manually calling contextDestroyed (
sof
2017/01/27 10:19:59
ok, adjusted.
|
| } |
| void XMLHttpRequest::clearVariablesForLoading() { |
| @@ -1118,6 +1115,12 @@ void XMLHttpRequest::clearVariablesForLoading() { |
| } |
| bool XMLHttpRequest::internalAbort() { |
| + // Fast path for repeated internalAbort()s; this |
| + // will happen if an XHR object is notified of context |
| + // destruction followed by finalization. |
| + if (m_error && !m_loader) |
| + return true; |
| + |
| m_error = true; |
| if (m_responseDocumentParser && !m_responseDocumentParser->isStopped()) |
| @@ -1807,9 +1810,8 @@ void XMLHttpRequest::resume() { |
| m_progressEventThrottle->resume(); |
| } |
| -void XMLHttpRequest::contextDestroyed(ExecutionContext*) { |
| - InspectorInstrumentation::didFailXHRLoading(getExecutionContext(), this, this, |
| - m_method, m_url); |
| +void XMLHttpRequest::contextDestroyed(ExecutionContext* context) { |
| + InspectorInstrumentation::detachClientRequest(context, this); |
| m_progressEventThrottle->stop(); |
| internalAbort(); |