I have a GWT application that registers a CloseHandler for the CloseEvent.  
This handler calls the logout() method in another class, which does some 
cleanup and calls an RPC method to log the user out of the underlying 
server application (the GWT application is a client with web server being 
middle tier).

Here is the code for the CloseHandler:

    Window.addCloseHandler( 
        new CloseHandler<Window>() {
        @Override
        public void onClose( CloseEvent<Window> event ) {
                MainPresenter main = Client.this.context.getMainPresenter();

                if (main != null) {
     System.out.println("calling main.logout()..." );
                    main.logout();
     System.out.println("back from logout()..." );
                }
            }
        });
 

Here is the code for the logout() method:

    public void logout() {
    System.out.println("in logout()..." );
        /*
         * This callback method likely will not be executed because this
         * logout method is going to be called as the browser window is
         * closing.  Consequently, the RPC call will not return.  But if it
         * does, simply ignore the return.
         */
        AsyncCallback<UserOperationResult> callback = new 
AsyncCallback<UserOperationResult>() {

            @Override
            public void onFailure( Throwable caught ) {
                // ignore
                System.out.println("logout failed:" + caught);
                caught.printStackTrace();
            }

            @Override
            public void onSuccess( UserOperationResult result ) {
                // ignore
                System.out.println("result=" + result);
            }
        };

    System.out.println("calling authentication service-> logout()..." );
        this.context.getAuthenticationService().logout( 
MainPresenter.this.context.getUser(), callback );
        // stop the ping service
        this.context.stopPingTimer();
    System.out.println( "stopped ping timer..." );
        this.context.stopBlockedTimer();
    System.out.println("stopped blocked timer..." );
        
        releaseRegistrations();
    System.out.println("released registrations..." );

    }


The generated output looks like:


    mozilla/5.0 (windows nt 6.1; wow64; rv:18.0) gecko/20100101 firefox/18.0
    closing... end session
    calling main.logout()...
    in logout()...
    calling authentication service-> logout()...
    stopped ping timer...
    stopped blocked timer...
    released registrations...
    back from logout()...


As you can see, the RPC method is being called well before the application 
completes, but there are no logging/debug messages from the web server RPC 
service, and the user is not logged out of the underlying application.  
I've verified the service method is not being called, implying the RPC 
method is really never being executed.

*This worked fine until recent upgrade to Firefox 21*.  Testing shows this 
works for Firefox 9, 15, 16, and 17, but stopped working with version 
18.0.2.  It works for Chrome (27) and IE9 as well a previous versions of 
Chrome and IE.

I tried looking through the list of changes for Firefox 18 to see if there 
was something I could determine might affect the calling of the RPC method, 
but wasn't able to find anything obvious.

Has anyone else encountered this problem or have a workaround?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to