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

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: Created 4 years, 6 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 257
258 for (const auto& header : oldHeaders) { 258 for (const auto& header : oldHeaders) {
259 AtomicString headerName = header.key; 259 AtomicString headerName = header.key;
260 if (!shouldIgnoreHeaderForCacheReuse(headerName) && header.value != newH eaders.get(headerName)) 260 if (!shouldIgnoreHeaderForCacheReuse(headerName) && header.value != newH eaders.get(headerName))
261 return false; 261 return false;
262 } 262 }
263 263
264 return true; 264 return true;
265 } 265 }
266 266
267 RawResourceClientStateChecker::RawResourceClientStateChecker()
268 : m_state(NotAddedAsClient)
269 {
270 }
271
272 RawResourceClientStateChecker::~RawResourceClientStateChecker()
273 {
274 SECURITY_CHECK(m_state == NotAddedAsClient);
275 }
276
277 void RawResourceClientStateChecker::willAddClient()
278 {
279 SECURITY_CHECK(m_state == NotAddedAsClient);
280 m_state = Started;
281 }
282
283 void RawResourceClientStateChecker::willRemoveClient()
284 {
285 SECURITY_CHECK(m_state != NotAddedAsClient);
286 m_state = NotAddedAsClient;
287 }
288
289 void RawResourceClientStateChecker::redirectReceived()
290 {
291 SECURITY_CHECK(m_state == Started);
292 }
293
294 void RawResourceClientStateChecker::redirectBlocked()
295 {
296 SECURITY_CHECK(m_state == Started);
297 m_state = RedirectBlocked;
298 }
299
300 void RawResourceClientStateChecker::dataSent()
301 {
302 SECURITY_CHECK(m_state == Started);
303 }
304
305 void RawResourceClientStateChecker::responseReceived()
306 {
307 SECURITY_CHECK(m_state == Started);
308 m_state = ResponseReceived;
309 }
310
311 void RawResourceClientStateChecker::setSerializedCachedMetadata()
312 {
313 SECURITY_CHECK(m_state == ResponseReceived);
314 m_state = SetSerializedCachedMetadata;
315 }
316
317 void RawResourceClientStateChecker::dataReceived()
318 {
319 SECURITY_CHECK(m_state == ResponseReceived || m_state == SetSerializedCached Metadata || m_state == DataReceived);
320 m_state = DataReceived;
321 }
322
323 void RawResourceClientStateChecker::dataDownloaded()
324 {
325 SECURITY_CHECK(m_state == ResponseReceived || m_state == SetSerializedCached Metadata || m_state == DataDownloaded);
326 m_state = DataDownloaded;
327 }
328
329 void RawResourceClientStateChecker::notifyFinished(Resource* resource)
330 {
331 SECURITY_CHECK(m_state != NotAddedAsClient);
332 SECURITY_CHECK(m_state != NotifyFinished);
333 SECURITY_CHECK(resource->errorOccurred() || (m_state == ResponseReceived || m_state == SetSerializedCachedMetadata || m_state == DataReceived || m_state == DataDownloaded));
334 m_state = NotifyFinished;
335 }
336
267 } // namespace blink 337 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698