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

Side by Side Diff: content/browser/service_worker/service_worker_url_request_job.cc

Issue 862053002: Fix referrer policy handling in service workers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/service_worker/service_worker_url_request_job.h" 5 #include "content/browser/service_worker/service_worker_url_request_job.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 request->url = request_->url(); 387 request->url = request_->url();
388 request->method = request_->method(); 388 request->method = request_->method();
389 const net::HttpRequestHeaders& headers = request_->extra_request_headers(); 389 const net::HttpRequestHeaders& headers = request_->extra_request_headers();
390 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext();) { 390 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext();) {
391 if (ServiceWorkerContext::IsExcludedHeaderNameForFetchEvent(it.name())) 391 if (ServiceWorkerContext::IsExcludedHeaderNameForFetchEvent(it.name()))
392 continue; 392 continue;
393 request->headers[it.name()] = it.value(); 393 request->headers[it.name()] = it.value();
394 } 394 }
395 request->blob_uuid = blob_uuid; 395 request->blob_uuid = blob_uuid;
396 request->blob_size = blob_size; 396 request->blob_size = blob_size;
397 request->referrer = GURL(request_->referrer());
398 request->credentials_mode = credentials_mode_; 397 request->credentials_mode = credentials_mode_;
399 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request_); 398 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request_);
400 if (info) { 399 if (info) {
401 request->is_reload = ui::PageTransitionCoreTypeIs( 400 request->is_reload = ui::PageTransitionCoreTypeIs(
402 info->GetPageTransition(), ui::PAGE_TRANSITION_RELOAD); 401 info->GetPageTransition(), ui::PAGE_TRANSITION_RELOAD);
402 request->referrer =
403 Referrer(GURL(request_->referrer()), info->GetReferrerPolicy());
404 } else {
405 CHECK(
406 request_->referrer_policy() ==
407 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE);
Mike West 2015/01/21 16:13:50 Why is the CHECK here safe?
jochen (gone - plz use gerrit) 2015/01/21 16:15:47 If I thought it was safe, I'd make it a DCHECK().
jkarlin 2015/01/21 16:43:47 Certainly seems dangerous to assume the referrer p
jochen (gone - plz use gerrit) 2015/01/21 18:39:42 info is null if the request came from the browser
408 request->referrer =
409 Referrer(GURL(request_->referrer()), blink::WebReferrerPolicyDefault);
403 } 410 }
404 return request.Pass(); 411 return request.Pass();
405 } 412 }
406 413
407 bool ServiceWorkerURLRequestJob::CreateRequestBodyBlob(std::string* blob_uuid, 414 bool ServiceWorkerURLRequestJob::CreateRequestBodyBlob(std::string* blob_uuid,
408 uint64* blob_size) { 415 uint64* blob_size) {
409 if (!body_.get() || !blob_storage_context_) 416 if (!body_.get() || !blob_storage_context_)
410 return false; 417 return false;
411 418
412 std::vector<const ResourceRequestBody::Element*> resolved_elements; 419 std::vector<const ResourceRequestBody::Element*> resolved_elements;
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 } 626 }
620 if (!waiting_stream_url_.is_empty()) { 627 if (!waiting_stream_url_.is_empty()) {
621 StreamRegistry* stream_registry = 628 StreamRegistry* stream_registry =
622 GetStreamContextForResourceContext(resource_context_)->registry(); 629 GetStreamContextForResourceContext(resource_context_)->registry();
623 stream_registry->RemoveRegisterObserver(waiting_stream_url_); 630 stream_registry->RemoveRegisterObserver(waiting_stream_url_);
624 stream_registry->AbortPendingStream(waiting_stream_url_); 631 stream_registry->AbortPendingStream(waiting_stream_url_);
625 } 632 }
626 } 633 }
627 634
628 } // namespace content 635 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_cache_unittest.cc ('k') | content/common/service_worker/service_worker_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698