Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(528)

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 707223004: Don't report blocked web contents from already navigated render views. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 66ccc01d7f86825f5dd5d75dcd2d1e6eb9ea2b47..6727f575f5a77fec063fcd05e91bfd1400be7399 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -515,9 +515,15 @@ void SetApplicationLocaleOnIOThread(const std::string& locale) {
}
void HandleBlockedPopupOnUIThread(const BlockedWindowParams& params) {
- WebContents* tab = tab_util::GetWebContentsByID(params.render_process_id(),
- params.opener_id());
- if (!tab)
+ // TODO(jochen): This code path should use RenderFrameHosts. See
+ // http://crbug.com/431769 for details.
+ RenderViewHost* render_view_host =
+ RenderViewHost::FromID(params.render_process_id(), params.opener_id());
+ if (!render_view_host)
+ return;
+ WebContents* tab = WebContents::FromRenderViewHost(render_view_host);
+ // The tab might already have navigated away.
+ if (!tab || tab->GetRenderViewHost() != render_view_host)
return;
prerender::PrerenderContents* prerender_contents =
« no previous file with comments | « no previous file | chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698