Closed
Bug 707484
Opened 13 years ago
Closed 10 years ago
[XHR2] Allow setting XHR responseType and withCredentials before open
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla38
People
(Reporter: emk, Assigned: Ms2ger)
References
()
Details
(Keywords: dev-doc-needed)
Attachments
(2 files, 1 obsolete file)
4.71 KB,
patch
|
sicking
:
review+
|
Details | Diff | Splinter Review |
9.56 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
The latest XHR2 spec allows setting responseType and withCredentials in UNSENT or OPENED state.
Reporter | ||
Updated•13 years ago
|
Summary: Allow setting XHR responseType and withCredentials before send. → Allow setting XHR responseType and withCredentials before open.
Comment 1•12 years ago
|
||
Attachment #707601 -
Flags: review?(jonas)
Comment on attachment 707601 [details] [diff] [review]
Allow setting XHR.responseType before open()
Review of attachment 707601 [details] [diff] [review]:
-----------------------------------------------------------------
r=me if you also add a test.
Attachment #707601 -
Flags: review?(jonas) → review+
Comment 3•12 years ago
|
||
HRs were not asynchronous by default. I also added a test.
Attachment #707601 -
Attachment is obsolete: true
Attachment #708091 -
Flags: review?(jonas)
Comment on attachment 708091 [details] [diff] [review]
Allow setting XHR.responseType before open()
Review of attachment 708091 [details] [diff] [review]:
-----------------------------------------------------------------
r=me with that fixed.
::: content/base/test/test_XHR.html
@@ +90,5 @@
> try { xhr.responseXML } catch (e) { didthrow = true; }
> ok(didthrow, "should have thrown when accessing responseXML");
> }
> +function checkSetResponseTypeThrows(xhr, type, shouldThrow) {
> + var shouldThrow = shouldThrow === undefined ? true : shouldThrow;
shouldThrow = !!shouldThrow;
@@ +101,3 @@
> }
> +function checkOpenThrows(xhr, method, url, async, shouldThrow) {
> + var shouldThrow = shouldThrow === undefined ? true : shouldThrow;
Same
@@ +118,5 @@
> +checkSetResponseTypeThrows(xhr, "moz-chunked-text", false);
> +checkSetResponseTypeThrows(xhr, "moz-chunked-arraybuffer", false);
> +checkOpenThrows(xhr, "GET", "file_XHR_pass2.txt", false, true);
> +checkSetResponseTypeThrows(xhr, "", false);
> +checkOpenThrows(xhr, "GET", "file_XHR_pass2.txt", false, false);
Also add a test that checks that setting the reponseType to something before calling .open() actually works. I.e. that it interprets the response according to the set responseType.
Attachment #708091 -
Flags: review?(jonas) → review+
Reporter | ||
Comment 5•12 years ago
|
||
Is it safe to change .responseType in HEADER_RECEIVED state?
yup, that should already work fine.
Comment 7•11 years ago
|
||
Setting responseType throws an unexpected error in these test cases:
http://w3c-test.org/web-platform-tests/master/XMLHttpRequest/open-method-responsetype-set-sync.htm
http://w3c-test.org/web-platform-tests/master/XMLHttpRequest/response-json.htm
http://w3c-test.org/web-platform-tests/master/XMLHttpRequest/responsexml-non-document-types.htm
I'm going to assume this bug is the reason.
Blocks: xhr2pass
Comment 8•11 years ago
|
||
Here's a withCredentials test case:
http://w3c-test.org/web-platform-tests/master/XMLHttpRequest/withcredentials-set.htm
Updated•11 years ago
|
Summary: Allow setting XHR responseType and withCredentials before open. → [XHR2] Allow setting XHR responseType and withCredentials before open
Reporter | ||
Comment 9•11 years ago
|
||
Tillmann, could you post a new patch with review comments resolved?
Flags: needinfo?(tilkax)
Assignee | ||
Comment 10•10 years ago
|
||
Assignee | ||
Comment 11•10 years ago
|
||
Assignee | ||
Comment 12•10 years ago
|
||
Attachment #8547725 -
Flags: review?(bugs)
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → Ms2ger
Status: NEW → ASSIGNED
Assignee | ||
Comment 13•10 years ago
|
||
This is Tillmann's patch rebased to trunk. I removed the
> checkSetResponseTypeThrows(xhr, "", false);
> checkOpenThrows(xhr, "GET", "file_XHR_pass2.txt", false, false);
bit from the test; it's already covered by the wpt tests. I left the rest in because it also tests proprietary values that the wpt tests can't.
Flags: needinfo?(tilkax)
Updated•10 years ago
|
Keywords: dev-doc-needed
Updated•10 years ago
|
Attachment #8547725 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 14•10 years ago
|
||
Comment 15•10 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
Assignee | ||
Comment 16•10 years ago
|
||
Tillmann, thanks for the patch!
You need to log in
before you can comment on or make changes to this bug.
Description
•