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

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 // The base class method takes a non const reference of a ResourceRequest
129 // and returns bool just for allowing RawResource to reject redirect. It
130 // must always return true.
131 DCHECK(follow);
128 132
129 DCHECK(!redirectResponse.isNull()); 133 DCHECK(!redirectResponse.isNull());
130 ResourceClientWalker<RawResourceClient> w(clients()); 134 ResourceClientWalker<RawResourceClient> w(clients());
131 while (RawResourceClient* c = w.next()) 135 while (RawResourceClient* c = w.next()) {
132 c->redirectReceived(this, newRequest, redirectResponse); 136 if (!c->redirectReceived(this, newRequest, redirectResponse)) {
137 follow = false;
138 newRequest = ResourceRequest();
139 }
140 }
141
142 return follow;
133 } 143 }
134 144
135 void RawResource::willNotFollowRedirect() 145 void RawResource::willNotFollowRedirect()
136 { 146 {
137 ResourceClientWalker<RawResourceClient> w(clients()); 147 ResourceClientWalker<RawResourceClient> w(clients());
138 while (RawResourceClient* c = w.next()) 148 while (RawResourceClient* c = w.next())
139 c->redirectBlocked(); 149 c->redirectBlocked();
140 } 150 }
141 151
142 void RawResource::responseReceived(const ResourceResponse& response, std::unique _ptr<WebDataConsumerHandle> handle) 152 void RawResource::responseReceived(const ResourceResponse& response, std::unique _ptr<WebDataConsumerHandle> handle)
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 342
333 NEVER_INLINE void RawResourceClientStateChecker::notifyFinished(Resource* resour ce) 343 NEVER_INLINE void RawResourceClientStateChecker::notifyFinished(Resource* resour ce)
334 { 344 {
335 SECURITY_CHECK(m_state != NotAddedAsClient); 345 SECURITY_CHECK(m_state != NotAddedAsClient);
336 SECURITY_CHECK(m_state != NotifyFinished); 346 SECURITY_CHECK(m_state != NotifyFinished);
337 SECURITY_CHECK(resource->errorOccurred() || (m_state == ResponseReceived || m_state == SetSerializedCachedMetadata || m_state == DataReceived || m_state == DataDownloaded)); 347 SECURITY_CHECK(resource->errorOccurred() || (m_state == ResponseReceived || m_state == SetSerializedCachedMetadata || m_state == DataReceived || m_state == DataDownloaded));
338 m_state = NotifyFinished; 348 m_state = NotifyFinished;
339 } 349 }
340 350
341 } // namespace blink 351 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698