| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "core/loader/FrameFetchContext.h" | 31 #include "core/loader/FrameFetchContext.h" |
| 32 | 32 |
| 33 #include "bindings/core/v8/ScriptController.h" | 33 #include "bindings/core/v8/ScriptController.h" |
| 34 #include "bindings/core/v8/SourceLocation.h" |
| 34 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
| 35 #include "core/fetch/ClientHintsPreferences.h" | 36 #include "core/fetch/ClientHintsPreferences.h" |
| 36 #include "core/fetch/ResourceLoader.h" | 37 #include "core/fetch/ResourceLoader.h" |
| 37 #include "core/fetch/UniqueIdentifier.h" | 38 #include "core/fetch/UniqueIdentifier.h" |
| 38 #include "core/frame/FrameConsole.h" | 39 #include "core/frame/FrameConsole.h" |
| 39 #include "core/frame/FrameHost.h" | 40 #include "core/frame/FrameHost.h" |
| 40 #include "core/frame/FrameView.h" | 41 #include "core/frame/FrameView.h" |
| 41 #include "core/frame/LocalDOMWindow.h" | 42 #include "core/frame/LocalDOMWindow.h" |
| 42 #include "core/frame/LocalFrame.h" | 43 #include "core/frame/LocalFrame.h" |
| 43 #include "core/frame/Settings.h" | 44 #include "core/frame/Settings.h" |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 return; | 436 return; |
| 436 | 437 |
| 437 String message; | 438 String message; |
| 438 if (!m_document || m_document->url().isNull()) | 439 if (!m_document || m_document->url().isNull()) |
| 439 message = "Unsafe attempt to load URL " + url.elidedString() + '.'; | 440 message = "Unsafe attempt to load URL " + url.elidedString() + '.'; |
| 440 else if (url.isLocalFile() || m_document->url().isLocalFile()) | 441 else if (url.isLocalFile() || m_document->url().isLocalFile()) |
| 441 message = "Unsafe attempt to load URL " + url.elidedString() + " from fr
ame with URL " + m_document->url().elidedString() + ". 'file:' URLs are treated
as unique security origins.\n"; | 442 message = "Unsafe attempt to load URL " + url.elidedString() + " from fr
ame with URL " + m_document->url().elidedString() + ". 'file:' URLs are treated
as unique security origins.\n"; |
| 442 else | 443 else |
| 443 message = "Unsafe attempt to load URL " + url.elidedString() + " from fr
ame with URL " + m_document->url().elidedString() + ". Domains, protocols and po
rts must match.\n"; | 444 message = "Unsafe attempt to load URL " + url.elidedString() + " from fr
ame with URL " + m_document->url().elidedString() + ". Domains, protocols and po
rts must match.\n"; |
| 444 | 445 |
| 445 frame()->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessag
eSource, ErrorMessageLevel, message)); | 446 frame()->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessag
eSource, ErrorMessageLevel, message, SourceLocation::capture(frame()->document()
))); |
| 446 } | 447 } |
| 447 | 448 |
| 448 bool FrameFetchContext::canRequest(Resource::Type type, const ResourceRequest& r
esourceRequest, const KURL& url, const ResourceLoaderOptions& options, bool forP
reload, FetchRequest::OriginRestriction originRestriction) const | 449 bool FrameFetchContext::canRequest(Resource::Type type, const ResourceRequest& r
esourceRequest, const KURL& url, const ResourceLoaderOptions& options, bool forP
reload, FetchRequest::OriginRestriction originRestriction) const |
| 449 { | 450 { |
| 450 ResourceRequestBlockedReason reason = canRequestInternal(type, resourceReque
st, url, options, forPreload, originRestriction, resourceRequest.redirectStatus(
)); | 451 ResourceRequestBlockedReason reason = canRequestInternal(type, resourceReque
st, url, options, forPreload, originRestriction, resourceRequest.redirectStatus(
)); |
| 451 if (reason != ResourceRequestBlockedReasonNone) { | 452 if (reason != ResourceRequestBlockedReasonNone) { |
| 452 if (!forPreload) | 453 if (!forPreload) |
| 453 InspectorInstrumentation::didBlockRequest(frame(), resourceRequest,
masterDocumentLoader(), options.initiatorInfo, reason); | 454 InspectorInstrumentation::didBlockRequest(frame(), resourceRequest,
masterDocumentLoader(), options.initiatorInfo, reason); |
| 454 return false; | 455 return false; |
| 455 } | 456 } |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 } | 758 } |
| 758 | 759 |
| 759 DEFINE_TRACE(FrameFetchContext) | 760 DEFINE_TRACE(FrameFetchContext) |
| 760 { | 761 { |
| 761 visitor->trace(m_document); | 762 visitor->trace(m_document); |
| 762 visitor->trace(m_documentLoader); | 763 visitor->trace(m_documentLoader); |
| 763 FetchContext::trace(visitor); | 764 FetchContext::trace(visitor); |
| 764 } | 765 } |
| 765 | 766 |
| 766 } // namespace blink | 767 } // namespace blink |
| OLD | NEW |