implement XMLHttpRequest.responseBody

RESOLVED DUPLICATE of bug 572522

Status

()

enhancement
RESOLVED DUPLICATE of bug 572522
13 years ago
8 years ago

People

(Reporter: stephen.deken, Unassigned)

Tracking

({testcase})

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3

When fetching a binary file using XMLHttpRequest, the response contained in responseText is mangled.  Characters above 0x7f are translated into U+FFFD, effectively destroying the file.  This happens without regard to the content-type or charset specified in the headers.

Reproducible: Always

Steps to Reproduce:
1. Create an XMLHttpRequest object.
2. Perform a GET on a binary file (a file with octets above 0x7f).
3. Examine the results for the U+FFFD codepoint (which should not be present).

See upcoming testcase.
(Reporter)

Comment 1

13 years ago
Posted file Testcase. (obsolete) —
This uses an image from Bugzilla, but all binary files are affected.  I originally saw it using a TrueType font file that had been transmitted as text/plain, and the bug persisted even after I changed the content-type to application/octet-stream.
Keywords: testcase
what happens if you use xtp.overrideMimeType("text/plain; charset=ISO-8859-1"); (after open, before send)?
(Reporter)

Comment 3

13 years ago
With that coercion, the result is better -- octets with the 0x80 bit set are translated into unicode code points, which (in theory) could be reverse-mapped into the original values.  However, this is ugly and should not be necessary.

Here's another testcase which lets you try other files, content types, etc.  If there's a combination that actually handles binary data, that would be sufficient.
Attachment #221590 - Attachment is obsolete: true
-> enhancement, this doesn't sound like a bug to me
Severity: normal → enhancement
There is plans to make a responseBody property available that contains the raw data received from the server. However it is not yet defined what data type this member will be of.

It will hopefully be defined as part of the XHR2 spec, so please voice your opinions there.
Summary: XMLHttpRequest mangles binary data → implement XMLHttpRequest.responseBody
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee: xml → nobody
QA Contact: ashshbhatt → xml
Is typed array (i.e. Uint8Array) usable until ByteArray is defined in ECMA-262 spec?
Implemented as .mozResponseArrayBuffer.
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 572522
You need to log in before you can comment on or make changes to this bug.