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

Side by Side Diff: third_party/WebKit/Source/core/fetch/RawResource.cpp

Issue 2230173002: Change WebURLLoaderClient::willFollowRedirect() API to return bool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All Rights Reserved. 2 * Copyright (C) 2011 Google Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 client->responseReceived(this, response(), nullptr); 115 client->responseReceived(this, response(), nullptr);
116 if (!hasClient(c)) 116 if (!hasClient(c))
117 return; 117 return;
118 if (data()) 118 if (data())
119 client->dataReceived(this, data()->data(), data()->size()); 119 client->dataReceived(this, data()->data(), data()->size());
120 if (!hasClient(c)) 120 if (!hasClient(c))
121 return; 121 return;
122 Resource::didAddClient(client); 122 Resource::didAddClient(client);
123 } 123 }
124 124
125 void RawResource::willFollowRedirect(ResourceRequest& newRequest, const Resource Response& redirectResponse) 125 bool RawResource::willFollowRedirect(ResourceRequest& newRequest, const Resource Response& redirectResponse)
126 { 126 {
127 Resource::willFollowRedirect(newRequest, redirectResponse); 127 bool follow = Resource::willFollowRedirect(newRequest, redirectResponse);
128 if (!follow)
129 newRequest = ResourceRequest();
Nate Chapin 2016/09/06 16:46:14 Why is blanking the ResourceRequest needed?
tyoshino (SeeGerritForStatus) 2016/09/07 10:52:28 Ah, yeah. It's unnecessary. I just tried to make t
128 130
129 ASSERT(!redirectResponse.isNull()); 131 ASSERT(!redirectResponse.isNull());
130 ResourceClientWalker<RawResourceClient> w(clients()); 132 ResourceClientWalker<RawResourceClient> w(clients());
131 while (RawResourceClient* c = w.next()) 133 while (RawResourceClient* c = w.next()) {
132 c->redirectReceived(this, newRequest, redirectResponse); 134 if (!c->redirectReceived(this, newRequest, redirectResponse)) {
135 follow = false;
136 newRequest = ResourceRequest();
tyoshino (SeeGerritForStatus) 2016/09/07 10:52:28 This is to keep the clients see the same (possibly
Nate Chapin 2016/09/07 17:05:45 How much trouble would it be to change the behavio
tyoshino (SeeGerritForStatus) 2016/09/14 14:53:47 We need some clean - one is https://codereview.chr
Nate Chapin 2016/09/14 22:25:27 OK.
137 }
138 }
139
140 return follow;
133 } 141 }
134 142
135 void RawResource::willNotFollowRedirect() 143 void RawResource::willNotFollowRedirect()
136 { 144 {
137 ResourceClientWalker<RawResourceClient> w(clients()); 145 ResourceClientWalker<RawResourceClient> w(clients());
138 while (RawResourceClient* c = w.next()) 146 while (RawResourceClient* c = w.next())
139 c->redirectBlocked(); 147 c->redirectBlocked();
140 } 148 }
141 149
142 void RawResource::responseReceived(const ResourceResponse& response, std::unique _ptr<WebDataConsumerHandle> handle) 150 void RawResource::responseReceived(const ResourceResponse& response, std::unique _ptr<WebDataConsumerHandle> handle)
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 333
326 void RawResourceClientStateChecker::notifyFinished(Resource* resource) 334 void RawResourceClientStateChecker::notifyFinished(Resource* resource)
327 { 335 {
328 SECURITY_CHECK(m_state != NotAddedAsClient); 336 SECURITY_CHECK(m_state != NotAddedAsClient);
329 SECURITY_CHECK(m_state != NotifyFinished); 337 SECURITY_CHECK(m_state != NotifyFinished);
330 SECURITY_CHECK(resource->errorOccurred() || (m_state == ResponseReceived || m_state == SetSerializedCachedMetadata || m_state == DataReceived || m_state == DataDownloaded)); 338 SECURITY_CHECK(resource->errorOccurred() || (m_state == ResponseReceived || m_state == SetSerializedCachedMetadata || m_state == DataReceived || m_state == DataDownloaded));
331 m_state = NotifyFinished; 339 m_state = NotifyFinished;
332 } 340 }
333 341
334 } // namespace blink 342 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698