Bug 1646879 [wpt PR 24244] - [FileAPI] Properly set charset when loading blob URL., a=testonly
authorMarijn Kruisselbrink <mek@chromium.org>
Mon, 22 Jun 2020 10:44:38 +0000
changeset 600935 7bdb48de0eaee90fe970078b5c28f4fe413f7297
parent 600934 f4c08ad7631b1da1a7315e05e371ee975c374ba1
child 600936 28cfa6865c05bc6e48070f45e4c1ce0d9f8c46c3
push id13310
push userffxbld-merge
push dateMon, 29 Jun 2020 14:50:06 +0000
treeherdermozilla-beta@15a59a0afa5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1646879, 24244, 1086845, 2253242, 780118
milestone79.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1646879 [wpt PR 24244] - [FileAPI] Properly set charset when loading blob URL., a=testonly Automatic update from web-platform-tests [FileAPI] Properly set charset when loading blob URL. Bug: 1086845 Change-Id: I1630dcff89198ea968ff49ff353d793ae19c10b3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2253242 Commit-Queue: Marijn Kruisselbrink <mek@chromium.org> Reviewed-by: Mason Freed <masonfreed@chromium.org> Cr-Commit-Position: refs/heads/master@{#780118} -- wpt-commits: 80a7c1baefc0eacfb045a0d6cb35befbc7b54c66 wpt-pr: 24244
testing/web-platform/tests/FileAPI/url/url-charset.window.js
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/FileAPI/url/url-charset.window.js
@@ -0,0 +1,27 @@
+async_test(t => {
+  const blob = new Blob(
+      [
+        `aaa\u001B$@<textarea>\u001B(B<script>/* xss */<\/script></textarea>bbb`
+      ],
+      {type: 'text/html;charset=utf-8'});
+  const url = URL.createObjectURL(blob);
+  const win = window.open(url);
+  t.add_cleanup(() => win.close());
+
+  win.onload = t.step_func_done(() => {
+    assert_equals(win.document.charset, 'UTF-8');
+  });
+}, 'Blob charset should override any auto-detected charset.');
+
+async_test(t => {
+  const blob = new Blob(
+      [`<!doctype html>\n<meta charset="ISO-8859-1">`],
+      {type: 'text/html;charset=utf-8'});
+  const url = URL.createObjectURL(blob);
+  const win = window.open(url);
+  t.add_cleanup(() => win.close());
+
+  win.onload = t.step_func_done(() => {
+    assert_equals(win.document.charset, 'UTF-8');
+  });
+}, 'Blob charset should override <meta charset>.');