Index: content/browser/renderer_host/resource_dispatcher_host.cc |
diff --git a/content/browser/renderer_host/resource_dispatcher_host.cc b/content/browser/renderer_host/resource_dispatcher_host.cc |
index a210f8de897aaa3ebe2ecf5aab43b8d48fb63a88..ddc0c9c1a004d98defaa7d8ebec7765d477af627 100644 |
--- a/content/browser/renderer_host/resource_dispatcher_host.cc |
+++ b/content/browser/renderer_host/resource_dispatcher_host.cc |
@@ -32,6 +32,7 @@ |
#include "content/browser/download/save_file_manager.h" |
#include "content/browser/download/save_file_resource_handler.h" |
#include "content/browser/plugin_service_impl.h" |
+#include "content/browser/renderer_host/allow_cancel_resource_handler.h" |
#include "content/browser/renderer_host/async_resource_handler.h" |
#include "content/browser/renderer_host/buffered_resource_handler.h" |
#include "content/browser/renderer_host/cross_site_resource_handler.h" |
@@ -1303,8 +1304,21 @@ void ResourceDispatcherHost::OnReceivedRedirect(net::URLRequest* request, |
PopulateResourceResponse(request, response); |
if (!info->resource_handler()->OnRequestRedirected(info->request_id(), |
new_url, |
- response, defer_redirect)) |
+ response, |
+ defer_redirect)) { |
CancelRequestInternal(request, false); |
+ return; |
+ } |
+ |
+ // If a URLRequest is transferred to a new RenderViewHost, its |
+ // ResourceHandlers should not received any notifications because they may |
Matt Perry
2012/01/05 23:52:44
receive*
battre
2012/01/06 02:18:02
Done.
|
+ // depend on the state of the old RVH. We set a ResourceHandler that allows |
+ // canceling requests, because on shutdown of the RDH all pending requests |
+ // are canceled. The RVH of requests that are being transferred may be gone by |
+ // that time. |
+ GlobalRequestID global_request_id(info->child_id(), info->request_id()); |
+ if (IsTransferredNavigation(global_request_id)) |
+ info->set_resource_handler(new AllowCancelResourceHandler()); |
battre
2012/01/05 22:55:17
We cannot put this code into the TransferNavigatio
Matt Perry
2012/01/05 23:52:44
It's perfectly fine to delete an instance of a cla
battre
2012/01/06 02:18:02
Done. Moved to MarkAsTransferredNavigation as disc
|
} |
void ResourceDispatcherHost::OnAuthRequired( |