Skip to content

Commit

Permalink
In ChromeFrame in full tab mode at times the address bar would displa…
Browse files Browse the repository at this point in the history
…y the old URL.

This would typically occur during redirects or performing back forward operations
when the current and the target URLs were both rendered in ChromeFrame.

A scenario where this would occur is as below:-
1. Navigation to a URL in chrome frame.
2. Clicking on a link which would navigate the current tab to a chrome frame URL.
3. Now hitting back in IE would navigate back. however the address bar would still
   display the URL in step 2.

The reason this occurs is step 2 causes a top level navigation in IE via webbrowser::Navigate.
This initiates a navigation sequence which updates the address bar to the URL in step 2.
Eventually we receive navigation updates from chrome where the navigation index is changed due
to a new navigation from step 1 to 2. We end up firing internal navigation events which cause
the IE history to get messed up leading to the problem.

Fix is to only fire internal navigation events if the following are true.
1. navigation indexes are different.
2. urls are different.
3. referrer differs.
4. navigation type is different.

Fixes bug http://code.google.com/p/chromium/issues/detail?id=57207

Bug=57207
Test=Will send out a test in a separate CL. Need to brush up on using accessibility for
     link clicks, etc.

Review URL: http://codereview.chromium.org/3988004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63414 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
ananta@chromium.org committed Oct 21, 2010
1 parent b5e0b76 commit 342de55
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
35 changes: 32 additions & 3 deletions chrome_frame/chrome_active_document.cc
Original file line number Diff line number Diff line change
Expand Up @@ -735,9 +735,9 @@ void ChromeActiveDocument::UpdateNavigationState(
ChromeFrameUrl cf_url;
bool is_attach_external_tab_url = cf_url.Parse(std::wstring(url_)) &&
cf_url.attach_to_external_tab();
bool is_internal_navigation = ((new_navigation_info.navigation_index > 0) &&
(new_navigation_info.navigation_index !=
navigation_info_.navigation_index)) || is_attach_external_tab_url;

bool is_internal_navigation =
IsNewNavigation(new_navigation_info) || is_attach_external_tab_url;

if (new_navigation_info.url.is_valid())
url_.Allocate(UTF8ToWide(new_navigation_info.url.spec()).c_str());
Expand Down Expand Up @@ -1306,3 +1306,32 @@ void ChromeActiveDocument::SetWindowDimensions() {
dimensions_.set_width(0);
}
}

bool ChromeActiveDocument::IsNewNavigation(
const IPC::NavigationInfo& new_navigation_info) const {
// A new navigation is typically an internal navigation which is initiated by
// the renderer(WebKit). Condition 1 below has to be true along with the
// any of the other conditions below.
// 1. The navigation index is greater than 0 which means that a top level
// navigation was initiated on the current external tab.
// 2. The navigation type has changed.
// 3. The url or the referrer are different.
if (new_navigation_info.navigation_index <= 0)
return false;

if (new_navigation_info.navigation_index ==
navigation_info_.navigation_index)
return false;

if (new_navigation_info.navigation_type != navigation_info_.navigation_type)
return true;

if (new_navigation_info.url != navigation_info_.url)
return true;

if (new_navigation_info.referrer != navigation_info_.referrer)
return true;

return false;
}

4 changes: 4 additions & 0 deletions chrome_frame/chrome_active_document.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,10 @@ END_EXEC_COMMAND_MAP()
// the information passed in from Chrome during window.open.
void SetWindowDimensions();

// Returns true if the NavigationInfo object passed in represents a new
// navigation initiated by the renderer.
bool IsNewNavigation(const IPC::NavigationInfo& new_navigation_info) const;

protected:
typedef std::map<int, OLECMDF> CommandStatusMap;

Expand Down

0 comments on commit 342de55

Please sign in to comment.