Chromium Code Reviews| Index: webkit/plugins/ppapi/ppb_url_loader_impl.cc |
| =================================================================== |
| --- webkit/plugins/ppapi/ppb_url_loader_impl.cc (revision 88908) |
| +++ webkit/plugins/ppapi/ppb_url_loader_impl.cc (working copy) |
| @@ -5,6 +5,7 @@ |
| #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" |
| #include "base/logging.h" |
| +#include "net/base/net_errors.h" |
| #include "ppapi/c/pp_completion_callback.h" |
| #include "ppapi/c/pp_errors.h" |
| #include "ppapi/c/ppb_url_loader.h" |
| @@ -16,6 +17,7 @@ |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebKitClient.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoader.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoaderOptions.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" |
| @@ -279,10 +281,11 @@ |
| // Check for immediate failure; The AssociatedURLLoader will call our |
| // didFail method synchronously for certain kinds of access violations |
| // so we must return an error to the caller. |
| - // TODO(bbudge) Modify the underlying AssociatedURLLoader to only call |
| - // back asynchronously. |
| - if (done_status_ == PP_ERROR_FAILED) |
| - return PP_ERROR_NOACCESS; |
| + // TODO(bbudge) Remove this code when AssociatedURLLoader is changed to |
| + // return errors asynchronously. |
| + if (done_status_ == PP_ERROR_FAILED || |
| + done_status_ == PP_ERROR_NOACCESS) |
| + return done_status_; |
| request_info_ = scoped_refptr<PPB_URLRequestInfo_Impl>(request); |
| @@ -475,8 +478,16 @@ |
| void PPB_URLLoader_Impl::didFail(WebURLLoader* loader, |
| const WebURLError& error) { |
| - // TODO(darin): Provide more detailed error information. |
| - done_status_ = PP_ERROR_FAILED; |
| + // By default report PP_ERROR_NOACCESS. This assumes that errors from WebKit |
| + // are access errors. |
| + done_status_ = PP_ERROR_NOACCESS; |
| + // For our 'net' error domain, report all non-access errors as |
|
darin (slow to review)
2011/06/15 23:00:20
nit: these comments just summarize what the code d
bbudge
2011/06/15 23:50:21
Done.
|
| + // PP_ERROR_FAILED. |
| + if (error.domain.equals(WebString::fromUTF8(net::kErrorDomain)) && |
| + error.reason != net::ERR_ACCESS_DENIED && |
| + error.reason != net::ERR_NETWORK_ACCESS_DENIED) |
| + done_status_ = PP_ERROR_FAILED; |
| + |
| RunCallback(done_status_); |
| } |