Closed Bug 1286744 Opened 8 years ago Closed 8 years ago
All Response Headers() should return an empty string if the XHR failed .
The XHR spec states that GetAllResponseHeaders() should return the empty string on errors (we're in a "network error" response state, and those are stated to not have any headers). Chrome already passes the relevant web platform test: http://w3c-test.org/XMLHttpRequest/xmlhttprequest-network-error.htm
Here's a patch which passes the test. Try run: https://treeherder.mozilla.org/#/jobs?repo=try&revision=dfbd3de4a26d
Attachment #8770984 - Flags: review?(bugs)
Comment on attachment 8770984 [details] [diff] [review] 1286744-return_empty_string_for_getAllResponseHeaders_if_errors.diff Where does the spec actually say that. fetch is so unreadable spec that finding anything there is rather hard.
Ah, this "A network error is a response whose status is always 0, status message is always the empty byte sequence, header list is always empty, body is always null, and cache state is always "none". "
Attachment #8770984 - Flags: review?(bugs) → review+
Thanks, I'll try to be extra-clear with my wording next time to spare the extra reading exercise. Requesting checkin.
Pushed by email@example.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/54af298e7b99 Return the empty string from GetAllResponseHeaders() if the XHR failed. r=smaug
I have precised the return value of https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getAllResponseHeaders and a mention in https://developer.mozilla.org/en-US/Firefox/Releases/50#DOM_and_HTML_DOM
You need to log in before you can comment on or make changes to this bug.