Revision: 8206
Author: gwt.mirror...@gmail.com
Date: Tue May 25 09:43:21 2010
Log: Firing MenuItem commands using a finally command instead of a deferred
command so that the command executes within the event loop. If the command
is not executed in the event loop, popup blockers will prevent the code
from opening popups. It seems like it could be possible that somebody
expects the command to fire deferred, but I can't think of any way that it
would cause a problem.
Review at http://gwt-code-reviews.appspot.com/543804
Review by: j...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=8206
Modified:
/branches/2.1/user/src/com/google/gwt/user/client/ui/MenuBar.java
=======================================
--- /branches/2.1/user/src/com/google/gwt/user/client/ui/MenuBar.java Thu
Feb 11 05:01:40 2010
+++ /branches/2.1/user/src/com/google/gwt/user/client/ui/MenuBar.java Tue
May 25 09:43:21 2010
@@ -16,6 +16,7 @@
package com.google.gwt.user.client.ui;
import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.EventTarget;
import com.google.gwt.event.dom.client.BlurEvent;
import com.google.gwt.event.dom.client.BlurHandler;
@@ -30,7 +31,6 @@
import com.google.gwt.resources.client.ImageResource.ImageOptions;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Event.NativePreviewEvent;
@@ -834,9 +834,14 @@
// Close this menu and all of its parents.
closeAllParents();
- // Fire the item's command.
- Command cmd = item.getCommand();
- DeferredCommand.addCommand(cmd);
+ // Fire the item's command. The command must be fired in the same
event
+ // loop or popup blockers will prevent popups from opening.
+ final Command cmd = item.getCommand();
+ Scheduler.get().scheduleFinally(new Scheduler.ScheduledCommand() {
+ public void execute() {
+ cmd.execute();
+ }
+ });
// hide any open submenus of this item
if (shownChildMenu != null) {
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors