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

Unified Diff: chrome/browser/extensions/api/web_navigation/web_navigation_api.cc

Issue 10834125: When committing a provisional load that didn't change the RVH, still abort pending navigations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch for landing Created 8 years, 5 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 | « chrome/browser/extensions/api/web_navigation/web_navigation_api.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
index 998d971833ae4398cb8090aae1ba9f2c8ee57e03..2e0b3c628a37ee585eb2561fe61c5c4d76396df6 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
@@ -317,7 +317,8 @@ void WebNavigationTabObserver::Observe(
pending_render_view_host_ = NULL;
else
return;
- SendErrorEvents(web_contents(), render_view_host);
+ SendErrorEvents(
+ web_contents(), render_view_host, FrameNavigationState::FrameID());
break;
}
@@ -331,8 +332,11 @@ void WebNavigationTabObserver::AboutToNavigateRenderView(
if (!render_view_host_) {
render_view_host_ = render_view_host;
} else if (render_view_host != render_view_host_) {
- if (pending_render_view_host_)
- SendErrorEvents(web_contents(), pending_render_view_host_);
+ if (pending_render_view_host_) {
+ SendErrorEvents(web_contents(),
+ pending_render_view_host_,
+ FrameNavigationState::FrameID());
+ }
pending_render_view_host_ = render_view_host;
}
}
@@ -372,12 +376,15 @@ void WebNavigationTabObserver::DidCommitProvisionalLoadForFrame(
if (render_view_host != render_view_host_ &&
render_view_host != pending_render_view_host_)
return;
- if (render_view_host != render_view_host_)
- SendErrorEvents(web_contents(), render_view_host_);
+ FrameNavigationState::FrameID frame_id(frame_num, render_view_host);
+ FrameNavigationState::FrameID id_to_skip;
+ if (render_view_host == render_view_host_)
+ id_to_skip = frame_id;
+ if (is_main_frame)
+ SendErrorEvents(web_contents(), render_view_host_, id_to_skip);
render_view_host_ = render_view_host;
pending_render_view_host_ = NULL;
- FrameNavigationState::FrameID frame_id(frame_num, render_view_host);
if (!navigation_state_.CanSendEvents(frame_id))
return;
@@ -449,8 +456,10 @@ void WebNavigationTabObserver::DidFailProvisionalLoad(
web_contents(), render_view_host->GetProcess()->GetID(), validated_url,
frame_num, is_main_frame, error_code);
}
- if (stop_tracking_frames)
- navigation_state_.StopTrackingFramesInRVH(render_view_host);
+ if (stop_tracking_frames) {
+ navigation_state_.StopTrackingFramesInRVH(render_view_host,
+ FrameNavigationState::FrameID());
+ }
}
void WebNavigationTabObserver::DocumentLoadedInFrame(
@@ -537,28 +546,31 @@ void WebNavigationTabObserver::DidOpenRequestedURL(
void WebNavigationTabObserver::WebContentsDestroyed(content::WebContents* tab) {
g_tab_observer.Get().erase(tab);
registrar_.RemoveAll();
- SendErrorEvents(tab, NULL);
+ SendErrorEvents(tab, NULL, FrameNavigationState::FrameID());
}
void WebNavigationTabObserver::SendErrorEvents(
content::WebContents* web_contents,
- content::RenderViewHost* render_view_host) {
+ content::RenderViewHost* render_view_host,
+ FrameNavigationState::FrameID id_to_skip) {
for (FrameNavigationState::const_iterator frame = navigation_state_.begin();
frame != navigation_state_.end(); ++frame) {
if (!navigation_state_.GetNavigationCompleted(*frame) &&
navigation_state_.CanSendEvents(*frame) &&
+ *frame != id_to_skip &&
(!render_view_host || frame->render_view_host == render_view_host)) {
+ navigation_state_.SetErrorOccurredInFrame(*frame);
helpers::DispatchOnErrorOccurred(
- web_contents,
- frame->render_view_host->GetProcess()->GetID(),
- navigation_state_.GetUrl(*frame),
- frame->frame_num,
- navigation_state_.IsMainFrame(*frame),
- net::ERR_ABORTED);
+ web_contents,
+ frame->render_view_host->GetProcess()->GetID(),
+ navigation_state_.GetUrl(*frame),
+ frame->frame_num,
+ navigation_state_.IsMainFrame(*frame),
+ net::ERR_ABORTED);
}
}
if (render_view_host)
- navigation_state_.StopTrackingFramesInRVH(render_view_host);
+ navigation_state_.StopTrackingFramesInRVH(render_view_host, id_to_skip);
}
// See also NavigationController::IsURLInPageNavigation.
« no previous file with comments | « chrome/browser/extensions/api/web_navigation/web_navigation_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698