Vaadin XS - Window.setImmediate(true) -> Firefox Bug?

Hi,
I am trying to integrate Vaadin XS in my app and I getting closer and closer to it. But there are still serious problems with the properly launch of the application.
The current main problem is firefox! (10.0.2)
Now I ve found a possible problem cause and could reproduce it with a simple hello world with XS Application:

@Override
public void init() {
	Window mainWindow = new Window();
	mainWindow.addComponent(new Label("Hello Problem"));
	mainWindow.setImmediate(true);
	setMainWindow(mainWindow);
}

If I start this application in firefox and play with F5 or the reload browser button, I get Session expired or Internal Error message in the standard javascript alert with visible and
tags. This happens to me only with firefox! If I remove mainWindow.setImmediate(true) line, then firefox gets no problem. This is a very strange behavior.
If the session expired message occures, I get no exception in the server console. If the internal error occures, I get:

java.lang.ArrayIndexOutOfBoundsException: 1
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1365)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1318)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:763)
	at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:296)
	at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
	at com.vaadin.addons.xs.server.XSApplicationServlet.service(XSApplicationServlet.java:97)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:304)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

In the Hello World application the problem occures not often, but in average on every 5th hit.
In my real application I lose my session by reloading the tab very often and I cant find out why. Without XS I get no problems with reloading. And the problem occures only in Firefox. If I open a new firefox tab and load the application there, then I get no error. If I reload the application in the tab, I lose my session.
Are there some things which you not may do if you use XS Addon?
One of this things I could find out: dont switch main windows, it affects the XS stability and you get out of sync if you use Clickshortcuts on buttons.

I am a student and I decided to make a project with vaadin for the software engineering lecture. And the main feature of this project is the easy embedding of it in another websites. I would be very happy to hear any kind of tips. The project deadline is this friday :smiley:

//Edit:
I forgotten to say that the problem occures only if the vaadin application is configured as following in web.xml:

<servlet-mapping>
		<servlet-name>My Servlet</servlet-name>
		<url-pattern>/*</url-pattern>
</servlet-mapping>

if its not matching the whole url, like in:

<servlet-mapping>
		<servlet-name>My Servlet</servlet-name>
		<url-pattern>/myapp/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
		<servlet-name>Some other Servlet</servlet-name>
		<url-pattern>/*</url-pattern>
</servlet-mapping>

then the My Servlet application works fine if you load it over the browser. The other servlet gets the same problem as described above.
I ve also tried to create a dummy application that get the whole errors and my real application work instead fine. It was a happiness for a minute, because my applications worked over the browser perfectly. But I cant embed them in another website. If I do it, then the app shows the error, that it cant find its widgetset. But my widgetset is for all application the same. I guess, it stucks because of the url, which consists not only the project name, but also the application name, like http://localhost:9090/project/appname/embedJS, The error shows that the widgetset must be in http://localhost:9090/project/appname/VAADIN/widgetsets

kind regards and please forgive me my english

Vlad

Hi,

Reading this and your previous post I think you should check out the XS sources with SVN and build a snapshot version of the add-on by yourself. The latest version has multi window support as where the previous version only supported “main window”. Also it can support “init parameters”. I think you could then get rid of multiple servlets and apps. Too bad somebody has been lazy and these essential enhancements are not yet available in public release.

Parameters can then be passed like this:

See this change set for details:
http://dev.vaadin.com/changeset/22056/svn

PS. I still don’t suggest to change top level windows with Vaadin XS nor with any other Vaadin apps. It is an expensive operation. It is always safest and fastest just to change the content of the top level window.

cheers,
matti