SGTM.

On Thu, Jan 22, 2009 at 12:14 PM, Lex Spoon <sp...@google.com> wrote:

>
> I'd like runAsync to use XHR for the iframe linker, so that GWT
> applications can get timely notification if an async code download
> fails for any reason.
>
> I've outlined all the code changes, but there is a remaining question
> about how the runAsync support should access XHR.  Ten minutes of
> reading through RequestBuilder and related classes is very convincing
> that that's the code to use.  It's a classic case where different
> browsers do a variety of weird and quirky things, and there are
> solutions to all the known quirks already implemented in those
> classes.
>
> The problem is that GWT.runAsync is in Core, RequestBuilder requires
> UserAgent, and Core is not supposed to require UserAgent.
>
> To solve this problem, how about we make a generic RequestBuilder that
> can be used in Core, and then add deferred bindings for the common
> case that UserAgent is included?  It would be analogous to what we do
> for StringBuffer.
>
> After looking at the implementation, I believe the only thing
> sensitive to the user agent is the method doCreateXmlHTTPRequest().
> The rest of the code is shared.  If that's the case, wouldn't it be
> possible to define a generic doCreateXmlHTTPRequest that handles all
> browsers?  It would look like the current IE implementation except
> with an additional catch block:
>
>
>  @Override
>  protected native JavaScriptObject doCreateXmlHTTPRequest() /*-{
>    if ($wnd.XMLHttpRequest) {
>      return new XMLHttpRequest();
>    } else {
>      try {
>        return new ActiveXObject('MSXML2.XMLHTTP.3.0');
>      } catch (e) {
>        try {
>          return new ActiveXObject("Microsoft.XMLHTTP");
>        } catch (e) {
>          // new catch block
>          return new XMLHttpRequest();
>        }
>      }
>    }
>  }-*/;
>
>
> Assuming the above implementation is reliable, HTTPRequestImpl could
> use it as the implementation in the base class.  We could add a new
> class HTTPRequestImplNonIE6 that has the simple "return new
> XMLHttpRequest" that works on all non-IE browsers.
>
> The modules would be changed as follows:
>
>  Core would inherit HTTP, and thus get a functioning but suboptimal
> RequestBuilder
>
>  HTTPRequest would change its default binding of HTTPRequestImpl to
> HTTPRequestImplNonIE6
>
>
>
> Before I experiment further, does anyone spot anything to worry about?
>
>
> Lex
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to