diff options
author | shishir@chromium.org <shishir@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-14 22:23:17 +0000 |
---|---|---|
committer | shishir@chromium.org <shishir@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-14 22:23:17 +0000 |
commit | 4fa199b586950d93a0987f13c01b9d994263a636 (patch) | |
tree | 42781baa82fe560777ae8512db4f0d2e6d0627b7 /content | |
parent | d38cdb80943af572fdccac502fb6defec763a68d (diff) | |
download | chromium_src-4fa199b586950d93a0987f13c01b9d994263a636.zip chromium_src-4fa199b586950d93a0987f13c01b9d994263a636.tar.gz chromium_src-4fa199b586950d93a0987f13c01b9d994263a636.tar.bz2 |
Changes to not use the prerendered contents when window.opener needs to be set.
BUG=79922
TEST=browser_tests
Review URL: http://codereview.chromium.org/6915019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85394 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/tab_contents/tab_contents.cc | 7 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents.h | 2 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents_observer.cc | 4 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents_observer.h | 3 | ||||
-rw-r--r-- | content/common/view_messages.h | 6 | ||||
-rw-r--r-- | content/renderer/render_view.cc | 7 |
6 files changed, 21 insertions, 8 deletions
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index d51e63e..1d23854 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -1015,6 +1015,7 @@ void TabContents::SetContentRestrictions(int restrictions) { void TabContents::OnDidStartProvisionalLoadForFrame(int64 frame_id, bool is_main_frame, + bool has_opener_set, const GURL& url) { bool is_error_page = (url.spec() == chrome::kUnreachableWebDataURL); GURL validated_url(url); @@ -1032,11 +1033,12 @@ void TabContents::OnDidStartProvisionalLoadForFrame(int64 frame_id, if (is_main_frame) { // Notify observers about the provisional change in the main frame URL. FOR_EACH_OBSERVER(TabContentsObserver, observers_, - ProvisionalChangeToMainFrameUrl(url)); + ProvisionalChangeToMainFrameUrl(url, has_opener_set)); } } void TabContents::OnDidRedirectProvisionalLoad(int32 page_id, + bool has_opener_set, const GURL& source_url, const GURL& target_url) { // TODO(creis): Remove this method and have the pre-rendering code listen to @@ -1052,7 +1054,8 @@ void TabContents::OnDidRedirectProvisionalLoad(int32 page_id, // Notify observers about the provisional change in the main frame URL. FOR_EACH_OBSERVER(TabContentsObserver, observers_, - ProvisionalChangeToMainFrameUrl(target_url)); + ProvisionalChangeToMainFrameUrl(target_url, + has_opener_set)); } void TabContents::OnDidFailProvisionalLoadWithError( diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index f38ca63..6f70175 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -603,8 +603,10 @@ class TabContents : public PageNavigator, // Message handlers. void OnDidStartProvisionalLoadForFrame(int64 frame_id, bool main_frame, + bool has_opener_set, const GURL& url); void OnDidRedirectProvisionalLoad(int32 page_id, + bool has_opener_set, const GURL& source_url, const GURL& target_url); void OnDidFailProvisionalLoadWithError(int64 frame_id, diff --git a/content/browser/tab_contents/tab_contents_observer.cc b/content/browser/tab_contents/tab_contents_observer.cc index 3056608..50b2e46 100644 --- a/content/browser/tab_contents/tab_contents_observer.cc +++ b/content/browser/tab_contents/tab_contents_observer.cc @@ -48,7 +48,9 @@ void TabContentsObserver::DidStartProvisionalLoadForFrame( RenderViewHost* render_view_host) { } -void TabContentsObserver::ProvisionalChangeToMainFrameUrl(const GURL& url) { +void TabContentsObserver::ProvisionalChangeToMainFrameUrl( + const GURL& url, + bool has_opener_set) { } void TabContentsObserver::DidCommitProvisionalLoadForFrame( diff --git a/content/browser/tab_contents/tab_contents_observer.h b/content/browser/tab_contents/tab_contents_observer.h index cc73b4f..03760f7 100644 --- a/content/browser/tab_contents/tab_contents_observer.h +++ b/content/browser/tab_contents/tab_contents_observer.h @@ -56,7 +56,8 @@ class TabContentsObserver : public IPC::Channel::Listener, const GURL& validated_url, bool is_error_page, RenderViewHost* render_view_host); - virtual void ProvisionalChangeToMainFrameUrl(const GURL& url); + virtual void ProvisionalChangeToMainFrameUrl(const GURL& url, + bool has_opener_set); virtual void DidCommitProvisionalLoadForFrame( int64 frame_id, bool is_main_frame, diff --git a/content/common/view_messages.h b/content/common/view_messages.h index 10388c0..538f913 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -1390,9 +1390,10 @@ IPC_MESSAGE_ROUTED2(ViewHostMsg_DidRunInsecureContent, GURL /* target URL */) // Sent when the renderer starts a provisional load for a frame. -IPC_MESSAGE_ROUTED3(ViewHostMsg_DidStartProvisionalLoadForFrame, +IPC_MESSAGE_ROUTED4(ViewHostMsg_DidStartProvisionalLoadForFrame, int64 /* frame_id */, bool /* true if it is the main frame */, + bool /* true if the frame has an opener set */, GURL /* url */) // Sent when the renderer fails a provisional load with an error. @@ -1729,8 +1730,9 @@ IPC_MESSAGE_CONTROL1(ViewHostMsg_RevealFolderInOS, FilePath /* path */) // Sent when a provisional load on the main frame redirects. -IPC_MESSAGE_ROUTED3(ViewHostMsg_DidRedirectProvisionalLoad, +IPC_MESSAGE_ROUTED4(ViewHostMsg_DidRedirectProvisionalLoad, int /* page_id */, + bool /* true if the frame has an opener set */, GURL /* last url */, GURL /* url redirected to */) diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc index 0125947..f0e8712 100644 --- a/content/renderer/render_view.cc +++ b/content/renderer/render_view.cc @@ -2279,8 +2279,10 @@ void RenderView::didStartProvisionalLoad(WebFrame* frame) { FOR_EACH_OBSERVER( RenderViewObserver, observers_, DidStartProvisionalLoad(frame)); + bool has_opener_set = opener_id_ != MSG_ROUTING_NONE; Send(new ViewHostMsg_DidStartProvisionalLoadForFrame( - routing_id_, frame->identifier(), is_top_most, ds->request().url())); + routing_id_, frame->identifier(), is_top_most, has_opener_set, + ds->request().url())); } void RenderView::didReceiveServerRedirectForProvisionalLoad(WebFrame* frame) { @@ -2296,8 +2298,9 @@ void RenderView::didReceiveServerRedirectForProvisionalLoad(WebFrame* frame) { std::vector<GURL> redirects; GetRedirectChain(data_source, &redirects); if (redirects.size() >= 2) { + bool has_opener_set = opener_id_ != MSG_ROUTING_NONE; Send(new ViewHostMsg_DidRedirectProvisionalLoad(routing_id_, page_id_, - redirects[redirects.size() - 2], redirects.back())); + has_opener_set, redirects[redirects.size() - 2], redirects.back())); } } |