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

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

Issue 10823169: Another attempt at fixing dead frames being tracked by webNavigation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch for landing Created 8 years, 4 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
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 2e0b3c628a37ee585eb2561fe61c5c4d76396df6..2425e126d3acfe6083620a2b9e2c8a92fa5d75dc 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
@@ -377,26 +377,38 @@ void WebNavigationTabObserver::DidCommitProvisionalLoadForFrame(
render_view_host != pending_render_view_host_)
return;
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;
-
- if (!navigation_state_.CanSendEvents(frame_id))
- return;
bool is_reference_fragment_navigation =
IsReferenceFragmentNavigation(frame_id, url);
- bool is_history_navigation =
+ bool is_history_state_modification =
navigation_state_.GetNavigationCommitted(frame_id);
+ if (is_main_frame && render_view_host_ == render_view_host) {
+ // Changing the reference fragment or the history state using
+ // history.pushState or history.replaceState does not cancel on-going
+ // iframe navigations.
+ if (!is_reference_fragment_navigation && !is_history_state_modification)
+ SendErrorEvents(web_contents(), render_view_host_, frame_id);
+ if (pending_render_view_host_) {
+ SendErrorEvents(web_contents(),
+ pending_render_view_host_,
+ FrameNavigationState::FrameID());
+ pending_render_view_host_ = NULL;
+ }
+ } else if (pending_render_view_host_ == render_view_host) {
+ SendErrorEvents(
+ web_contents(), render_view_host_, FrameNavigationState::FrameID());
+ render_view_host_ = pending_render_view_host_;
+ pending_render_view_host_ = NULL;
+ }
+
// Update the URL as it might have changed.
navigation_state_.UpdateFrame(frame_id, url);
navigation_state_.SetNavigationCommitted(frame_id);
+ if (!navigation_state_.CanSendEvents(frame_id))
+ return;
+
if (is_reference_fragment_navigation) {
helpers::DispatchOnCommitted(
keys::kOnReferenceFragmentUpdated,
@@ -406,10 +418,7 @@ void WebNavigationTabObserver::DidCommitProvisionalLoadForFrame(
url,
transition_type);
navigation_state_.SetNavigationCompleted(frame_id);
- } else if (is_history_navigation) {
- // Make the transition type match the one for reference fragment updates.
- transition_type = static_cast<content::PageTransition>(
- transition_type | content::PAGE_TRANSITION_CLIENT_REDIRECT);
+ } else if (is_history_state_modification) {
helpers::DispatchOnCommitted(
keys::kOnHistoryStateUpdated,
web_contents(),

Powered by Google App Engine
This is Rietveld 408576698