| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #include "core/loader/DocumentLoader.h" | 30 #include "core/loader/DocumentLoader.h" |
| 31 | 31 |
| 32 #include <memory> | 32 #include <memory> |
| 33 #include "core/dom/Document.h" | 33 #include "core/dom/Document.h" |
| 34 #include "core/dom/DocumentParser.h" | 34 #include "core/dom/DocumentParser.h" |
| 35 #include "core/dom/WeakIdentifierMap.h" | 35 #include "core/dom/WeakIdentifierMap.h" |
| 36 #include "core/events/Event.h" | 36 #include "core/events/Event.h" |
| 37 #include "core/frame/Deprecation.h" | 37 #include "core/frame/Deprecation.h" |
| 38 #include "core/frame/FrameConsole.h" |
| 38 #include "core/frame/LocalDOMWindow.h" | 39 #include "core/frame/LocalDOMWindow.h" |
| 39 #include "core/frame/LocalFrame.h" | 40 #include "core/frame/LocalFrame.h" |
| 40 #include "core/frame/LocalFrameClient.h" | 41 #include "core/frame/LocalFrameClient.h" |
| 41 #include "core/frame/Settings.h" | 42 #include "core/frame/Settings.h" |
| 42 #include "core/frame/csp/ContentSecurityPolicy.h" | 43 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 43 #include "core/html/HTMLFrameOwnerElement.h" | 44 #include "core/html/HTMLFrameOwnerElement.h" |
| 44 #include "core/html/parser/HTMLParserIdioms.h" | 45 #include "core/html/parser/HTMLParserIdioms.h" |
| 45 #include "core/html/parser/TextResourceDecoder.h" | 46 #include "core/html/parser/TextResourceDecoder.h" |
| 46 #include "core/inspector/ConsoleMessage.h" | 47 #include "core/inspector/ConsoleMessage.h" |
| 47 #include "core/inspector/InspectorTraceEvents.h" | 48 #include "core/inspector/InspectorTraceEvents.h" |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 DCHECK_EQ(resource, main_resource_); | 461 DCHECK_EQ(resource, main_resource_); |
| 461 DCHECK(!redirect_response.IsNull()); | 462 DCHECK(!redirect_response.IsNull()); |
| 462 request_ = request; | 463 request_ = request; |
| 463 | 464 |
| 464 // If the redirecting url is not allowed to display content from the target | 465 // If the redirecting url is not allowed to display content from the target |
| 465 // origin, then block the redirect. | 466 // origin, then block the redirect. |
| 466 const KURL& request_url = request_.Url(); | 467 const KURL& request_url = request_.Url(); |
| 467 RefPtr<SecurityOrigin> redirecting_origin = | 468 RefPtr<SecurityOrigin> redirecting_origin = |
| 468 SecurityOrigin::Create(redirect_response.Url()); | 469 SecurityOrigin::Create(redirect_response.Url()); |
| 469 if (!redirecting_origin->CanDisplay(request_url)) { | 470 if (!redirecting_origin->CanDisplay(request_url)) { |
| 470 FrameLoader::ReportLocalLoadFailed(frame_, request_url.GetString()); | 471 frame_->Console().AddMessage(ConsoleMessage::Create( |
| 472 kSecurityMessageSource, kErrorMessageLevel, |
| 473 "Not allowed to load local resource: " + request_url.GetString())); |
| 471 fetcher_->StopFetching(); | 474 fetcher_->StopFetching(); |
| 472 return false; | 475 return false; |
| 473 } | 476 } |
| 474 if (GetFrameLoader().ShouldContinueForRedirectNavigationPolicy( | 477 if (GetFrameLoader().ShouldContinueForRedirectNavigationPolicy( |
| 475 request_, SubstituteData(), this, kCheckContentSecurityPolicy, | 478 request_, SubstituteData(), this, kCheckContentSecurityPolicy, |
| 476 navigation_type_, kNavigationPolicyCurrentTab, load_type_, | 479 navigation_type_, kNavigationPolicyCurrentTab, load_type_, |
| 477 IsClientRedirect(), nullptr) != kNavigationPolicyCurrentTab) { | 480 IsClientRedirect(), nullptr) != kNavigationPolicyCurrentTab) { |
| 478 fetcher_->StopFetching(); | 481 fetcher_->StopFetching(); |
| 479 return false; | 482 return false; |
| 480 } | 483 } |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 InstallNewDocumentReason::kJavascriptURL, | 1106 InstallNewDocumentReason::kJavascriptURL, |
| 1104 kForceSynchronousParsing, KURL()); | 1107 kForceSynchronousParsing, KURL()); |
| 1105 if (!source.IsNull()) | 1108 if (!source.IsNull()) |
| 1106 writer_->AppendReplacingData(source); | 1109 writer_->AppendReplacingData(source); |
| 1107 EndWriting(); | 1110 EndWriting(); |
| 1108 } | 1111 } |
| 1109 | 1112 |
| 1110 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 1113 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
| 1111 | 1114 |
| 1112 } // namespace blink | 1115 } // namespace blink |
| OLD | NEW |