OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "core/loader/BaseFetchContext.h" | 5 #include "core/loader/BaseFetchContext.h" |
6 | 6 |
7 #include "core/dom/ExecutionContext.h" | 7 #include "core/dom/ExecutionContext.h" |
8 #include "core/frame/ContentSettingsClient.h" | 8 #include "core/frame/ContentSettingsClient.h" |
9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
10 #include "core/inspector/ConsoleMessage.h" | 10 #include "core/inspector/ConsoleMessage.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 if (ShouldBlockRequestByInspector(resource_request)) | 180 if (ShouldBlockRequestByInspector(resource_request)) |
181 return ResourceRequestBlockedReason::kInspector; | 181 return ResourceRequestBlockedReason::kInspector; |
182 | 182 |
183 SecurityOrigin* security_origin = options.security_origin.Get(); | 183 SecurityOrigin* security_origin = options.security_origin.Get(); |
184 if (!security_origin && execution_context_) | 184 if (!security_origin && execution_context_) |
185 security_origin = execution_context_->GetSecurityOrigin(); | 185 security_origin = execution_context_->GetSecurityOrigin(); |
186 | 186 |
187 if (origin_restriction != FetchParameters::kNoOriginRestriction && | 187 if (origin_restriction != FetchParameters::kNoOriginRestriction && |
188 security_origin && !security_origin->CanDisplay(url)) { | 188 security_origin && !security_origin->CanDisplay(url)) { |
189 if (reporting_policy == SecurityViolationReportingPolicy::kReport) | 189 if (reporting_policy == SecurityViolationReportingPolicy::kReport) |
190 ReportLocalLoadFailed(url); | 190 execution_context_->ReportLocalLoadFailed(url); |
191 RESOURCE_LOADING_DVLOG(1) << "ResourceFetcher::requestResource URL was not " | 191 RESOURCE_LOADING_DVLOG(1) << "ResourceFetcher::requestResource URL was not " |
192 "allowed by SecurityOrigin::CanDisplay"; | 192 "allowed by SecurityOrigin::CanDisplay"; |
193 return ResourceRequestBlockedReason::kOther; | 193 return ResourceRequestBlockedReason::kOther; |
194 } | 194 } |
195 | 195 |
196 // Some types of resources can be loaded only from the same origin. Other | 196 // Some types of resources can be loaded only from the same origin. Other |
197 // types of resources, like Images, Scripts, and CSS, can be loaded from | 197 // types of resources, like Images, Scripts, and CSS, can be loaded from |
198 // any URL. | 198 // any URL. |
199 switch (type) { | 199 switch (type) { |
200 case Resource::kMainResource: | 200 case Resource::kMainResource: |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 313 |
314 return ResourceRequestBlockedReason::kNone; | 314 return ResourceRequestBlockedReason::kNone; |
315 } | 315 } |
316 | 316 |
317 DEFINE_TRACE(BaseFetchContext) { | 317 DEFINE_TRACE(BaseFetchContext) { |
318 visitor->Trace(execution_context_); | 318 visitor->Trace(execution_context_); |
319 FetchContext::Trace(visitor); | 319 FetchContext::Trace(visitor); |
320 } | 320 } |
321 | 321 |
322 } // namespace blink | 322 } // namespace blink |
OLD | NEW |