OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
6 * (http://www.torchmobile.com/) | 6 * (http://www.torchmobile.com/) |
7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> | 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> |
10 * Copyright (C) 2011 Google Inc. All rights reserved. | 10 * Copyright (C) 2011 Google Inc. All rights reserved. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 #include "core/svg/graphics/SVGImage.h" | 82 #include "core/svg/graphics/SVGImage.h" |
83 #include "core/xml/parser/XMLDocumentParser.h" | 83 #include "core/xml/parser/XMLDocumentParser.h" |
84 #include "platform/InstanceCounters.h" | 84 #include "platform/InstanceCounters.h" |
85 #include "platform/PluginScriptForbiddenScope.h" | 85 #include "platform/PluginScriptForbiddenScope.h" |
86 #include "platform/ScriptForbiddenScope.h" | 86 #include "platform/ScriptForbiddenScope.h" |
87 #include "platform/UserGestureIndicator.h" | 87 #include "platform/UserGestureIndicator.h" |
88 #include "platform/instrumentation/tracing/TraceEvent.h" | 88 #include "platform/instrumentation/tracing/TraceEvent.h" |
89 #include "platform/loader/fetch/ResourceFetcher.h" | 89 #include "platform/loader/fetch/ResourceFetcher.h" |
90 #include "platform/loader/fetch/ResourceRequest.h" | 90 #include "platform/loader/fetch/ResourceRequest.h" |
91 #include "platform/network/HTTPParsers.h" | 91 #include "platform/network/HTTPParsers.h" |
| 92 #include "platform/network/NetworkUtils.h" |
92 #include "platform/scroll/ScrollAnimatorBase.h" | 93 #include "platform/scroll/ScrollAnimatorBase.h" |
93 #include "platform/weborigin/SchemeRegistry.h" | 94 #include "platform/weborigin/SchemeRegistry.h" |
94 #include "platform/weborigin/SecurityOrigin.h" | 95 #include "platform/weborigin/SecurityOrigin.h" |
95 #include "platform/weborigin/SecurityPolicy.h" | 96 #include "platform/weborigin/SecurityPolicy.h" |
96 #include "platform/weborigin/Suborigin.h" | 97 #include "platform/weborigin/Suborigin.h" |
97 #include "platform/wtf/AutoReset.h" | 98 #include "platform/wtf/AutoReset.h" |
98 #include "platform/wtf/text/CString.h" | 99 #include "platform/wtf/text/CString.h" |
99 #include "platform/wtf/text/WTFString.h" | 100 #include "platform/wtf/text/WTFString.h" |
100 #include "public/platform/WebCachePolicy.h" | 101 #include "public/platform/WebCachePolicy.h" |
101 #include "public/platform/WebURLRequest.h" | 102 #include "public/platform/WebURLRequest.h" |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 | 799 |
799 KURL url = request.GetResourceRequest().Url(); | 800 KURL url = request.GetResourceRequest().Url(); |
800 if (frame_->GetScriptController().ExecuteScriptIfJavaScriptURL(url, nullptr)) | 801 if (frame_->GetScriptController().ExecuteScriptIfJavaScriptURL(url, nullptr)) |
801 return false; | 802 return false; |
802 | 803 |
803 if (!request.OriginDocument()->GetSecurityOrigin()->CanDisplay(url)) { | 804 if (!request.OriginDocument()->GetSecurityOrigin()->CanDisplay(url)) { |
804 ReportLocalLoadFailed(frame_, url.ElidedString()); | 805 ReportLocalLoadFailed(frame_, url.ElidedString()); |
805 return false; | 806 return false; |
806 } | 807 } |
807 | 808 |
| 809 // Block renderer-initiated loads of data URLs in the top frame. If the mime |
| 810 // type of the data URL is supported, the URL will eventually be rendered, so |
| 811 // block it here. Otherwise, the load might be handled by a plugin or end up |
| 812 // as a download, so allow it to let the embedder figure out what to do with |
| 813 // it. |
| 814 if (frame_->IsMainFrame() && |
| 815 !request.GetResourceRequest().IsSameDocumentNavigation() && |
| 816 !frame_->Client()->AllowContentInitiatedDataUrlNavigations( |
| 817 request.OriginDocument()->Url()) && |
| 818 url.ProtocolIsData() && NetworkUtils::IsDataURLMimeTypeSupported(url)) { |
| 819 frame_->GetDocument()->AddConsoleMessage(ConsoleMessage::Create( |
| 820 kSecurityMessageSource, kErrorMessageLevel, |
| 821 "Not allowed to navigate top frame to data URL: " + |
| 822 url.ElidedString())); |
| 823 return false; |
| 824 } |
| 825 |
808 if (!request.Form() && request.FrameName().IsEmpty()) | 826 if (!request.Form() && request.FrameName().IsEmpty()) |
809 request.SetFrameName(frame_->GetDocument()->BaseTarget()); | 827 request.SetFrameName(frame_->GetDocument()->BaseTarget()); |
810 return true; | 828 return true; |
811 } | 829 } |
812 | 830 |
813 static bool ShouldNavigateTargetFrame(NavigationPolicy policy) { | 831 static bool ShouldNavigateTargetFrame(NavigationPolicy policy) { |
814 switch (policy) { | 832 switch (policy) { |
815 case kNavigationPolicyCurrentTab: | 833 case kNavigationPolicyCurrentTab: |
816 return true; | 834 return true; |
817 | 835 |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1831 // TODO(japhet): This is needed because the browser process DCHECKs if the | 1849 // TODO(japhet): This is needed because the browser process DCHECKs if the |
1832 // first entry we commit in a new frame has replacement set. It's unclear | 1850 // first entry we commit in a new frame has replacement set. It's unclear |
1833 // whether the DCHECK is right, investigate removing this special case. | 1851 // whether the DCHECK is right, investigate removing this special case. |
1834 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem && | 1852 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem && |
1835 (!Opener() || !request.Url().IsEmpty()); | 1853 (!Opener() || !request.Url().IsEmpty()); |
1836 loader->SetReplacesCurrentHistoryItem(replace_current_item); | 1854 loader->SetReplacesCurrentHistoryItem(replace_current_item); |
1837 return loader; | 1855 return loader; |
1838 } | 1856 } |
1839 | 1857 |
1840 } // namespace blink | 1858 } // namespace blink |
OLD | NEW |