summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-22 23:27:27 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-22 23:27:27 +0000
commit4f45d458c94df1f27a8e1091387821a71f0b2a91 (patch)
tree6204e1f4103b824a8a1eb077290ade4303f10b6e
parent5efbfe01100407ead12b18daae9ccafe34eeedc5 (diff)
downloadchromium_src-4f45d458c94df1f27a8e1091387821a71f0b2a91.zip
chromium_src-4f45d458c94df1f27a8e1091387821a71f0b2a91.tar.gz
chromium_src-4f45d458c94df1f27a8e1091387821a71f0b2a91.tar.bz2
If we switch into ChromeFrame as a result of a redirect then we need to navigate chrome to
the correct URL to ensure that scripts on the page see the correct URL. This functionality regressed when the protocol sink patch landed. Fix is to read the URL from the ProtData object which wraps the underlying protocol sink, when our active document loads. Removed stale code from the Chromeframe moniker patch which eventually needs to go. Fixes bug http://code.google.com/p/chromium/issues/detail?can=2&q=71860 BUG=71860 TEST=As described in the bug. Review URL: http://codereview.chromium.org/6469103 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75656 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome_frame/bind_context_info.cc7
-rw-r--r--chrome_frame/bind_context_info.h20
-rw-r--r--chrome_frame/chrome_active_document.cc4
-rw-r--r--chrome_frame/protocol_sink_wrap.h4
-rw-r--r--chrome_frame/urlmon_bind_status_callback.cc13
-rw-r--r--chrome_frame/urlmon_url_request.cc2
6 files changed, 22 insertions, 28 deletions
diff --git a/chrome_frame/bind_context_info.cc b/chrome_frame/bind_context_info.cc
index b1f9565..28cb239 100644
--- a/chrome_frame/bind_context_info.cc
+++ b/chrome_frame/bind_context_info.cc
@@ -79,3 +79,10 @@ void BindContextInfo::SetToSwitch(IStream* cache) {
}
}
+std::wstring BindContextInfo::GetUrl() {
+ if (has_prot_data()) {
+ return prot_data_->url();
+ }
+ return std::wstring();
+}
+
diff --git a/chrome_frame/bind_context_info.h b/chrome_frame/bind_context_info.h
index d6c5d22..e9add10 100644
--- a/chrome_frame/bind_context_info.h
+++ b/chrome_frame/bind_context_info.h
@@ -65,21 +65,6 @@ class __declspec(uuid("00000000-0000-0000-0000-000000000000")) BindContextInfo
return cache_;
}
- // Accept a const wchar_t* to ensure that we don't have a reference
- // to someone else's buffer.
- void set_url(const wchar_t* url) {
- DCHECK(url);
- if (url) {
- url_ = url;
- } else {
- url_.clear();
- }
- }
-
- const std::wstring& url() const {
- return url_;
- }
-
void set_prot_data(ProtData* data) {
prot_data_ = data;
}
@@ -100,6 +85,10 @@ class __declspec(uuid("00000000-0000-0000-0000-000000000000")) BindContextInfo
return protocol_.get();
}
+ // Returns the url being navigated to. We retrieve the url from the ProtData
+ // instance which wraps the underlying protocol sink.
+ std::wstring GetUrl();
+
protected:
STDMETHOD(GetCppObject)(void** me) {
DCHECK(me);
@@ -115,7 +104,6 @@ class __declspec(uuid("00000000-0000-0000-0000-000000000000")) BindContextInfo
bool no_cache_;
bool chrome_request_;
bool is_switching_;
- std::wstring url_;
base::win::ScopedComPtr<IUnknown> ftm_;
scoped_refptr<ProtData> prot_data_;
ScopedComPtr<IInternetProtocol> protocol_;
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc
index f0a2e76..3db9f4c 100644
--- a/chrome_frame/chrome_active_document.cc
+++ b/chrome_frame/chrome_active_document.cc
@@ -248,8 +248,8 @@ STDMETHODIMP ChromeActiveDocument::Load(BOOL fully_avalable,
ScopedComPtr<BindContextInfo> info;
BindContextInfo::FromBindContext(bind_context, info.Receive());
DCHECK(info);
- if (info && !info->url().empty()) {
- url = info->url();
+ if (info && !info->GetUrl().empty()) {
+ url = info->GetUrl();
} else {
// If the original URL contains an anchor, then the URL queried
// from the moniker does not contain the anchor. To workaround
diff --git a/chrome_frame/protocol_sink_wrap.h b/chrome_frame/protocol_sink_wrap.h
index eccd6a5..1aa0e10 100644
--- a/chrome_frame/protocol_sink_wrap.h
+++ b/chrome_frame/protocol_sink_wrap.h
@@ -130,6 +130,10 @@ class ProtData : public base::RefCounted<ProtData> {
// Removes the mapping between the protocol and the ProtData.
void Invalidate();
+ const std::wstring& url() const {
+ return url_;
+ }
+
private:
typedef std::map<IInternetProtocol*, ProtData*> ProtocolDataMap;
static ProtocolDataMap datamap_;
diff --git a/chrome_frame/urlmon_bind_status_callback.cc b/chrome_frame/urlmon_bind_status_callback.cc
index 34520ef..f060155 100644
--- a/chrome_frame/urlmon_bind_status_callback.cc
+++ b/chrome_frame/urlmon_bind_status_callback.cc
@@ -249,15 +249,10 @@ STDMETHODIMP BSCBStorageBind::OnProgress(ULONG progress, ULONG progress_max,
HRESULT hr = S_OK;
- // Remember the last redirected URL in case we get switched into
- // chrome frame
- if (status_code == BINDSTATUS_REDIRECTING) {
- ScopedComPtr<BindContextInfo> info;
- BindContextInfo::FromBindContext(bind_ctx_, info.Receive());
- DCHECK(info);
- if (info)
- info->set_url(status_text);
- }
+ // TODO(ananta)
+ // ChromeFrame will not be informed of any redirects which occur while we
+ // switch into Chrome. This will only break the moniker patch which is
+ // legacy and needs to be deleted.
if (ShouldCacheProgress(status_code)) {
saved_progress_.push_back(new Progress(progress, progress_max, status_code,
diff --git a/chrome_frame/urlmon_url_request.cc b/chrome_frame/urlmon_url_request.cc
index c5c9bd5..c803263 100644
--- a/chrome_frame/urlmon_url_request.cc
+++ b/chrome_frame/urlmon_url_request.cc
@@ -289,7 +289,7 @@ STDMETHODIMP UrlmonUrlRequest::OnProgress(ULONG progress, ULONG max_progress,
ScopedComPtr<BindContextInfo> info;
BindContextInfo::FromBindContext(bind_context_, info.Receive());
DCHECK(info);
- GURL previously_redirected(info ? info->url() : std::wstring());
+ GURL previously_redirected(info ? info->GetUrl() : std::wstring());
if (GURL(status_text) != previously_redirected) {
DVLOG(1) << __FUNCTION__ << me() << "redirect from " << url()
<< " to " << status_text;