diff options
-rw-r--r-- | chrome/browser/tab_contents.cc | 5 | ||||
-rw-r--r-- | chrome/browser/tab_contents.h | 5 | ||||
-rw-r--r-- | chrome/browser/web_contents.cc | 7 |
3 files changed, 15 insertions, 2 deletions
diff --git a/chrome/browser/tab_contents.cc b/chrome/browser/tab_contents.cc index 0215ec7..ec3c8af 100644 --- a/chrome/browser/tab_contents.cc +++ b/chrome/browser/tab_contents.cc @@ -516,3 +516,8 @@ void TabContents::RepositionSupressedPopupsToFit(const gfx::Size& new_size) { void TabContents::ReleaseDownloadShelfView() { download_shelf_view_.release(); } + +bool TabContents::ShowingBlockedPopupNotification() const { + return blocked_popups_ != NULL && + blocked_popups_->GetTabContentsCount() != 0; +} diff --git a/chrome/browser/tab_contents.h b/chrome/browser/tab_contents.h index f4d981e..6f7f592 100644 --- a/chrome/browser/tab_contents.h +++ b/chrome/browser/tab_contents.h @@ -465,6 +465,11 @@ class TabContents : public PageNavigator { typedef std::vector<ConstrainedWindow*> ConstrainedWindowList; ConstrainedWindowList child_windows_; + // Whether we have a notification AND the notification owns popups windows. + // (We keep the notification object around even when it's not shown since it + // determines whether to show itself). + bool ShowingBlockedPopupNotification() const; + private: // Data ---------------------------------------------------------------------- diff --git a/chrome/browser/web_contents.cc b/chrome/browser/web_contents.cc index cedb58c..507b33a 100644 --- a/chrome/browser/web_contents.cc +++ b/chrome/browser/web_contents.cc @@ -837,8 +837,11 @@ void WebContents::UpdateThumbnail(const GURL& url, } void WebContents::Close(RenderViewHost* rvh) { - // Ignore this if it comes from a RenderViewHost that we aren't showing. - if (delegate() && rvh == render_view_host()) + // Ignore this if it comes from a RenderViewHost that we aren't showing, and + // refuse to allow javascript to close this window if we have a blocked popup + // notification. + if (delegate() && rvh == render_view_host() && + !ShowingBlockedPopupNotification()) delegate()->CloseContents(this); } |