summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-03 04:33:36 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-03 04:33:36 +0000
commit7368a28a5df12544102228a15d3d5046dfc26bd8 (patch)
tree81024af86e129d6ee12568956351307e2f4ea93c /content
parent523508cebbed52ab8645694d3889547cb13b3e7e (diff)
downloadchromium_src-7368a28a5df12544102228a15d3d5046dfc26bd8.zip
chromium_src-7368a28a5df12544102228a15d3d5046dfc26bd8.tar.gz
chromium_src-7368a28a5df12544102228a15d3d5046dfc26bd8.tar.bz2
The CrossSiteResourceHandler's OnReadCompleted method should not
be called prematurely. Add a CHECK to enforce that expectation. Also, remove the defer parameter out of StartCrossSiteTransition to cleanup the code. R=jam@chromium.org Review URL: https://chromiumcodereview.appspot.com/10692064 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145255 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/renderer_host/cross_site_resource_handler.cc30
-rw-r--r--content/browser/renderer_host/cross_site_resource_handler.h3
2 files changed, 10 insertions, 23 deletions
diff --git a/content/browser/renderer_host/cross_site_resource_handler.cc b/content/browser/renderer_host/cross_site_resource_handler.cc
index 7cb33b9..7e59413 100644
--- a/content/browser/renderer_host/cross_site_resource_handler.cc
+++ b/content/browser/renderer_host/cross_site_resource_handler.cc
@@ -97,19 +97,19 @@ bool CrossSiteResourceHandler::OnResponseStarted(
return next_handler_->OnResponseStarted(request_id, response, defer);
}
- // Tell the renderer to run the onunload event handler, and wait for the
- // reply.
- StartCrossSiteTransition(request_id, response, defer);
+ // Tell the renderer to run the onunload event handler.
+ StartCrossSiteTransition(request_id, response);
+
+ // Defer loading until after the onunload event handler has run.
+ did_defer_ = *defer = true;
return true;
}
bool CrossSiteResourceHandler::OnReadCompleted(int request_id,
int bytes_read,
bool* defer) {
- if (!in_cross_site_transition_) {
- return next_handler_->OnReadCompleted(request_id, bytes_read, defer);
- }
- return true;
+ CHECK(!in_cross_site_transition_);
+ return next_handler_->OnReadCompleted(request_id, bytes_read, defer);
}
bool CrossSiteResourceHandler::OnResponseCompleted(
@@ -129,9 +129,7 @@ bool CrossSiteResourceHandler::OnResponseCompleted(
// so that the error message (e.g., 404) can be displayed to the user.
// Also continue with the logic below to remember that we completed
// during the cross-site transition.
- bool defer = false;
- StartCrossSiteTransition(request_id, NULL, &defer);
- DCHECK(!defer); // Since !has_started_response_.
+ StartCrossSiteTransition(request_id, NULL);
}
// We have to buffer the call until after the transition completes.
@@ -183,8 +181,7 @@ void CrossSiteResourceHandler::ResumeResponse() {
// telling the old RenderViewHost to run its onunload handler.
void CrossSiteResourceHandler::StartCrossSiteTransition(
int request_id,
- ResourceResponse* response,
- bool* defer) {
+ ResourceResponse* response) {
in_cross_site_transition_ = true;
request_id_ = request_id;
response_ = response;
@@ -195,15 +192,6 @@ void CrossSiteResourceHandler::StartCrossSiteTransition(
ResourceRequestInfoImpl::ForRequest(request_);
info->set_cross_site_handler(this);
- if (has_started_response_) {
- // Defer the request until the old renderer is finished and the new
- // renderer is ready.
- did_defer_ = *defer = true;
- }
- // If our OnResponseStarted wasn't called, then we're being called by
- // OnResponseCompleted after a failure. We don't need to pause, because
- // there will be no reads.
-
// Tell the contents responsible for this request that a cross-site response
// is starting, so that it can tell its old renderer to run its onunload
// handler now. We will wait to hear the corresponding ClosePage_ACK.
diff --git a/content/browser/renderer_host/cross_site_resource_handler.h b/content/browser/renderer_host/cross_site_resource_handler.h
index 10e8256..33c4eb4 100644
--- a/content/browser/renderer_host/cross_site_resource_handler.h
+++ b/content/browser/renderer_host/cross_site_resource_handler.h
@@ -52,8 +52,7 @@ class CrossSiteResourceHandler : public LayeredResourceHandler {
// telling the old RenderViewHost to run its onunload handler.
void StartCrossSiteTransition(
int request_id,
- ResourceResponse* response,
- bool* defer);
+ ResourceResponse* response);
void ResumeIfDeferred();