summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-01 21:39:31 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-01 21:39:31 +0000
commit634a6f9eb80c3b731d99735a3f4644ac2a9ca6be (patch)
tree0e5c69056108aa431be9ab96fe8a8da29070df59 /chrome/browser
parenta1d906f9a26ee9b56be0bc78210cb5526f01ee2e (diff)
downloadchromium_src-634a6f9eb80c3b731d99735a3f4644ac2a9ca6be.zip
chromium_src-634a6f9eb80c3b731d99735a3f4644ac2a9ca6be.tar.gz
chromium_src-634a6f9eb80c3b731d99735a3f4644ac2a9ca6be.tar.bz2
Fix window.open()/window.close() regression by disabling window.close() until a message comes back
from the Browser thread saying that it's OK to allow javascript close calls. ISSUE=http://crbug.com/4007 Review URL: http://codereview.chromium.org/12691 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6165 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/render_view_host.cc4
-rw-r--r--chrome/browser/render_view_host.h4
-rw-r--r--chrome/browser/tab_contents.cc3
-rw-r--r--chrome/browser/tab_contents.h3
-rw-r--r--chrome/browser/views/blocked_popup_container.cc1
-rw-r--r--chrome/browser/web_contents.cc11
-rw-r--r--chrome/browser/web_contents.h1
7 files changed, 22 insertions, 5 deletions
diff --git a/chrome/browser/render_view_host.cc b/chrome/browser/render_view_host.cc
index cb31cda..38bbe9e 100644
--- a/chrome/browser/render_view_host.cc
+++ b/chrome/browser/render_view_host.cc
@@ -1033,6 +1033,10 @@ void RenderViewHost::DisassociateFromPopupCount() {
Send(new ViewMsg_DisassociateFromPopupCount(routing_id_));
}
+void RenderViewHost::PopupNotificationVisibilityChanged(bool visible) {
+ Send(new ViewMsg_PopupNotificationVisiblityChanged(routing_id_, visible));
+}
+
void RenderViewHost::OnMsgGoToEntryAtOffset(int offset) {
delegate_->GoToEntryAtOffset(offset);
}
diff --git a/chrome/browser/render_view_host.h b/chrome/browser/render_view_host.h
index 3638f9b..b7d1ae2 100644
--- a/chrome/browser/render_view_host.h
+++ b/chrome/browser/render_view_host.h
@@ -392,6 +392,10 @@ class RenderViewHost : public RenderWidgetHost {
// as a popup.
void DisassociateFromPopupCount();
+ // Notifies the Renderer that we've either displayed or hidden the popup
+ // notification.
+ void PopupNotificationVisibilityChanged(bool visible);
+
// Called by the AutofillManager when the list of suggestions is ready.
void AutofillSuggestionsReturned(const std::vector<std::wstring>& suggestions,
int64 node_id,
diff --git a/chrome/browser/tab_contents.cc b/chrome/browser/tab_contents.cc
index ebd8f2b..ffd17cb 100644
--- a/chrome/browser/tab_contents.cc
+++ b/chrome/browser/tab_contents.cc
@@ -292,6 +292,8 @@ void TabContents::AddNewContents(TabContents* new_contents,
delegate_->AddNewContents(this, new_contents, disposition, initial_pos,
user_gesture);
+
+ PopupNotificationVisibilityChanged(ShowingBlockedPopupNotification());
}
}
@@ -311,6 +313,7 @@ void TabContents::AddConstrainedPopup(TabContents* new_contents,
}
blocked_popups_->AddTabContents(new_contents, initial_pos);
+ PopupNotificationVisibilityChanged(ShowingBlockedPopupNotification());
}
void TabContents::CloseAllSuppressedPopups() {
diff --git a/chrome/browser/tab_contents.h b/chrome/browser/tab_contents.h
index dad5f63..4ff6a44 100644
--- a/chrome/browser/tab_contents.h
+++ b/chrome/browser/tab_contents.h
@@ -337,6 +337,9 @@ class TabContents : public PageNavigator,
// of unwanted popups.
void CloseAllSuppressedPopups();
+ // Called when the blocked popup notification is shown or hidden.
+ virtual void PopupNotificationVisibilityChanged(bool visible) { }
+
// Views and focus -----------------------------------------------------------
// Returns the actual window that is focused when this TabContents is shown.
diff --git a/chrome/browser/views/blocked_popup_container.cc b/chrome/browser/views/blocked_popup_container.cc
index 22993ac..ef66737 100644
--- a/chrome/browser/views/blocked_popup_container.cc
+++ b/chrome/browser/views/blocked_popup_container.cc
@@ -306,6 +306,7 @@ std::wstring BlockedPopupContainer::GetDisplayStringForItem(int index) {
void BlockedPopupContainer::CloseAllPopups() {
CloseEachTabContents();
+ owner_->PopupNotificationVisibilityChanged(false);
container_view_->UpdatePopupCountLabel();
HideSelf();
}
diff --git a/chrome/browser/web_contents.cc b/chrome/browser/web_contents.cc
index 0c0b34d..4afc290 100644
--- a/chrome/browser/web_contents.cc
+++ b/chrome/browser/web_contents.cc
@@ -486,6 +486,10 @@ void WebContents::SetDownloadShelfVisible(bool visible) {
}
}
+void WebContents::PopupNotificationVisibilityChanged(bool visible) {
+ render_view_host()->PopupNotificationVisibilityChanged(visible);
+}
+
// Stupid view pass-throughs
void WebContents::CreateView() {
view_->CreateView();
@@ -847,11 +851,8 @@ void WebContents::UpdateThumbnail(const GURL& url,
}
void WebContents::Close(RenderViewHost* rvh) {
- // 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())
+ // Ignore this if it comes from a RenderViewHost that we aren't showing.
+ if (delegate() && rvh == render_view_host())
delegate()->CloseContents(this);
}
diff --git a/chrome/browser/web_contents.h b/chrome/browser/web_contents.h
index 75c5c689..efe7a10 100644
--- a/chrome/browser/web_contents.h
+++ b/chrome/browser/web_contents.h
@@ -98,6 +98,7 @@ class WebContents : public TabContents,
virtual void ShowContents();
virtual void HideContents();
virtual void SetDownloadShelfVisible(bool visible);
+ virtual void PopupNotificationVisibilityChanged(bool visible);
// Retarded pass-throughs to the view.
// TODO(brettw) fix this, tab contents shouldn't have these methods, probably