XMLHttpRequest has the wrong fallback encoding
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Apr 2019 10:11:12 +0000 (10:11 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Apr 2019 10:11:12 +0000 (10:11 +0000)
commitcfc9b0703870012e8fd7b83af76a48c1295decc4
tree0c48a6b905bd0ee27ad0b702958cddca711e0b7a
parent305fd7d3d17a707408554ba7455fa7780950fbbe
XMLHttpRequest has the wrong fallback encoding
https://bugs.webkit.org/show_bug.cgi?id=191741

Patch by Rob Buis <rbuis@igalia.com> on 2019-04-17
Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Update improved test expectations and sync unsupported-encodings.any.js and
replacement-encodings.any.js tests.

* web-platform-tests/encoding/replacement-encodings.any-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/encoding/replacement-encodings-expected.txt.
* web-platform-tests/encoding/replacement-encodings.any.html: Added.
* web-platform-tests/encoding/replacement-encodings.any.js: Renamed from LayoutTests/imported/w3c/web-platform-tests/encoding/replacement-encodings.html.
* web-platform-tests/encoding/replacement-encodings.any.worker-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/encoding/replacement-encodings-expected.txt.
* web-platform-tests/encoding/replacement-encodings.any.worker.html: Added.
* web-platform-tests/encoding/unsupported-encodings-expected.txt: Removed.
* web-platform-tests/encoding/unsupported-encodings.any-expected.txt: Added.
* web-platform-tests/encoding/unsupported-encodings.any.html: Added.
* web-platform-tests/encoding/unsupported-encodings.any.js: Added.
* web-platform-tests/encoding/unsupported-encodings.any.worker-expected.txt: Added.
* web-platform-tests/encoding/unsupported-encodings.any.worker.html: Added.
* web-platform-tests/encoding/unsupported-encodings.html: Removed.
* web-platform-tests/xhr/overridemimetype-edge-cases.window-expected.txt:
* web-platform-tests/xhr/responsetext-decoding-expected.txt:

Source/WebCore:

Allow overriding the response charset as specified here:
https://xhr.spec.whatwg.org/#final-charset

Behavior matches Firefox and Chrome.

Tests: imported/w3c/web-platform-tests/encoding/replacement-encodings.any.html
       imported/w3c/web-platform-tests/encoding/replacement-encodings.any.worker.html
       imported/w3c/web-platform-tests/encoding/unsupported-encodings.any.html
       imported/w3c/web-platform-tests/encoding/unsupported-encodings.any.worker.html

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::finalResponseCharset const):
(WebCore::XMLHttpRequest::createDecoder const):
* xml/XMLHttpRequest.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244377 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/encoding/replacement-encodings.any-expected.txt [moved from LayoutTests/imported/w3c/web-platform-tests/encoding/replacement-encodings-expected.txt with 97% similarity]
LayoutTests/imported/w3c/web-platform-tests/encoding/replacement-encodings.any.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/encoding/replacement-encodings.any.js [moved from LayoutTests/imported/w3c/web-platform-tests/encoding/replacement-encodings.html with 66% similarity]
LayoutTests/imported/w3c/web-platform-tests/encoding/replacement-encodings.any.worker-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/encoding/replacement-encodings.any.worker.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/encoding/unsupported-encodings-expected.txt [deleted file]
LayoutTests/imported/w3c/web-platform-tests/encoding/unsupported-encodings.any-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/encoding/unsupported-encodings.any.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/encoding/unsupported-encodings.any.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/encoding/unsupported-encodings.any.worker-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/encoding/unsupported-encodings.any.worker.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/encoding/unsupported-encodings.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/xhr/overridemimetype-edge-cases.window-expected.txt
LayoutTests/imported/w3c/web-platform-tests/xhr/responsetext-decoding-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/xml/XMLHttpRequest.cpp
Source/WebCore/xml/XMLHttpRequest.h