Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/bom.html

Issue 1470893002: [Fetch] Always use utf-8 for decoding in text() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reflect comments. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!doctype html>
2 <script src="/js-test-resources/js-test.js"></script>
3 <script>
4 window.jsTestIsAsync = true;
5 description('BOM can override the encoding when decoding the response in ' +
6 'responseText.');
7
8 xhr = new XMLHttpRequest;
9 xhr.open('GET', 'resources/bom-utf-8.php');
10 xhr.onreadystatechange = function() {
11 if (xhr.readyState != xhr.DONE) { return; }
12 // A string with utf-8 BOM is decoded as utf-8.
13 shouldBeEqualToString('xhr.responseText',
14 '\u4e09\u6751\u304b\u306a\u5b50');
15 xhr2 = new XMLHttpRequest;
16 xhr2.open('GET', 'resources/bom-utf-16be.php');
17 xhr2.onreadystatechange = function() {
18 if (xhr2.readyState != xhr2.DONE) { return; }
19 // A string with utf-16be BOM is decoded as utf-16be.
20 shouldBeEqualToString('xhr2.responseText',
21 '\u4e09\u6751\u304b\u306a\u5b50');
22 xhr3 = new XMLHttpRequest;
23 xhr3.open('GET', 'resources/bom-utf-16le.php');
24 xhr3.onreadystatechange = function() {
25 if (xhr3.readyState != xhr3.DONE) { return; }
26 // A string with utf-16le BOM is decoded as utf-16le.
27 shouldBeEqualToString('xhr3.responseText',
28 '\u4e09\u6751\u304b\u306a\u5b50');
29 finishJSTest();
30 };
31 xhr3.send();
32 };
33 xhr2.send();
34 };
35 xhr.send();
36 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698