Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp

Issue 14264012: Create errors (especially cancellation errors) internally to WebCore, rather (Closed) Base URL: svn://svn.chromium.org/blink/trunk/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2011 Apple 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 are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * 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 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 void FrameLoaderClientImpl::dispatchDidFailProvisionalLoad( 751 void FrameLoaderClientImpl::dispatchDidFailProvisionalLoad(
752 const ResourceError& error) 752 const ResourceError& error)
753 { 753 {
754 754
755 // If a policy change occured, then we do not want to inform the plugin 755 // If a policy change occured, then we do not want to inform the plugin
756 // delegate. See http://b/907789 for details. FIXME: This means the 756 // delegate. See http://b/907789 for details. FIXME: This means the
757 // plugin won't receive NPP_URLNotify, which seems like it could result in 757 // plugin won't receive NPP_URLNotify, which seems like it could result in
758 // a memory leak in the plugin!! 758 // a memory leak in the plugin!!
759 if (error.domain() == internalErrorDomain 759 if (error.domain() == internalErrorDomain
760 && error.errorCode() == PolicyChangeError) { 760 && error.errorCode() == PolicyChangeError) {
761 m_webFrame->didFail(cancelledError(error.failingURL()), true); 761 m_webFrame->didFail(ResourceError::cancelledError(error.failingURL()), t rue);
762 return; 762 return;
763 } 763 }
764 764
765 OwnPtr<WebPluginLoadObserver> observer = pluginLoadObserver(); 765 OwnPtr<WebPluginLoadObserver> observer = pluginLoadObserver();
766 m_webFrame->didFail(error, true); 766 m_webFrame->didFail(error, true);
767 if (observer) 767 if (observer)
768 observer->didFailLoading(error); 768 observer->didFailLoading(error);
769 } 769 }
770 770
771 void FrameLoaderClientImpl::dispatchDidFailLoad(const ResourceError& error) 771 void FrameLoaderClientImpl::dispatchDidFailLoad(const ResourceError& error)
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 WrappedResourceRequest webreq(request); 925 WrappedResourceRequest webreq(request);
926 m_webFrame->client()->loadURLExternally(m_webFrame, webreq, navi gationPolicy); 926 m_webFrame->client()->loadURLExternally(m_webFrame, webreq, navi gationPolicy);
927 } 927 }
928 policyAction = PolicyIgnore; 928 policyAction = PolicyIgnore;
929 } 929 }
930 } 930 }
931 931
932 (m_webFrame->frame()->loader()->policyChecker()->*function)(policyAction); 932 (m_webFrame->frame()->loader()->policyChecker()->*function)(policyAction);
933 } 933 }
934 934
935 void FrameLoaderClientImpl::dispatchUnableToImplementPolicy(const ResourceError& error)
936 {
937 m_webFrame->client()->unableToImplementPolicyWithError(m_webFrame, error);
938 }
939
940 void FrameLoaderClientImpl::dispatchWillRequestResource(CachedResourceRequest* r equest) 935 void FrameLoaderClientImpl::dispatchWillRequestResource(CachedResourceRequest* r equest)
941 { 936 {
942 if (m_webFrame->client()) { 937 if (m_webFrame->client()) {
943 WebCachedURLRequest urlRequest(request); 938 WebCachedURLRequest urlRequest(request);
944 m_webFrame->client()->willRequestResource(m_webFrame, urlRequest); 939 m_webFrame->client()->willRequestResource(m_webFrame, urlRequest);
945 } 940 }
946 } 941 }
947 942
948 void FrameLoaderClientImpl::dispatchWillSendSubmitEvent(PassRefPtr<FormState> pr pFormState) 943 void FrameLoaderClientImpl::dispatchWillSendSubmitEvent(PassRefPtr<FormState> pr pFormState)
949 { 944 {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 bool preventDefault = false; 1008 bool preventDefault = false;
1014 m_webFrame->client()->didReceiveDocumentData(m_webFrame, data, lengt h, preventDefault); 1009 m_webFrame->client()->didReceiveDocumentData(m_webFrame, data, lengt h, preventDefault);
1015 if (!preventDefault) 1010 if (!preventDefault)
1016 m_webFrame->commitDocumentData(data, length); 1011 m_webFrame->commitDocumentData(data, length);
1017 } 1012 }
1018 } 1013 }
1019 1014
1020 // If we are sending data to MediaDocument, we should stop here 1015 // If we are sending data to MediaDocument, we should stop here
1021 // and cancel the request. 1016 // and cancel the request.
1022 if (m_webFrame->frame()->document()->isMediaDocument()) 1017 if (m_webFrame->frame()->document()->isMediaDocument())
1023 loader->cancelMainResourceLoad(pluginWillHandleLoadError(loader->respons e())); 1018 loader->cancelMainResourceLoad(ResourceError::cancelledError(loader->res ponse().url()));
1024 1019
1025 // The plugin widget could have been created in the m_webFrame->DidReceiveDa ta 1020 // The plugin widget could have been created in the m_webFrame->DidReceiveDa ta
1026 // function. 1021 // function.
1027 if (m_pluginWidget) { 1022 if (m_pluginWidget) {
1028 if (!m_sentInitialResponseToPlugin) { 1023 if (!m_sentInitialResponseToPlugin) {
1029 m_sentInitialResponseToPlugin = true; 1024 m_sentInitialResponseToPlugin = true;
1030 m_pluginWidget->didReceiveResponse( 1025 m_pluginWidget->didReceiveResponse(
1031 m_webFrame->frame()->loader()->activeDocumentLoader()->response( )); 1026 m_webFrame->frame()->loader()->activeDocumentLoader()->response( ));
1032 } 1027 }
1033 1028
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 if (m_webFrame->client()) 1097 if (m_webFrame->client())
1103 m_webFrame->client()->didRunInsecureContent(m_webFrame, WebSecurityOrigi n(origin), insecureURL); 1098 m_webFrame->client()->didRunInsecureContent(m_webFrame, WebSecurityOrigi n(origin), insecureURL);
1104 } 1099 }
1105 1100
1106 void FrameLoaderClientImpl::didDetectXSS(const KURL& insecureURL, bool didBlockE ntirePage) 1101 void FrameLoaderClientImpl::didDetectXSS(const KURL& insecureURL, bool didBlockE ntirePage)
1107 { 1102 {
1108 if (m_webFrame->client()) 1103 if (m_webFrame->client())
1109 m_webFrame->client()->didDetectXSS(m_webFrame, insecureURL, didBlockEnti rePage); 1104 m_webFrame->client()->didDetectXSS(m_webFrame, insecureURL, didBlockEnti rePage);
1110 } 1105 }
1111 1106
1112 ResourceError FrameLoaderClientImpl::cancelledError(const ResourceRequest& reque st)
1113 {
1114 if (!m_webFrame->client())
1115 return ResourceError();
1116
1117 return m_webFrame->client()->cancelledError(
1118 m_webFrame, WrappedResourceRequest(request));
1119 }
1120
1121 ResourceError FrameLoaderClientImpl::cannotShowURLError(const ResourceRequest& r equest)
1122 {
1123 if (!m_webFrame->client())
1124 return ResourceError();
1125
1126 return m_webFrame->client()->cannotHandleRequestError(
1127 m_webFrame, WrappedResourceRequest(request));
1128 }
1129
1130 ResourceError FrameLoaderClientImpl::interruptedForPolicyChangeError( 1107 ResourceError FrameLoaderClientImpl::interruptedForPolicyChangeError(
1131 const ResourceRequest& request) 1108 const ResourceRequest& request)
1132 { 1109 {
1133 return ResourceError(internalErrorDomain, PolicyChangeError, 1110 return ResourceError(internalErrorDomain, PolicyChangeError,
1134 request.url().string(), String()); 1111 request.url().string(), String());
1135 } 1112 }
1136 1113
1137 ResourceError FrameLoaderClientImpl::cannotShowMIMETypeError(const ResourceRespo nse&)
1138 {
1139 // FIXME
1140 return ResourceError();
1141 }
1142
1143 ResourceError FrameLoaderClientImpl::fileDoesNotExistError(const ResourceRespons e&)
1144 {
1145 // FIXME
1146 return ResourceError();
1147 }
1148
1149 ResourceError FrameLoaderClientImpl::pluginWillHandleLoadError(const ResourceRes ponse&)
1150 {
1151 // FIXME
1152 return ResourceError();
1153 }
1154
1155 bool FrameLoaderClientImpl::shouldFallBack(const ResourceError& error)
1156 {
1157 // This method is called when we fail to load the URL for an <object> tag
1158 // that has fallback content (child elements) and is being loaded as a frame .
1159 // The error parameter indicates the reason for the load failure.
1160 // We should let the fallback content load only if this wasn't a cancelled
1161 // request.
1162 // Note: The mac version also has a case for "WebKitErrorPluginWillHandleLoa d"
1163 ResourceError c = cancelledError(ResourceRequest());
1164 return error.errorCode() != c.errorCode() || error.domain() != c.domain();
1165 }
1166
1167 bool FrameLoaderClientImpl::canHandleRequest(const ResourceRequest& request) con st
1168 {
1169 return m_webFrame->client()->canHandleRequest(
1170 m_webFrame, WrappedResourceRequest(request));
1171 }
1172
1173 bool FrameLoaderClientImpl::canShowMIMEType(const String& mimeType) const 1114 bool FrameLoaderClientImpl::canShowMIMEType(const String& mimeType) const
1174 { 1115 {
1175 // This method is called to determine if the media type can be shown 1116 // This method is called to determine if the media type can be shown
1176 // "internally" (i.e. inside the browser) regardless of whether or not the 1117 // "internally" (i.e. inside the browser) regardless of whether or not the
1177 // browser or a plugin is doing the rendering. 1118 // browser or a plugin is doing the rendering.
1178 1119
1179 // mimeType strings are supposed to be ASCII, but if they are not for some 1120 // mimeType strings are supposed to be ASCII, but if they are not for some
1180 // reason, then it just means that the mime type will fail all of these "is 1121 // reason, then it just means that the mime type will fail all of these "is
1181 // supported" checks and go down the path of an unhandled mime type. 1122 // supported" checks and go down the path of an unhandled mime type.
1182 if (WebKit::Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == WebMimeRegistry::IsSupported) 1123 if (WebKit::Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == WebMimeRegistry::IsSupported)
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 m_webFrame->client()->didLoseWebGLContext(m_webFrame, arbRobustnessConte xtLostReason); 1390 m_webFrame->client()->didLoseWebGLContext(m_webFrame, arbRobustnessConte xtLostReason);
1450 } 1391 }
1451 1392
1452 void FrameLoaderClientImpl::dispatchWillInsertBody() 1393 void FrameLoaderClientImpl::dispatchWillInsertBody()
1453 { 1394 {
1454 if (m_webFrame->client()) 1395 if (m_webFrame->client())
1455 m_webFrame->client()->willInsertBody(m_webFrame); 1396 m_webFrame->client()->willInsertBody(m_webFrame);
1456 } 1397 }
1457 1398
1458 } // namespace WebKit 1399 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698