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 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 // If no origin Document* was specified, skip remaining security checks and | 787 // If no origin Document* was specified, skip remaining security checks and |
788 // assume the caller has fully initialized the FrameLoadRequest. | 788 // assume the caller has fully initialized the FrameLoadRequest. |
789 if (!request.OriginDocument()) | 789 if (!request.OriginDocument()) |
790 return true; | 790 return true; |
791 | 791 |
792 KURL url = request.GetResourceRequest().Url(); | 792 KURL url = request.GetResourceRequest().Url(); |
793 if (frame_->GetScriptController().ExecuteScriptIfJavaScriptURL(url, nullptr)) | 793 if (frame_->GetScriptController().ExecuteScriptIfJavaScriptURL(url, nullptr)) |
794 return false; | 794 return false; |
795 | 795 |
796 if (!request.OriginDocument()->GetSecurityOrigin()->CanDisplay(url)) { | 796 if (!request.OriginDocument()->GetSecurityOrigin()->CanDisplay(url)) { |
797 ReportLocalLoadFailed(frame_, url.ElidedString()); | 797 frame_->GetDocument()->ReportLocalLoadFailed(url.ElidedString()); |
798 return false; | 798 return false; |
799 } | 799 } |
800 | 800 |
801 // Block renderer-initiated loads of data URLs in the top frame. If the mime | 801 // Block renderer-initiated loads of data URLs in the top frame. If the mime |
802 // type of the data URL is supported, the URL will eventually be rendered, so | 802 // type of the data URL is supported, the URL will eventually be rendered, so |
803 // block it here. Otherwise, the load might be handled by a plugin or end up | 803 // block it here. Otherwise, the load might be handled by a plugin or end up |
804 // as a download, so allow it to let the embedder figure out what to do with | 804 // as a download, so allow it to let the embedder figure out what to do with |
805 // it. | 805 // it. |
806 if (frame_->IsMainFrame() && | 806 if (frame_->IsMainFrame() && |
807 !request.GetResourceRequest().IsSameDocumentNavigation() && | 807 !request.GetResourceRequest().IsSameDocumentNavigation() && |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 if (!ShouldTreatURLAsSrcdocDocument(url)) | 1030 if (!ShouldTreatURLAsSrcdocDocument(url)) |
1031 return SubstituteData(); | 1031 return SubstituteData(); |
1032 String srcdoc = frame_->DeprecatedLocalOwner()->FastGetAttribute(srcdocAttr); | 1032 String srcdoc = frame_->DeprecatedLocalOwner()->FastGetAttribute(srcdocAttr); |
1033 DCHECK(!srcdoc.IsNull()); | 1033 DCHECK(!srcdoc.IsNull()); |
1034 CString encoded_srcdoc = srcdoc.Utf8(); | 1034 CString encoded_srcdoc = srcdoc.Utf8(); |
1035 return SubstituteData( | 1035 return SubstituteData( |
1036 SharedBuffer::Create(encoded_srcdoc.data(), encoded_srcdoc.length()), | 1036 SharedBuffer::Create(encoded_srcdoc.data(), encoded_srcdoc.length()), |
1037 "text/html", "UTF-8", KURL()); | 1037 "text/html", "UTF-8", KURL()); |
1038 } | 1038 } |
1039 | 1039 |
1040 void FrameLoader::ReportLocalLoadFailed(LocalFrame* frame, const String& url) { | |
1041 DCHECK(!url.IsEmpty()); | |
1042 if (!frame) | |
1043 return; | |
1044 | |
1045 frame->GetDocument()->AddConsoleMessage( | |
1046 ConsoleMessage::Create(kSecurityMessageSource, kErrorMessageLevel, | |
1047 "Not allowed to load local resource: " + url)); | |
1048 } | |
1049 | |
1050 void FrameLoader::StopAllLoaders() { | 1040 void FrameLoader::StopAllLoaders() { |
1051 if (frame_->GetDocument()->PageDismissalEventBeingDispatched() != | 1041 if (frame_->GetDocument()->PageDismissalEventBeingDispatched() != |
1052 Document::kNoDismissal) | 1042 Document::kNoDismissal) |
1053 return; | 1043 return; |
1054 | 1044 |
1055 // If this method is called from within this method, infinite recursion can | 1045 // If this method is called from within this method, infinite recursion can |
1056 // occur (3442218). Avoid this. | 1046 // occur (3442218). Avoid this. |
1057 if (in_stop_all_loaders_) | 1047 if (in_stop_all_loaders_) |
1058 return; | 1048 return; |
1059 | 1049 |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1834 // TODO(japhet): This is needed because the browser process DCHECKs if the | 1824 // TODO(japhet): This is needed because the browser process DCHECKs if the |
1835 // first entry we commit in a new frame has replacement set. It's unclear | 1825 // first entry we commit in a new frame has replacement set. It's unclear |
1836 // whether the DCHECK is right, investigate removing this special case. | 1826 // whether the DCHECK is right, investigate removing this special case. |
1837 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem && | 1827 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem && |
1838 (!Opener() || !request.Url().IsEmpty()); | 1828 (!Opener() || !request.Url().IsEmpty()); |
1839 loader->SetReplacesCurrentHistoryItem(replace_current_item); | 1829 loader->SetReplacesCurrentHistoryItem(replace_current_item); |
1840 return loader; | 1830 return loader; |
1841 } | 1831 } |
1842 | 1832 |
1843 } // namespace blink | 1833 } // namespace blink |
OLD | NEW |