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 /views/window/dialog_client_view.cc | |
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 'views/window/dialog_client_view.cc')
-rw-r--r-- | views/window/dialog_client_view.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/views/window/dialog_client_view.cc b/views/window/dialog_client_view.cc index 978d45a..5a36830 100644 --- a/views/window/dialog_client_view.cc +++ b/views/window/dialog_client_view.cc @@ -207,7 +207,7 @@ void DialogClientView::AcceptWindow() { } if (GetDialogDelegate()->Accept(false)) { accepted_ = true; - window()->Close(); + Close(); } } @@ -215,7 +215,7 @@ void DialogClientView::CancelWindow() { // Call the standard Close handler, which checks with the delegate before // proceeding. This checking _isn't_ done here, but in the WM_CLOSE handler, // so that the close box on the window also shares this code path. - window()->Close(); + Close(); } /////////////////////////////////////////////////////////////////////////////// @@ -327,7 +327,7 @@ gfx::Size DialogClientView::GetPreferredSize() { bool DialogClientView::AcceleratorPressed(const Accelerator& accelerator) { DCHECK(accelerator.GetKeyCode() == VK_ESCAPE); // We only expect Escape key. - window()->Close(); + Close(); return true; } @@ -459,4 +459,9 @@ void DialogClientView::InitClass() { } } +void DialogClientView::Close() { + window()->Close(); + GetDialogDelegate()->OnClose(); +} + } // namespace views |