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 2020313002: Verify the order of RawResourceClient callbacks in DocumentThreadableLoader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rebase error and update TODO comment 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 for (const auto& header : oldHeaders) { 254 for (const auto& header : oldHeaders) {
255 AtomicString headerName = header.key; 255 AtomicString headerName = header.key;
256 if (!shouldIgnoreHeaderForCacheReuse(headerName) && header.value != newH eaders.get(headerName)) 256 if (!shouldIgnoreHeaderForCacheReuse(headerName) && header.value != newH eaders.get(headerName))
257 return false; 257 return false;
258 } 258 }
259 259
260 return true; 260 return true;
261 } 261 }
262 262
263 RawResourceClientStateChecker::RawResourceClientStateChecker()
264 : m_state(NotAddedAsClient)
265 {
266 }
267
268 RawResourceClientStateChecker::~RawResourceClientStateChecker()
269 {
270 }
271
272 void RawResourceClientStateChecker::willAddClient()
273 {
274 SECURITY_CHECK(m_state == NotAddedAsClient);
275 m_state = Started;
276 }
277
278 void RawResourceClientStateChecker::willRemoveClient()
279 {
280 SECURITY_CHECK(m_state != NotAddedAsClient);
281 m_state = NotAddedAsClient;
282 }
283
284 void RawResourceClientStateChecker::redirectReceived()
285 {
286 SECURITY_CHECK(m_state == Started);
287 }
288
289 void RawResourceClientStateChecker::redirectBlocked()
290 {
291 SECURITY_CHECK(m_state == Started);
292 m_state = RedirectBlocked;
293 }
294
295 void RawResourceClientStateChecker::dataSent()
296 {
297 SECURITY_CHECK(m_state == Started);
298 }
299
300 void RawResourceClientStateChecker::responseReceived()
301 {
302 SECURITY_CHECK(m_state == Started);
303 m_state = ResponseReceived;
304 }
305
306 void RawResourceClientStateChecker::setSerializedCachedMetadata()
307 {
308 SECURITY_CHECK(m_state == ResponseReceived);
309 m_state = SetSerializedCachedMetadata;
310 }
311
312 void RawResourceClientStateChecker::dataReceived()
313 {
314 SECURITY_CHECK(m_state == ResponseReceived || m_state == SetSerializedCached Metadata || m_state == DataReceived);
315 m_state = DataReceived;
316 }
317
318 void RawResourceClientStateChecker::dataDownloaded()
319 {
320 SECURITY_CHECK(m_state == ResponseReceived || m_state == SetSerializedCached Metadata || m_state == DataDownloaded);
321 m_state = DataDownloaded;
322 }
323
324 void RawResourceClientStateChecker::notifyFinished(Resource* resource)
325 {
326 SECURITY_CHECK(m_state != NotAddedAsClient);
327 SECURITY_CHECK(m_state != NotifyFinished);
328 SECURITY_CHECK(resource->errorOccurred() || (m_state == ResponseReceived || m_state == SetSerializedCachedMetadata || m_state == DataReceived || m_state == DataDownloaded));
329 m_state = NotifyFinished;
330 }
331
263 } // namespace blink 332 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/RawResource.h ('k') | third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698