While working on a feature to an app, that is similar to one found on gmail, where you can move a gtalk chat to another window, I found some problems concerning JSNI and child windows. Basically, JSNI works as expected with objects and functions from another window, except when it involves transfer Java objects, even when the two windows loads the exactly same html, meaning the javascript code is the same.
I made an example that shows the problem: http://pastebin.com/K8NYwL6u This example shows two different scenarios. In the first, the child window tries to send a message to parent window (an Integer object). It works well in prod mode, but in development mode it throws an exception: java.lang.NullPointerException: null at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java: 232) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java: 136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java: 561) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java: 289) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java: 107) at com.testjsni.client.TestEntryPoint.notifyParent(TestEntryPoint.java) at com.testjsni.client.TestEntryPoint.handleChildWindow(TestEntryPoint.java: 63) at com.testjsni.client.TestEntryPoint.onModuleLoad(TestEntryPoint.java: 21) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java: 396) at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java: 200) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java: 525) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java: 363) at java.lang.Thread.run(Thread.java:662) In the second scenario, the child window sends a callback object to parent window, so the parent window can send messages to the other window. When a message is sent, the callback is triggered on the other side, but the message is always receveid as a 'null' value. It happens both in prod and dev modes, but no exception is thrown. These problems doesn't happen if you use a primitive value (int, boolean...), a String or a JavaScriptObject as a message. Any other Java Object or enum type trigger the error. I'm not sure if this is a bug, or it is supposed to work that way, since there are no mention about this in the documentation (http:// code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html). Should I post a bug report for this? Thanks, Luiz. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.