Window.open(...) doesn't work

I noticed strange behaviour when using Opera 10.5 with Vaadin in my application.
I created simple test app to show the problem (below).

Behaviour expected:

  1. Go to http://localhost:8080/MyApp/
  2. Login Window appears.
  3. Click “Login” button.
  4. Main window appears.
  5. Go to http://localhost:8080/MyApp/ once again.
  6. Login Window appears.
  7. Click “Login” once again.
  8. Main window appears.

And it works this way under Firefox 3.6.
But on Opera after clicking “Login” button second time - nothing happens - but putting log messages in the code, button click listener fires and Login window is shown once again and again and again (instead of Main window).

Maybe the problem is because I don’t use application windows in correct way (see below) but I have read the application level window part in book of Vaadin (http://vaadin.com/book/-/page/application.windows.html) and I suppose that I use it correctly anyway.

Can You point me where is the problem? Or is it some Opera related bug?

OS: Windows XP Professional SP3
Opera: 10.5 build 3296 Opera/9.80 (Windows NT 5.1; U; pl) Presto/2.5.22 Version/10.50
FireFox: 3.6 Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)
Vaadin: vaadin-6.3.0.nightly-20100203-c11122 but occures also with release 6.2.5
AS: Sun GlassFish Enterprise Server v2.1.1 ((v2.1 Patch06)(9.1_02 Patch12)) (build b31g-fcs)

public class App extends Application {
	private boolean isLoggedIn = false;

	public void init() {
		final AuthWindow authWindow = new AuthWindow( this );
		authWindow.setName( UUID.randomUUID().toString() );
		this.setMainWindow( authWindow );
	}

	public Window getWindow( String name ) {
		final Window result;
		final Window foundWindow = super.getWindow( name );
		if ( foundWindow == null ) {
			if ( this.isLoggedIn ) {
				if ( name.equals( "Main" ) ) {
					result = new MainWindow();
				} else {
					if ( name.equals( "Login" ) ) {
						result = new AuthWindow( this );
					} else {
						result = new AuthWindow( this );
					}
				}
			} else {
				result = new AuthWindow( this );
			}
			result.setName( UUID.randomUUID().toString() );
			this.addWindow( result );
		} else {
			result = foundWindow;
		}
		return result;
	}

	public void afterLogin() {
		this.isLoggedIn = true;
		this.getMainWindow().open(
			new ExternalResource( this.getURL() + "Main" ) );
	}
}

class AuthWindow extends Window {
	public AuthWindow( final App app ) {
		super( "Login" );
		final Button loginButton = new Button( "Login" );
		loginButton.addListener( new ClickListener() {

			public void buttonClick( ClickEvent event ) {
				app.afterLogin();
			}
		} );
		this.addComponent( loginButton );
	}
}

class MainWindow extends Window {
	public MainWindow() {
		super( "Main" );
	}
}

web.xml (obvious):

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	id="WebApp_ID" version="2.5">
	<display-name>SimpleAddressBook</display-name>

	<servlet>
		<servlet-name>TestServlet</servlet-name>
		<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
		<!-- Omitted if using custom servlet -->
		<init-param>
			<param-name>application</param-name>
			<param-value>com.test.App</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>TestServlet</servlet-name>
		<url-pattern>/*</url-pattern>
	</servlet-mapping>
</web-app>

This looks like a bug to me, and seems to also apply to Opera 10.10.

Created
a ticket
.

In the case showed above - yes, it happens only under Opera (even 10.52).

But when You type directly URL for Login window http://localhost:8080/MyApp/Login then clicking in Login button doesn’t move to Main window - button’s listener invokes afterLogin method what invokes:

this.getMainWindow().open( new ExternalResource( this.getURL() + "Main" ) );

This apply for other browsers also.

It started to work after changing this:

this.getMainWindow().open( new ExternalResource( this.getURL() + "Main" ) );

to this:

windowPassedHereFromListener.open( new ExternalResource( this.getURL() + "Main" ) );

windowPassedHereFromListener is a window object passed there as a “sender” - in code snippet above it is AuthWindow window that owns button that owns click listener.