Commit c197aaf8 authored by yhirano's avatar yhirano Committed by Commit bot

[XHR] Add CHECK to make sure XHR::m_loader is not silently released

XMLHttpRequest::m_loader should be manually cancelled before it is released.
This CL adds a CHECK to make sure the we keep the contract.

BUG=667254

Review-Url: https://codereview.chromium.org/2624163002
Cr-Commit-Position: refs/heads/master@{#442921}
parent 0fc24d12
...@@ -1041,7 +1041,9 @@ void XMLHttpRequest::createRequest(PassRefPtr<EncodedFormData> httpBody, ...@@ -1041,7 +1041,9 @@ void XMLHttpRequest::createRequest(PassRefPtr<EncodedFormData> httpBody,
if (m_upload) if (m_upload)
request.setReportUploadProgress(true); request.setReportUploadProgress(true);
DCHECK(!m_loader); // TODO(yhirano): Turn this CHECK into DCHECK once https://crbug.com/667254
// is fixed.
CHECK(!m_loader);
DCHECK(m_sendFlag); DCHECK(m_sendFlag);
m_loader = ThreadableLoader::create(executionContext, this, options, m_loader = ThreadableLoader::create(executionContext, this, options,
resourceLoaderOptions); resourceLoaderOptions);
...@@ -1050,6 +1052,8 @@ void XMLHttpRequest::createRequest(PassRefPtr<EncodedFormData> httpBody, ...@@ -1050,6 +1052,8 @@ void XMLHttpRequest::createRequest(PassRefPtr<EncodedFormData> httpBody,
return; return;
} }
// TODO(yhirano): Remove this CHECK once https://crbug.com/667254 is fixed.
CHECK(!m_loader);
// Use count for XHR synchronous requests. // Use count for XHR synchronous requests.
UseCounter::count(&executionContext, UseCounter::XMLHttpRequestSynchronous); UseCounter::count(&executionContext, UseCounter::XMLHttpRequestSynchronous);
ThreadableLoader::loadResourceSynchronously(executionContext, request, *this, ThreadableLoader::loadResourceSynchronously(executionContext, request, *this,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment