[Webkit-unassigned] [Bug 123457] New: XHR.response is null when requesting empty file as arraybuffer

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Oct 29 11:58:33 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=123457

           Summary: XHR.response is null when requesting empty file as
                    arraybuffer
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
               URL: http://people.cs.umass.edu/~jvilk/empty_xhr_bug.html
        OS/Version: All
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: XML
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: jvilk at cs.umass.edu


Steps to reproduce:
1. Create an asynchronous XMLHttpRequest for an empty file with responseType set to 'arraybuffer'.
2. Send the request.
3. When the request finishes loading successfully (req.readyState is 4, req.status is 200), req.response will be set to NULL.

Expected behavior:
Since I requested an ArrayBuffer representation of an empty file and that request *succeeded*, req.response should be an ArrayBuffer of size 0.

Code:
window.addEventListener('load', function() {
  var req = new XMLHttpRequest();
  req.open('GET', './empty.txt', true);
  req.responseType = 'arraybuffer';
  req.onload = function(e) {
    if (req.readyState === 4 && req.status === 200) {
      // The request succeeded!
      // In non-WebKit browsers, req.response will be an ArrayBuffer of byteLength 0.
      // In WebKit browsers (Chrome/Safari), req.response will be NULL.
    }
  };
  req.send();
});

A live demo of this test code can be seen here:
http://people.cs.umass.edu/~jvilk/empty_xhr_bug.html

Firefox and Opera (Presto engine) both set response to a 0-length ArrayBuffer. I have yet to test IE10.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list