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

Side by Side Diff: media/blink/buffered_resource_loader.cc

Issue 1220963004: Check the response URL origin in BufferedDataSource to avoid mixing cross-origin responses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check Origin and canRequest Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/blink/buffered_resource_loader.h" 5 #include "media/blink/buffered_resource_loader.h"
6 6
7 #include "base/bits.h" 7 #include "base/bits.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 void BufferedResourceLoader::didReceiveResponse( 356 void BufferedResourceLoader::didReceiveResponse(
357 WebURLLoader* loader, 357 WebURLLoader* loader,
358 const WebURLResponse& response) { 358 const WebURLResponse& response) {
359 DVLOG(1) << "didReceiveResponse: HTTP/" 359 DVLOG(1) << "didReceiveResponse: HTTP/"
360 << (response.httpVersion() == WebURLResponse::HTTP_0_9 ? "0.9" : 360 << (response.httpVersion() == WebURLResponse::HTTP_0_9 ? "0.9" :
361 response.httpVersion() == WebURLResponse::HTTP_1_0 ? "1.0" : 361 response.httpVersion() == WebURLResponse::HTTP_1_0 ? "1.0" :
362 response.httpVersion() == WebURLResponse::HTTP_1_1 ? "1.1" : 362 response.httpVersion() == WebURLResponse::HTTP_1_1 ? "1.1" :
363 "Unknown") 363 "Unknown")
364 << " " << response.httpStatusCode(); 364 << " " << response.httpStatusCode();
365 DCHECK(active_loader_.get()); 365 DCHECK(active_loader_.get());
366 response_original_url_ = response.wasFetchedViaServiceWorker()
367 ? response.originalURLViaServiceWorker()
368 : response.url();
366 369
367 // The loader may have been stopped and |start_cb| is destroyed. 370 // The loader may have been stopped and |start_cb| is destroyed.
368 // In this case we shouldn't do anything. 371 // In this case we shouldn't do anything.
369 if (start_cb_.is_null()) 372 if (start_cb_.is_null())
370 return; 373 return;
371 374
372 uint32 reasons = GetReasonsForUncacheability(response); 375 uint32 reasons = GetReasonsForUncacheability(response);
373 might_be_reused_from_cache_in_future_ = reasons == 0; 376 might_be_reused_from_cache_in_future_ = reasons == 0;
374 UMA_HISTOGRAM_BOOLEAN("Media.CacheUseful", reasons == 0); 377 UMA_HISTOGRAM_BOOLEAN("Media.CacheUseful", reasons == 0);
375 int shift = 0; 378 int shift = 0;
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 798
796 void BufferedResourceLoader::Log() { 799 void BufferedResourceLoader::Log() {
797 media_log_->AddEvent( 800 media_log_->AddEvent(
798 media_log_->CreateBufferedExtentsChangedEvent( 801 media_log_->CreateBufferedExtentsChangedEvent(
799 offset_ - buffer_.backward_bytes(), 802 offset_ - buffer_.backward_bytes(),
800 offset_, 803 offset_,
801 offset_ + buffer_.forward_bytes())); 804 offset_ + buffer_.forward_bytes()));
802 } 805 }
803 806
804 } // namespace media 807 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698