Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(539)

Unified Diff: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp

Issue 2146403004: ThreadableLoader::cancel should be called before loader destruction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@onheap-threadable-loader-client-wrapper
Patch Set: fix Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
index b7a413c6c6ef3093cd08612e92bf7f046ddec963..6169373cb9fde5827c4d9de390ea99c472c40755 100644
--- a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
@@ -345,7 +345,7 @@ void DocumentThreadableLoader::makeCrossOriginAccessRequest(const ResourceReques
DocumentThreadableLoader::~DocumentThreadableLoader()
{
- m_client = nullptr;
+ DCHECK(!m_client);
hiroshige 2016/07/19 06:56:13 optional: how about making this CHECK() for a whil
yhirano 2016/07/19 08:05:03 Done.
// TODO(oilpan): Remove this once DocumentThreadableLoader is once again a ResourceOwner.
clearResource();
@@ -937,16 +937,19 @@ void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, Resou
ResourceError error = resource ? resource->resourceError() : ResourceError();
InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(m_document, identifier, m_client);
+ ThreadableLoaderClient* client = m_client;
hiroshige 2016/07/19 06:56:14 IIUC the changes of lines 940--961 are made in ord
yhirano 2016/07/19 08:05:03 Yes, as m_client will never be used after a comple
if (!resource) {
- m_client->didFail(error);
+ m_client = nullptr;
+ client->didFail(error);
return;
}
// No exception for file:/// resources, see <rdar://problem/4962298>.
// Also, if we have an HTTP response, then it wasn't a network error in fact.
if (!error.isNull() && !requestURL.isLocalFile() && response.httpStatusCode() <= 0) {
- m_client->didFail(error);
+ m_client = nullptr;
+ client->didFail(error);
return;
}
@@ -954,7 +957,8 @@ void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, Resou
// request and response URLs. This isn't a perfect test though, since a server can serve a redirect to the same URL that was
// requested. Also comparing the request and response URLs as strings will fail if the requestURL still has its credentials.
if (requestURL != response.url() && !isAllowedRedirect(response.url())) {
- m_client->didFailRedirectCheck();
+ m_client = nullptr;
+ client->didFailRedirectCheck();
return;
}

Powered by Google App Engine
This is Rietveld 408576698