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

Unified Diff: webkit/plugins/ppapi/ppb_url_loader_impl.cc

Issue 7046091: Fix problems with PPB_URLLoader_Impl and PPAPITests.URLLoader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/tests/test_url_loader.cc ('k') | webkit/plugins/ppapi/ppb_url_request_info_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppb_url_loader_impl.cc
===================================================================
--- webkit/plugins/ppapi/ppb_url_loader_impl.cc (revision 89290)
+++ 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"
@@ -247,7 +249,7 @@
return rv;
if (request->RequiresUniversalAccess() && !has_universal_access_)
- return PP_ERROR_BADARGUMENT;
+ return PP_ERROR_NOACCESS;
if (loader_.get())
return PP_ERROR_INPROGRESS;
@@ -276,13 +278,11 @@
return PP_ERROR_FAILED;
loader_->loadAsynchronously(web_request, this);
- // 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 +475,23 @@
void PPB_URLLoader_Impl::didFail(WebURLLoader* loader,
const WebURLError& error) {
- // TODO(darin): Provide more detailed error information.
- done_status_ = PP_ERROR_FAILED;
+ if (error.domain.equals(WebString::fromUTF8(net::kErrorDomain))) {
+ // TODO(bbudge): Extend pp_errors.h to cover interesting network errors
+ // from the net error domain.
+ switch (error.reason) {
+ case net::ERR_ACCESS_DENIED:
+ case net::ERR_NETWORK_ACCESS_DENIED:
+ done_status_ = PP_ERROR_NOACCESS;
+ break;
+ default:
+ done_status_ = PP_ERROR_FAILED;
+ break;
+ }
+ } else {
+ // It's a WebKit error.
+ done_status_ = PP_ERROR_NOACCESS;
+ }
+
RunCallback(done_status_);
}
« no previous file with comments | « ppapi/tests/test_url_loader.cc ('k') | webkit/plugins/ppapi/ppb_url_request_info_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698