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

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

Issue 14495011: Revert "Create errors (especially cancellation errors) internally to WebCore, rather" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 void FrameLoaderClientImpl::dispatchDidFailProvisionalLoad( 736 void FrameLoaderClientImpl::dispatchDidFailProvisionalLoad(
737 const ResourceError& error) 737 const ResourceError& error)
738 { 738 {
739 739
740 // If a policy change occured, then we do not want to inform the plugin 740 // If a policy change occured, then we do not want to inform the plugin
741 // delegate. See http://b/907789 for details. FIXME: This means the 741 // delegate. See http://b/907789 for details. FIXME: This means the
742 // plugin won't receive NPP_URLNotify, which seems like it could result in 742 // plugin won't receive NPP_URLNotify, which seems like it could result in
743 // a memory leak in the plugin!! 743 // a memory leak in the plugin!!
744 if (error.domain() == internalErrorDomain 744 if (error.domain() == internalErrorDomain
745 && error.errorCode() == PolicyChangeError) { 745 && error.errorCode() == PolicyChangeError) {
746 m_webFrame->didFail(ResourceError::cancelledError(error.failingURL()), t rue); 746 m_webFrame->didFail(cancelledError(error.failingURL()), true);
747 return; 747 return;
748 } 748 }
749 749
750 OwnPtr<WebPluginLoadObserver> observer = pluginLoadObserver(); 750 OwnPtr<WebPluginLoadObserver> observer = pluginLoadObserver();
751 m_webFrame->didFail(error, true); 751 m_webFrame->didFail(error, true);
752 if (observer) 752 if (observer)
753 observer->didFailLoading(error); 753 observer->didFailLoading(error);
754 } 754 }
755 755
756 void FrameLoaderClientImpl::dispatchDidFailLoad(const ResourceError& error) 756 void FrameLoaderClientImpl::dispatchDidFailLoad(const ResourceError& error)
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 return PolicyDownload; 886 return PolicyDownload;
887 else if (navigationPolicy != WebNavigationPolicyIgnore) { 887 else if (navigationPolicy != WebNavigationPolicyIgnore) {
888 WrappedResourceRequest webreq(request); 888 WrappedResourceRequest webreq(request);
889 m_webFrame->client()->loadURLExternally(m_webFrame, webreq, navi gationPolicy); 889 m_webFrame->client()->loadURLExternally(m_webFrame, webreq, navi gationPolicy);
890 } 890 }
891 } 891 }
892 892
893 return PolicyIgnore; 893 return PolicyIgnore;
894 } 894 }
895 895
896 void FrameLoaderClientImpl::dispatchUnableToImplementPolicy(const ResourceError& error)
897 {
898 m_webFrame->client()->unableToImplementPolicyWithError(m_webFrame, error);
899 }
900
896 void FrameLoaderClientImpl::dispatchWillRequestResource(CachedResourceRequest* r equest) 901 void FrameLoaderClientImpl::dispatchWillRequestResource(CachedResourceRequest* r equest)
897 { 902 {
898 if (m_webFrame->client()) { 903 if (m_webFrame->client()) {
899 WebCachedURLRequest urlRequest(request); 904 WebCachedURLRequest urlRequest(request);
900 m_webFrame->client()->willRequestResource(m_webFrame, urlRequest); 905 m_webFrame->client()->willRequestResource(m_webFrame, urlRequest);
901 } 906 }
902 } 907 }
903 908
904 void FrameLoaderClientImpl::dispatchWillSendSubmitEvent(PassRefPtr<FormState> pr pFormState) 909 void FrameLoaderClientImpl::dispatchWillSendSubmitEvent(PassRefPtr<FormState> pr pFormState)
905 { 910 {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 bool preventDefault = false; 974 bool preventDefault = false;
970 m_webFrame->client()->didReceiveDocumentData(m_webFrame, data, lengt h, preventDefault); 975 m_webFrame->client()->didReceiveDocumentData(m_webFrame, data, lengt h, preventDefault);
971 if (!preventDefault) 976 if (!preventDefault)
972 m_webFrame->commitDocumentData(data, length); 977 m_webFrame->commitDocumentData(data, length);
973 } 978 }
974 } 979 }
975 980
976 // If we are sending data to MediaDocument, we should stop here 981 // If we are sending data to MediaDocument, we should stop here
977 // and cancel the request. 982 // and cancel the request.
978 if (m_webFrame->frame()->document()->isMediaDocument()) 983 if (m_webFrame->frame()->document()->isMediaDocument())
979 loader->cancelMainResourceLoad(ResourceError::cancelledError(loader->res ponse().url())); 984 loader->cancelMainResourceLoad(pluginWillHandleLoadError(loader->respons e()));
980 985
981 // The plugin widget could have been created in the m_webFrame->DidReceiveDa ta 986 // The plugin widget could have been created in the m_webFrame->DidReceiveDa ta
982 // function. 987 // function.
983 if (m_pluginWidget) { 988 if (m_pluginWidget) {
984 if (!m_sentInitialResponseToPlugin) { 989 if (!m_sentInitialResponseToPlugin) {
985 m_sentInitialResponseToPlugin = true; 990 m_sentInitialResponseToPlugin = true;
986 m_pluginWidget->didReceiveResponse( 991 m_pluginWidget->didReceiveResponse(
987 m_webFrame->frame()->loader()->activeDocumentLoader()->response( )); 992 m_webFrame->frame()->loader()->activeDocumentLoader()->response( ));
988 } 993 }
989 994
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 if (m_webFrame->client()) 1063 if (m_webFrame->client())
1059 m_webFrame->client()->didRunInsecureContent(m_webFrame, WebSecurityOrigi n(origin), insecureURL); 1064 m_webFrame->client()->didRunInsecureContent(m_webFrame, WebSecurityOrigi n(origin), insecureURL);
1060 } 1065 }
1061 1066
1062 void FrameLoaderClientImpl::didDetectXSS(const KURL& insecureURL, bool didBlockE ntirePage) 1067 void FrameLoaderClientImpl::didDetectXSS(const KURL& insecureURL, bool didBlockE ntirePage)
1063 { 1068 {
1064 if (m_webFrame->client()) 1069 if (m_webFrame->client())
1065 m_webFrame->client()->didDetectXSS(m_webFrame, insecureURL, didBlockEnti rePage); 1070 m_webFrame->client()->didDetectXSS(m_webFrame, insecureURL, didBlockEnti rePage);
1066 } 1071 }
1067 1072
1073 ResourceError FrameLoaderClientImpl::cancelledError(const ResourceRequest& reque st)
1074 {
1075 if (!m_webFrame->client())
1076 return ResourceError();
1077
1078 return m_webFrame->client()->cancelledError(
1079 m_webFrame, WrappedResourceRequest(request));
1080 }
1081
1082 ResourceError FrameLoaderClientImpl::cannotShowURLError(const ResourceRequest& r equest)
1083 {
1084 if (!m_webFrame->client())
1085 return ResourceError();
1086
1087 return m_webFrame->client()->cannotHandleRequestError(
1088 m_webFrame, WrappedResourceRequest(request));
1089 }
1090
1068 ResourceError FrameLoaderClientImpl::interruptedForPolicyChangeError( 1091 ResourceError FrameLoaderClientImpl::interruptedForPolicyChangeError(
1069 const ResourceRequest& request) 1092 const ResourceRequest& request)
1070 { 1093 {
1071 return ResourceError(internalErrorDomain, PolicyChangeError, 1094 return ResourceError(internalErrorDomain, PolicyChangeError,
1072 request.url().string(), String()); 1095 request.url().string(), String());
1073 } 1096 }
1074 1097
1098 ResourceError FrameLoaderClientImpl::cannotShowMIMETypeError(const ResourceRespo nse&)
1099 {
1100 // FIXME
1101 return ResourceError();
1102 }
1103
1104 ResourceError FrameLoaderClientImpl::fileDoesNotExistError(const ResourceRespons e&)
1105 {
1106 // FIXME
1107 return ResourceError();
1108 }
1109
1110 ResourceError FrameLoaderClientImpl::pluginWillHandleLoadError(const ResourceRes ponse&)
1111 {
1112 // FIXME
1113 return ResourceError();
1114 }
1115
1116 bool FrameLoaderClientImpl::shouldFallBack(const ResourceError& error)
1117 {
1118 // This method is called when we fail to load the URL for an <object> tag
1119 // that has fallback content (child elements) and is being loaded as a frame .
1120 // The error parameter indicates the reason for the load failure.
1121 // We should let the fallback content load only if this wasn't a cancelled
1122 // request.
1123 // Note: The mac version also has a case for "WebKitErrorPluginWillHandleLoa d"
1124 ResourceError c = cancelledError(ResourceRequest());
1125 return error.errorCode() != c.errorCode() || error.domain() != c.domain();
1126 }
1127
1128 bool FrameLoaderClientImpl::canHandleRequest(const ResourceRequest& request) con st
1129 {
1130 return m_webFrame->client()->canHandleRequest(
1131 m_webFrame, WrappedResourceRequest(request));
1132 }
1133
1075 bool FrameLoaderClientImpl::canShowMIMEType(const String& mimeType) const 1134 bool FrameLoaderClientImpl::canShowMIMEType(const String& mimeType) const
1076 { 1135 {
1077 // This method is called to determine if the media type can be shown 1136 // This method is called to determine if the media type can be shown
1078 // "internally" (i.e. inside the browser) regardless of whether or not the 1137 // "internally" (i.e. inside the browser) regardless of whether or not the
1079 // browser or a plugin is doing the rendering. 1138 // browser or a plugin is doing the rendering.
1080 1139
1081 // mimeType strings are supposed to be ASCII, but if they are not for some 1140 // mimeType strings are supposed to be ASCII, but if they are not for some
1082 // reason, then it just means that the mime type will fail all of these "is 1141 // reason, then it just means that the mime type will fail all of these "is
1083 // supported" checks and go down the path of an unhandled mime type. 1142 // supported" checks and go down the path of an unhandled mime type.
1084 if (WebKit::Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == WebMimeRegistry::IsSupported) 1143 if (WebKit::Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == WebMimeRegistry::IsSupported)
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 m_webFrame->client()->didLoseWebGLContext(m_webFrame, arbRobustnessConte xtLostReason); 1410 m_webFrame->client()->didLoseWebGLContext(m_webFrame, arbRobustnessConte xtLostReason);
1352 } 1411 }
1353 1412
1354 void FrameLoaderClientImpl::dispatchWillInsertBody() 1413 void FrameLoaderClientImpl::dispatchWillInsertBody()
1355 { 1414 {
1356 if (m_webFrame->client()) 1415 if (m_webFrame->client())
1357 m_webFrame->client()->willInsertBody(m_webFrame); 1416 m_webFrame->client()->willInsertBody(m_webFrame);
1358 } 1417 }
1359 1418
1360 } // namespace WebKit 1419 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/src/FrameLoaderClientImpl.h ('k') | Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698