summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-07 20:43:01 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-07 20:43:01 +0000
commitf1cd33652aae14cc8c62e82a1e3d1ece60a6e426 (patch)
treeb5038d75ca0fc4a6d63a2f1e4b0d4b1c29649a82
parente66b592fc9776e7ac81fdba5fb6aec5f93857fe9 (diff)
downloadchromium_src-f1cd33652aae14cc8c62e82a1e3d1ece60a6e426.zip
chromium_src-f1cd33652aae14cc8c62e82a1e3d1ece60a6e426.tar.gz
chromium_src-f1cd33652aae14cc8c62e82a1e3d1ece60a6e426.tar.bz2
Remove call of PrerenderTracker::TryCancelOnIOThread in ChromeContentBrowserClient::CanCreateWindow. I moved cancelling the prerender on the UI thread.
BUG=304341 R=jochen@chromium.org, tburkard@chromium.org Review URL: https://codereview.chromium.org/112573008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243375 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chrome_content_browser_client.cc15
-rw-r--r--chrome/browser/prerender/prerender_contents.cc15
-rw-r--r--content/browser/web_contents/web_contents_impl.cc6
-rw-r--r--content/public/browser/web_contents_delegate.h2
4 files changed, 30 insertions, 8 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index bf7e6ff..fd70f09 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -572,6 +572,13 @@ void HandleBlockedPopupOnUIThread(const BlockedWindowParams& params) {
if (!tab)
return;
+ prerender::PrerenderContents* prerender_contents =
+ prerender::PrerenderContents::FromWebContents(tab);
+ if (prerender_contents) {
+ prerender_contents->Destroy(prerender::FINAL_STATUS_CREATE_NEW_WINDOW);
+ return;
+ }
+
PopupBlockerTabHelper* popup_helper =
PopupBlockerTabHelper::FromWebContents(tab);
if (!popup_helper)
@@ -2083,14 +2090,6 @@ bool ChromeContentBrowserClient::CanCreateWindow(
return false;
}
- if (g_browser_process->prerender_tracker() &&
- g_browser_process->prerender_tracker()->TryCancelOnIOThread(
- render_process_id,
- opener_id,
- prerender::FINAL_STATUS_CREATE_NEW_WINDOW)) {
- return false;
- }
-
if (is_guest)
return true;
diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc
index 952e809..b0eb199b 100644
--- a/chrome/browser/prerender/prerender_contents.cc
+++ b/chrome/browser/prerender/prerender_contents.cc
@@ -92,6 +92,21 @@ class PrerenderContents::WebContentsDelegateImpl
callback.Run(false);
}
+ virtual bool ShouldCreateWebContents(
+ WebContents* web_contents,
+ int route_id,
+ WindowContainerType window_container_type,
+ const base::string16& frame_name,
+ const GURL& target_url,
+ const std::string& partition_id,
+ SessionStorageNamespace* session_storage_namespace) OVERRIDE {
+ // Since we don't want to permit child windows that would have a
+ // window.opener property, terminate prerendering.
+ prerender_contents_->Destroy(FINAL_STATUS_CREATE_NEW_WINDOW);
+ // Cancel the popup.
+ return false;
+ }
+
virtual bool OnGoToEntryOffset(int offset) OVERRIDE {
// This isn't allowed because the history merge operation
// does not work if there are renderer issued challenges.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index f3a7a59..3dfd6ed 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1368,6 +1368,12 @@ void WebContentsImpl::CreateNewWindow(
params.target_url,
partition_id,
session_storage_namespace)) {
+ if (route_id != MSG_ROUTING_NONE &&
+ !RenderViewHost::FromID(render_process_id, route_id)) {
+ // If the embedder didn't create a WebContents for this route, we need to
+ // delete the RenderView that had already been created.
+ Send(new ViewMsg_Close(route_id));
+ }
GetRenderViewHost()->GetProcess()->ResumeRequestsForView(route_id);
GetRenderViewHost()->GetProcess()->ResumeRequestsForView(
main_frame_route_id);
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h
index c7a7010..330c699 100644
--- a/content/public/browser/web_contents_delegate.h
+++ b/content/public/browser/web_contents_delegate.h
@@ -294,6 +294,8 @@ class CONTENT_EXPORT WebContentsDelegate {
// Allows delegate to control whether a WebContents will be created. Returns
// true to allow the creation. Default is to allow it. In cases where the
// delegate handles the creation/navigation itself, it will use |target_url|.
+ // The embedder has to synchronously adopt |route_id| or else the view will
+ // be destroyed.
virtual bool ShouldCreateWebContents(
WebContents* web_contents,
int route_id,