Delay invocation of SignedInListener.onSignIn to fix Firefox bug

Calling the SignedInListeners here is way to early. What happens is the
call stack is based on the "jsonp" style callback being made inside of
the dialog's iframe.  Trigging RPCs from within that callstack means
we are unable to read the RPC results, which sounds pretty odd.  But if
we delay the listeners (which may want to make RPC calls) until later
then things are just fine.

Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2008-11-27 22:23:05 -08:00
parent b8b79f9436
commit 88f26588b1

View File

@@ -21,6 +21,7 @@ import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Cookies;
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.WindowResizeListener;
@@ -151,9 +152,13 @@ public class Gerrit implements EntryPoint {
/** Hook from {@link SignInDialog} to let us know to refresh the UI. */
static void postSignIn() {
refreshMenuBar();
for (final SignedInListener l : signedInListeners) {
l.onSignIn();
}
DeferredCommand.addCommand(new Command() {
public void execute() {
for (final SignedInListener l : signedInListeners) {
l.onSignIn();
}
}
});
}
private static void refreshMenuBar() {