Ray/Lex, I'm starting to think that the dynamic iframe might not be a bad first approach to this problem either. A single linker would be able to provide cross-domain-capable, multi-module-safe code that doesn't require any additional post-processing to support loading of fragments. It also runs in the global scope, saving the extra few ms per global access (http://blog.j15r.com/2009/08/where-should-i-define-javascript.html ).
The method used to load the first and additional fragments could become a linker property. For our cross-domain loads, I'd like to have a strategy that tries to use cross-domain XMLHttpRequest first, assuming appropriate Access-Control-* headers on the other end, then falls back to <script> tags if this isn't available. The default could be something simple like <script> tags, or even standard XMLHttpRequest, assuming the auxiliary scripts are stored on the same domain. It still has the disadvantage of being slightly more magical, requiring tricks to work around IE's window event security, but the advantages are pretty substantial. It should be possible to write this linker as a drop-in replacement for today's XSLinker and IFrameLinkers without touching any code outside of com.google.gwt.core.linker. Matt. On 30-Nov-09, at 5:09 PM, Ray Cromwell wrote: > > Lex, > JSONP loading + dynamic iframe seems like a straightforward viable > option that doesn't require a lot of complicated compiler work, what > do you think of providing this as an option? > > -Ray > > On Mon, Nov 30, 2009 at 12:29 PM, Lex Spoon <sp...@google.com> wrote: > (Reposting to get it on the mailing list; first try bounced.) > > > Hey, Matt, > > I agree with your analysis about the code-splitting issues. > > I've worked out a preliminary patch to do var renaming, but I haven't > shared it yet because it's in a pretty early state. I could share it > if you or someone is eager enough to see it that you're willing to > hack some code to get to use it. > > To really get it polished up into a committable state, the main issue > will be figuring out when to enable the rewrites. Whether to enable > it or not depends on the choice of linker. > > For the off-domain loading, I was thinking to look into a JSONP-like > downloader. That, too, is something that should only optionally be > enabled, because it has worse download failure reporting. Thus, again > the hardest part will be figuring out when to enable it. > > -- > http://groups.google.com/group/Google-Web-Toolkit-Contributors > -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
