summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome_frame/chrome_active_document.cc9
-rw-r--r--chrome_frame/urlmon_moniker.cc1
-rw-r--r--chrome_frame/urlmon_moniker.h14
-rw-r--r--chrome_frame/utils.cc18
4 files changed, 39 insertions, 3 deletions
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc
index 4950ae8..a0bcae4 100644
--- a/chrome_frame/chrome_active_document.cc
+++ b/chrome_frame/chrome_active_document.cc
@@ -228,8 +228,13 @@ STDMETHODIMP ChromeActiveDocument::Load(BOOL fully_avalable,
// If the original URL contains an anchor, then the URL queried
// from the moniker does not contain the anchor. To workaround
// this we retrieve the URL from our BHO.
- std::wstring url(GetActualUrlFromMoniker(moniker_name, bind_context,
- mgr ? mgr->url() : std::wstring()));
+ std::wstring url(GetActualUrlFromMoniker(
+ moniker_name, bind_context,
+ mgr ? mgr->original_url_with_fragment() : std::wstring()));
+
+ if (mgr) {
+ mgr->set_original_url_with_fragment(L"");
+ }
scoped_refptr<RequestData> data(mgr->GetActiveRequestData(url.c_str()));
DLOG_IF(INFO, data) << "Got active request data";
diff --git a/chrome_frame/urlmon_moniker.cc b/chrome_frame/urlmon_moniker.cc
index e98420d..dab39e3 100644
--- a/chrome_frame/urlmon_moniker.cc
+++ b/chrome_frame/urlmon_moniker.cc
@@ -332,6 +332,7 @@ HRESULT NavigationManager::NavigateToCurrentUrlInCF(IBrowserService* browser) {
GURL parsed_moniker_url(url_);
if (parsed_moniker_url.has_ref()) {
fragment = UTF8ToWide(parsed_moniker_url.ref());
+ set_original_url_with_fragment(url_.c_str());
}
hr = NavigateBrowserToMoniker(browser, moniker, headers.c_str(),
diff --git a/chrome_frame/urlmon_moniker.h b/chrome_frame/urlmon_moniker.h
index aaab2ee..d4b6bbb 100644
--- a/chrome_frame/urlmon_moniker.h
+++ b/chrome_frame/urlmon_moniker.h
@@ -295,6 +295,15 @@ class NavigationManager {
url_ = url;
}
+ const std::wstring& original_url_with_fragment() const {
+ return original_url_with_fragment_;
+ }
+
+ void set_original_url_with_fragment(const wchar_t* url) {
+ DLOG(INFO) << __FUNCTION__ << " " << url;
+ original_url_with_fragment_ = url;
+ }
+
// Returns the referrer header value of the current top level navigation.
const std::string& referrer() const {
return referrer_;
@@ -356,6 +365,11 @@ class NavigationManager {
static base::LazyInstance<base::ThreadLocalPointer<NavigationManager> >
thread_singleton_;
+ // If the url being navigated to within ChromeFrame has a fragment, this
+ // member contains this URL. This member is cleared when the Chrome active
+ // document is loaded.
+ std::wstring original_url_with_fragment_;
+
private:
DISALLOW_COPY_AND_ASSIGN(NavigationManager);
};
diff --git a/chrome_frame/utils.cc b/chrome_frame/utils.cc
index f58b47d..4e6b843 100644
--- a/chrome_frame/utils.cc
+++ b/chrome_frame/utils.cc
@@ -24,6 +24,7 @@
#include "chrome_frame/html_utils.h"
#include "chrome_frame/utils.h"
#include "googleurl/src/gurl.h"
+#include "googleurl/src/url_canon.h"
#include "grit/chrome_frame_resources.h"
// Note that these values are all lower case and are compared to
@@ -716,7 +717,22 @@ HRESULT NavigateBrowserToMoniker(IUnknown* browser, IMoniker* moniker,
DLOG(INFO) << __FUNCTION__ << " " << url;
ScopedComPtr<IWebBrowserPriv> browser_priv;
if (SUCCEEDED(hr = browser_priv.QueryFrom(web_browser2))) {
- ScopedVariant var_url(url);
+ GURL target_url(url);
+ // On IE6 if the original URL has a fragment then the navigation
+ // attempt is ignored. To workaround this we strip the fragment from
+ // the url and initiate the navigation. When the active document loads
+ // we retrieve the original url with the fragment from the Navigation
+ // manager and use it.
+ if (target_url.has_ref()) {
+ url_parse::Component comp;
+ GURL::Replacements replacements;
+ replacements.SetRef("", comp);
+
+ target_url = target_url.ReplaceComponents(replacements);
+ fragment = NULL;
+ }
+
+ ScopedVariant var_url(UTF8ToWide(target_url.spec()).c_str());
hr = browser_priv->NavigateWithBindCtx(var_url.AsInput(), NULL, NULL,
NULL, headers_var.AsInput(),
bind_ctx,