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

Side by Side Diff: third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp

Issue 2790693002: Split CSP into pre- and post-upgrade checks (Closed)
Patch Set: revert accidental AbstractWorker change Created 3 years, 8 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) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 rights reserved. 6 rights reserved.
7 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 7 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
8 8
9 This library is free software; you can redistribute it and/or 9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public 10 modify it under the terms of the GNU Library General Public
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 const ResourceFactory& factory, 493 const ResourceFactory& factory,
494 const SubstituteData& substitute_data, 494 const SubstituteData& substitute_data,
495 unsigned long identifier, 495 unsigned long identifier,
496 ResourceRequestBlockedReason& blocked_reason) { 496 ResourceRequestBlockedReason& blocked_reason) {
497 ResourceRequest& resource_request = params.MutableResourceRequest(); 497 ResourceRequest& resource_request = params.MutableResourceRequest();
498 498
499 DCHECK(params.Options().synchronous_policy == kRequestAsynchronously || 499 DCHECK(params.Options().synchronous_policy == kRequestAsynchronously ||
500 factory.GetType() == Resource::kRaw || 500 factory.GetType() == Resource::kRaw ||
501 factory.GetType() == Resource::kXSLStyleSheet); 501 factory.GetType() == Resource::kXSLStyleSheet);
502 502
503 SecurityViolationReportingPolicy reporting_policy =
504 params.IsSpeculativePreload()
505 ? SecurityViolationReportingPolicy::kSuppressReporting
506 : SecurityViolationReportingPolicy::kReport;
503 Context().PopulateResourceRequest( 507 Context().PopulateResourceRequest(
508 MemoryCache::RemoveFragmentIdentifierIfNeeded(params.Url()),
504 factory.GetType(), params.GetClientHintsPreferences(), 509 factory.GetType(), params.GetClientHintsPreferences(),
505 params.GetResourceWidth(), resource_request); 510 params.GetResourceWidth(), params.Options(), reporting_policy,
511 resource_request);
506 512
507 if (!params.Url().IsValid()) 513 if (!params.Url().IsValid())
508 return kAbort; 514 return kAbort;
509 515
510 resource_request.SetPriority(ComputeLoadPriority( 516 resource_request.SetPriority(ComputeLoadPriority(
511 factory.GetType(), params.GetResourceRequest(), 517 factory.GetType(), params.GetResourceRequest(),
512 ResourcePriority::kNotVisible, params.Defer(), 518 ResourcePriority::kNotVisible, params.Defer(),
513 params.IsSpeculativePreload(), params.IsLinkPreload())); 519 params.IsSpeculativePreload(), params.IsLinkPreload()));
514 InitializeResourceRequest(resource_request, factory.GetType(), 520 InitializeResourceRequest(resource_request, factory.GetType(),
515 params.Defer()); 521 params.Defer());
516 network_instrumentation::resourcePrioritySet(identifier, 522 network_instrumentation::resourcePrioritySet(identifier,
517 resource_request.Priority()); 523 resource_request.Priority());
518 524
519 blocked_reason = Context().CanRequest( 525 blocked_reason = Context().CanRequest(
520 factory.GetType(), resource_request, 526 factory.GetType(), resource_request,
521 MemoryCache::RemoveFragmentIdentifierIfNeeded(params.Url()), 527 MemoryCache::RemoveFragmentIdentifierIfNeeded(params.Url()),
522 params.Options(), 528 params.Options(),
523 /* Don't send security violation reports for speculative preloads */ 529 /* Don't send security violation reports for speculative preloads */
524 params.IsSpeculativePreload() 530 reporting_policy, params.GetOriginRestriction());
525 ? SecurityViolationReportingPolicy::kSuppressReporting
526 : SecurityViolationReportingPolicy::kReport,
527 params.GetOriginRestriction());
528 if (blocked_reason != ResourceRequestBlockedReason::kNone) { 531 if (blocked_reason != ResourceRequestBlockedReason::kNone) {
529 DCHECK(!substitute_data.ForceSynchronousLoad()); 532 DCHECK(!substitute_data.ForceSynchronousLoad());
530 return kBlock; 533 return kBlock;
531 } 534 }
532 535
533 // For initial requests, call prepareRequest() here before revalidation 536 // For initial requests, call prepareRequest() here before revalidation
534 // policy is determined. 537 // policy is determined.
535 Context().PrepareRequest(resource_request, 538 Context().PrepareRequest(resource_request,
536 FetchContext::RedirectType::kNotForRedirect); 539 FetchContext::RedirectType::kNotForRedirect);
537 540
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 visitor->Trace(context_); 1580 visitor->Trace(context_);
1578 visitor->Trace(archive_); 1581 visitor->Trace(archive_);
1579 visitor->Trace(loaders_); 1582 visitor->Trace(loaders_);
1580 visitor->Trace(non_blocking_loaders_); 1583 visitor->Trace(non_blocking_loaders_);
1581 visitor->Trace(document_resources_); 1584 visitor->Trace(document_resources_);
1582 visitor->Trace(preloads_); 1585 visitor->Trace(preloads_);
1583 visitor->Trace(resource_timing_info_map_); 1586 visitor->Trace(resource_timing_info_map_);
1584 } 1587 }
1585 1588
1586 } // namespace blink 1589 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698