Chromium Code Reviews| 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(); |
|
Nate Chapin
2017/04/28 21:33:31
The only reason GetMainResourceSecurityContext() n
kinuko
2017/04/29 14:10:20
This is much clearer now, thanks!
|
| + 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 |