Author: sp...@google.com
Date: Tue Apr 21 11:13:46 2009
New Revision: 5267

Modified:
    trunk/user/src/com/google/gwt/core/client/AsyncFragmentLoader.java

Log:
When AsyncFragmentLoader checks for the success of an XHR download,
it now requires that xhr.responseText is non-null and non-empty.
Otherwise, the download is considered a failure regardless of the
status code.

Review by: bobv



Modified: trunk/user/src/com/google/gwt/core/client/AsyncFragmentLoader.java
==============================================================================
--- trunk/user/src/com/google/gwt/core/client/AsyncFragmentLoader.java   
(original)
+++ trunk/user/src/com/google/gwt/core/client/AsyncFragmentLoader.java  Tue  
Apr 21 11:13:46 2009
@@ -171,9 +171,10 @@

    /**
     * Some UA's like Safari will have a "0" status code when loading from  
file:
-   * URLs.
+   * URLs. Additionally, the "0" status code is used sometimes if the  
server
+   * does not respond, e.g. if there is a connection refused.
     */
-  private static final int HTTP_STATUS_LOCAL = 0;
+  private static final int HTTP_STATUS_NON_HTTP = 0;

    private static final int HTTP_STATUS_OK = 200;

@@ -371,8 +372,9 @@
          public void onReadyStateChange(XMLHttpRequest xhr) {
            if (xhr.getReadyState() == XMLHttpRequest.DONE) {
              xhr.clearOnReadyStateChange();
-            if (xhr.getStatus() == HTTP_STATUS_OK
-                || xhr.getStatus() == HTTP_STATUS_LOCAL) {
+            if ((xhr.getStatus() == HTTP_STATUS_OK || xhr.getStatus() ==  
HTTP_STATUS_NON_HTTP)
+                && xhr.getResponseText() != null
+                && xhr.getResponseText().length() != 0) {
                try {
                  installCode(xhr.getResponseText());
                } catch (RuntimeException e) {

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

Reply via email to