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

Side by Side Diff: webkit/glue/media/buffered_resource_loader.cc

Issue 6580014: Make playback fail if redirected to a different origin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix spelling error Created 9 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/glue/media/buffered_resource_loader_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "webkit/glue/media/buffered_resource_loader.h" 5 #include "webkit/glue/media/buffered_resource_loader.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 const WebURLResponse& redirectResponse) { 241 const WebURLResponse& redirectResponse) {
242 242
243 // The load may have been stopped and |start_callback| is destroyed. 243 // The load may have been stopped and |start_callback| is destroyed.
244 // In this case we shouldn't do anything. 244 // In this case we shouldn't do anything.
245 if (!start_callback_.get()) { 245 if (!start_callback_.get()) {
246 // Set the url in the request to an invalid value (empty url). 246 // Set the url in the request to an invalid value (empty url).
247 newRequest.setURL(WebKit::WebURL()); 247 newRequest.setURL(WebKit::WebURL());
248 return; 248 return;
249 } 249 }
250 250
251 if (!IsProtocolSupportedForMedia(newRequest.url())) { 251 // Only allow |single_origin_| if we haven't seen a different origin yet.
252 if (single_origin_)
253 single_origin_ = url_.GetOrigin() == GURL(newRequest.url()).GetOrigin();
254
255 // Enforce same-origin policy and cause redirects to other origins to
256 // look like network errors.
257 // http://dev.w3.org/html5/spec/Overview.html#concept-media-load-resource
258 // http://dev.w3.org/html5/spec/Overview.html#fetch
259 if (!single_origin_ || !IsProtocolSupportedForMedia(newRequest.url())) {
252 // Set the url in the request to an invalid value (empty url). 260 // Set the url in the request to an invalid value (empty url).
253 newRequest.setURL(WebKit::WebURL()); 261 newRequest.setURL(WebKit::WebURL());
254 DoneStart(net::ERR_ADDRESS_INVALID); 262 DoneStart(net::ERR_ADDRESS_INVALID);
255 Stop();
256 return; 263 return;
257 } 264 }
258 265
259 // Only allow |single_origin_| if we haven't seen a different origin yet.
260 if (single_origin_)
261 single_origin_ = url_.GetOrigin() == GURL(newRequest.url()).GetOrigin();
262
263 url_ = newRequest.url(); 266 url_ = newRequest.url();
264 } 267 }
265 268
266 void BufferedResourceLoader::didSendData( 269 void BufferedResourceLoader::didSendData(
267 WebURLLoader* loader, 270 WebURLLoader* loader,
268 unsigned long long bytes_sent, 271 unsigned long long bytes_sent,
269 unsigned long long total_bytes_to_be_sent) { 272 unsigned long long total_bytes_to_be_sent) {
270 NOTIMPLEMENTED(); 273 NOTIMPLEMENTED();
271 } 274 }
272 275
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 start_callback_->RunWithParams(Tuple1<int>(error)); 581 start_callback_->RunWithParams(Tuple1<int>(error));
579 start_callback_.reset(); 582 start_callback_.reset();
580 } 583 }
581 584
582 void BufferedResourceLoader::NotifyNetworkEvent() { 585 void BufferedResourceLoader::NotifyNetworkEvent() {
583 if (event_callback_.get()) 586 if (event_callback_.get())
584 event_callback_->Run(); 587 event_callback_->Run();
585 } 588 }
586 589
587 } // namespace webkit_glue 590 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « no previous file | webkit/glue/media/buffered_resource_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698