diff options
author | robertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-20 21:18:06 +0000 |
---|---|---|
committer | robertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-20 21:18:06 +0000 |
commit | 0f5826ce9511ce9a26c9c02d40b9841e292fcd22 (patch) | |
tree | 4e58c82007f3d04003ae5b0a0d44117cf48d0804 /chrome_frame | |
parent | b56c13022ebca2d41761fa17d66a3743c2ee5a62 (diff) | |
download | chromium_src-0f5826ce9511ce9a26c9c02d40b9841e292fcd22.zip chromium_src-0f5826ce9511ce9a26c9c02d40b9841e292fcd22.tar.gz chromium_src-0f5826ce9511ce9a26c9c02d40b9841e292fcd22.tar.bz2 |
Have Chrome Frame ignore NavigationStateChanged events for provisional navigations. These would not be added to the IE travel log but previously would have caused ChromeActiveDocument's navigation_info_ member to be updated. This would cause incorrect entries to be added to the travel log when the notification for the committed navigation came in.
Importantly, first-navigation events look a whole lot like provisional navigations from where CF is sitting (navigation index is also 0). Make sure not to filter those out.
BUG=9682
TEST=chrome_frame_tests.exe
Review URL: https://chromiumcodereview.appspot.com/12767011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189405 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/chrome_active_document.cc | 36 | ||||
-rw-r--r-- | chrome_frame/chrome_active_document.h | 4 |
2 files changed, 35 insertions, 5 deletions
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc index 7ee0026..699e653 100644 --- a/chrome_frame/chrome_active_document.cc +++ b/chrome_frame/chrome_active_document.cc @@ -35,6 +35,7 @@ #include "chrome_frame/crash_reporting/crash_metrics.h" #include "chrome_frame/utils.h" #include "content/public/browser/invalidate_type.h" +#include "content/public/browser/navigation_type.h" #include "content/public/browser/web_contents.h" #include "content/public/common/page_zoom.h" #include "grit/generated_resources.h" @@ -830,11 +831,29 @@ void ChromeActiveDocument::UpdateNavigationState( title.AsInput(), NULL); } - // It is important that we only update the navigation_info_ after we have - // finalized the travel log. This is because IE will ask for information - // such as navigation index when the travel log is finalized and we need - // supply the old index and not the new one. - *navigation_info_ = new_navigation_info; + // There are cases in which we receive NavigationStateChanged events for + // provisional loads. These events will contain a new URL but will not be + // considered new navigations since their navigation_index is 0. For these + // events, do not update the navigation_info_ state, as this will muck up the + // travel log when the subsequent committed navigation event takes place. + // + // Given this filtering, also special-case first navigations since those + // are needed to initially populate navigation_info_ to keep it in sync with + // what was placed in the IE travel log when CF was first opened. + // + // Lastly, allow through navigation events that would neither affect the + // travel log nor cause the page location to change, as these will + // contain informational state (referrer, title, etc.) that we should + // preserve. + if (is_internal_navigation || IsFirstNavigation(new_navigation_info) || + new_navigation_info.url == navigation_info_->url) { + // It is important that we only update the navigation_info_ after we have + // finalized the travel log. This is because IE will ask for information + // such as navigation index when the travel log is finalized and we need + // supply the old index and not the new one. + *navigation_info_ = new_navigation_info; + } + // Update the IE zone here. Ideally we would like to do it when the active // document is activated. However that does not work at times as the frame we // get there is not the actual frame which handles the command. @@ -1412,3 +1431,10 @@ bool ChromeActiveDocument::IsNewNavigation( return false; } + +bool ChromeActiveDocument::IsFirstNavigation( + const NavigationInfo& new_navigation_info) const { + return (navigation_info_->url.is_empty() && + new_navigation_info.navigation_type == + content::NAVIGATION_TYPE_NEW_PAGE); +} diff --git a/chrome_frame/chrome_active_document.h b/chrome_frame/chrome_active_document.h index b9dc092..3afcd0f 100644 --- a/chrome_frame/chrome_active_document.h +++ b/chrome_frame/chrome_active_document.h @@ -439,6 +439,10 @@ END_EXEC_COMMAND_MAP() bool IsNewNavigation(const NavigationInfo& new_navigation_info, int flags) const; + // Returns true if the NavigationInfo object passed in represents a first + // page navigation initiated as this active document was being created. + bool IsFirstNavigation(const NavigationInfo& new_navigation_info) const; + protected: typedef std::map<int, OLECMDF> CommandStatusMap; |