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

Unified Diff: third_party/WebKit/Source/core/loader/BaseFetchContext.cpp

Issue 2844913002: Drop GetFrame()->GetDocument() usage in FrameFetchContext (Closed)
Patch Set: Add comment in SendMessageToConsoleForPossiblyNullDocument 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/loader/BaseFetchContext.cpp
diff --git a/third_party/WebKit/Source/core/loader/BaseFetchContext.cpp b/third_party/WebKit/Source/core/loader/BaseFetchContext.cpp
index ae92738c45035ba21a2f10cfb4fb665d77eb75c2..7134f9cfb4d51349a7bc472347142dbb5a177979 100644
--- a/third_party/WebKit/Source/core/loader/BaseFetchContext.cpp
+++ b/third_party/WebKit/Source/core/loader/BaseFetchContext.cpp
@@ -257,13 +257,16 @@ ResourceRequestBlockedReason BaseFetchContext::CanRequestInternal(
// Measure the number of legacy URL schemes ('ftp://') and the number of
// embedded-credential ('http://user:password@...') resources embedded as
// subresources.
- if (resource_request.GetFrameType() != WebURLRequest::kFrameTypeTopLevel) {
- if (GetMainResourceSecurityContext() &&
- SchemeRegistry::ShouldTreatURLSchemeAsLegacy(url.Protocol()) &&
+ WebURLRequest::FrameType frame_type = resource_request.GetFrameType();
+ if (frame_type != WebURLRequest::kFrameTypeTopLevel) {
+ bool is_subresource = frame_type == WebURLRequest::kFrameTypeNone;
+ SecurityContext* embedding_context =
+ is_subresource ? &execution_context_->GetSecurityContext()
+ : GetParentSecurityContext();
+ DCHECK(embedding_context);
+ if (SchemeRegistry::ShouldTreatURLSchemeAsLegacy(url.Protocol()) &&
!SchemeRegistry::ShouldTreatURLSchemeAsLegacy(
- GetMainResourceSecurityContext()
- ->GetSecurityOrigin()
- ->Protocol())) {
+ embedding_context->GetSecurityOrigin()->Protocol())) {
CountDeprecation(UseCounter::kLegacyProtocolEmbeddedAsSubresource);
// TODO(mkwst): Enabled by default in M59. Drop the runtime-enabled check

Powered by Google App Engine
This is Rietveld 408576698