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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 ResourceRequest::RedirectStatus redirect_status) const { | 179 ResourceRequest::RedirectStatus redirect_status) const { |
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 AddConsoleMessage("Not allowed to load local resource: " + |
| 191 url.GetString()); |
| 192 } |
191 RESOURCE_LOADING_DVLOG(1) << "ResourceFetcher::requestResource URL was not " | 193 RESOURCE_LOADING_DVLOG(1) << "ResourceFetcher::requestResource URL was not " |
192 "allowed by SecurityOrigin::CanDisplay"; | 194 "allowed by SecurityOrigin::CanDisplay"; |
193 return ResourceRequestBlockedReason::kOther; | 195 return ResourceRequestBlockedReason::kOther; |
194 } | 196 } |
195 | 197 |
196 // Some types of resources can be loaded only from the same origin. Other | 198 // 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 | 199 // types of resources, like Images, Scripts, and CSS, can be loaded from |
198 // any URL. | 200 // any URL. |
199 switch (type) { | 201 switch (type) { |
200 case Resource::kMainResource: | 202 case Resource::kMainResource: |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 | 318 |
317 return ResourceRequestBlockedReason::kNone; | 319 return ResourceRequestBlockedReason::kNone; |
318 } | 320 } |
319 | 321 |
320 DEFINE_TRACE(BaseFetchContext) { | 322 DEFINE_TRACE(BaseFetchContext) { |
321 visitor->Trace(execution_context_); | 323 visitor->Trace(execution_context_); |
322 FetchContext::Trace(visitor); | 324 FetchContext::Trace(visitor); |
323 } | 325 } |
324 | 326 |
325 } // namespace blink | 327 } // namespace blink |
OLD | NEW |