diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-15 19:34:02 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-15 19:34:02 +0000 |
commit | 571e31155b13e96295c3423c2da5280c3242e2ac (patch) | |
tree | c4552eb1cfda07e6a168a7b9f91870c2e379120e /chrome/browser/tab_contents | |
parent | 347462e28144797eb7eeada2e9c167dcc29065f2 (diff) | |
download | chromium_src-571e31155b13e96295c3423c2da5280c3242e2ac.zip chromium_src-571e31155b13e96295c3423c2da5280c3242e2ac.tar.gz chromium_src-571e31155b13e96295c3423c2da5280c3242e2ac.tar.bz2 |
Displaying consecutive alerts from plugins should not hang the browser. The plugins display alerts via the NPN_Evaluate API. The browser signals an event handle to ensure that the plugin starts peeking for messages while waiting for the NPN_Evaluate call to return. When the dialog is dismissed by the user, windows does send some messages to the plugin window underneath, like activation messages, etc. These don't get dispatched as the event is reset when the dialog is dismissed, i.e. much before the window is actually
destroyed.
The fix is to reset the event handle after the window is actually destroyed. To achieve this I added an OnClose virtual function to the DialogDelegate interface, which is overridden by the JavascriptMessageBoxDialog class which eventually ensures that the event is reset.
This fixes http://code.google.com/p/chromium/issues/detail?id=10799
I updated the AlertInWindowMessage npapi test to display two alerts instead of one.
Bug=10799
Review URL: http://codereview.chromium.org/113464
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16172 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
4 files changed, 14 insertions, 0 deletions
diff --git a/chrome/browser/tab_contents/render_view_host_manager.cc b/chrome/browser/tab_contents/render_view_host_manager.cc index 07e4277..4a55dbb 100644 --- a/chrome/browser/tab_contents/render_view_host_manager.cc +++ b/chrome/browser/tab_contents/render_view_host_manager.cc @@ -253,6 +253,10 @@ void RenderViewHostManager::OnJavaScriptMessageBoxClosed( render_view_host_->JavaScriptMessageBoxClosed(reply_msg, success, prompt); } +void RenderViewHostManager::OnJavaScriptMessageBoxWindowDestroyed() { + render_view_host_->JavaScriptMessageBoxWindowDestroyed(); +} + void RenderViewHostManager::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { diff --git a/chrome/browser/tab_contents/render_view_host_manager.h b/chrome/browser/tab_contents/render_view_host_manager.h index d77e649..11ec445 100644 --- a/chrome/browser/tab_contents/render_view_host_manager.h +++ b/chrome/browser/tab_contents/render_view_host_manager.h @@ -148,6 +148,9 @@ class RenderViewHostManager : public NotificationObserver { bool success, const std::wstring& prompt); + // Forwards this message to the RenderViewHost. + void OnJavaScriptMessageBoxWindowDestroyed(); + // Sets the passed passed interstitial as the currently showing interstitial. // |interstitial_page| should be non NULL (use the remove_interstitial_page // method to unset the interstitial) and no interstitial page should be set diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index d253dc9..9042518 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -1062,6 +1062,10 @@ void TabContents::OnJavaScriptMessageBoxClosed(IPC::Message* reply_msg, render_manager_.OnJavaScriptMessageBoxClosed(reply_msg, success, prompt); } +void TabContents::OnJavaScriptMessageBoxWindowDestroyed() { + render_manager_.OnJavaScriptMessageBoxWindowDestroyed(); +} + void TabContents::OnSavePage() { // If we can not save the page, try to download it. if (!SavePackage::IsSavableContents(contents_mime_type())) { diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h index 4f938a2..cf25aba 100644 --- a/chrome/browser/tab_contents/tab_contents.h +++ b/chrome/browser/tab_contents/tab_contents.h @@ -516,6 +516,9 @@ class TabContents : public PageNavigator, bool success, const std::wstring& prompt); + // AppModalDialog calls this when the javascript dialog has been destroyed. + void OnJavaScriptMessageBoxWindowDestroyed(); + // Prepare for saving the current web page to disk. void OnSavePage(); |