Closed
Bug 1109486
Opened 10 years ago
Closed 10 years ago
XMLHttpRequest.send(document) should unconditionally encode as UTF-8
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla37
People
(Reporter: foolip, Assigned: chenpighead, Mentored)
References
Details
(Keywords: dev-doc-complete, site-compat, testcase, Whiteboard: [lang=c++])
Attachments
(2 files, 2 obsolete files)
1.93 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
1.26 KB,
patch
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2202.3 Safari/537.36 OPR/27.0.1689.2 (Edition developer)
Steps to reproduce:
Compare spec and implementation:
https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send
https://github.com/mozilla/gecko-dev/blob/master/dom/base/nsXMLHttpRequest.cpp#L2399
Actual results:
The spec says to unconditionally use UTF-8 while Gecko uses doc->GetDocumentCharacterSet().
Expected results:
Always send as UTF-8. Blink does this, but doesn't include ";charset=UTF-8" in the Content-Type header yet.
Reporter | ||
Comment 1•10 years ago
|
||
Some ad-hoc testing shows that IE appends "; charset=utf-8" which isn't exactly what the spec says, but perhaps close enough.
Reporter | ||
Comment 2•10 years ago
|
||
I just added the ";charset=UTF-8" in Blink:
https://codereview.chromium.org/791783002/
It probably makes sense to make both changes together in Gecko.
Comment 3•10 years ago
|
||
I'm told this is tested by web-platform-tests/XMLHttpRequest/send-entity-body-document.htm.
![]() |
||
Updated•10 years ago
|
Mentor: bzbarsky
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: [lang=c++]
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → jichen
Assignee | ||
Comment 4•10 years ago
|
||
I avoided using DocumentCharacterSet encoding, and unconditionally set encoding to `UTF-8` as the spec stated.
Assignee | ||
Comment 5•10 years ago
|
||
v1 - mochitest test case patch
I updated the test case to match the spec.
Assignee | ||
Updated•10 years ago
|
Attachment #8537151 -
Flags: review?(bugs)
Assignee | ||
Updated•10 years ago
|
Attachment #8537666 -
Flags: review?(bugs)
Comment 6•10 years ago
|
||
Comment on attachment 8537151 [details] [diff] [review]
v1 - Unconditionally use UTF-8 as default Charset
could you fix the comment below
" // Serialize to a stream so that the encoding used will
// match the document's."
I guess you could just remove it.
This is a bit risky change, but let's try.
Attachment #8537151 -
Flags: review?(bugs) → review+
Updated•10 years ago
|
Attachment #8537666 -
Flags: review?(bugs) → review+
Comment 7•10 years ago
|
||
(There has been changes like bug 361934 long ago)
Assignee | ||
Comment 8•10 years ago
|
||
Unnecessary code comments have been removed.
please see the try server result here:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=54d05a5c12e1
Attachment #8537151 -
Attachment is obsolete: true
Attachment #8537666 -
Attachment is obsolete: true
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Updated•10 years ago
|
Keywords: checkin-needed
Assignee | ||
Comment 9•10 years ago
|
||
Unnecessary code comments have been removed.
please see the try server result here:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=54d05a5c12e1
Attachment #8538315 -
Attachment is obsolete: true
Assignee | ||
Updated•10 years ago
|
Attachment #8537666 -
Attachment is obsolete: false
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 10•10 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/89659f3f1dcf
https://hg.mozilla.org/integration/mozilla-inbound/rev/dbd205a100a9
Flags: in-testsuite+
Keywords: checkin-needed
Comment 11•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/89659f3f1dcf
https://hg.mozilla.org/mozilla-central/rev/dbd205a100a9
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
Comment 12•10 years ago
|
||
Keywords: dev-doc-complete,
site-compat
You need to log in
before you can comment on or make changes to this bug.
Description
•