tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

inheritance-bogus-meta.html (1552B)


      1 <!doctype html>
      2 <meta charset=windows-1253>
      3 <title>Inheriting from windows-1253 parent</title>
      4 <script src=/resources/testharness.js></script>
      5 <script src=/resources/testharnessreport.js></script>
      6 <script src=/common/get-host-info.sub.js></script>
      7 <div id=log></div>
      8 <script>
      9 [
     10  {
     11    "title": "Child with bogus <meta charset>",
     12    "url": "resources/bogus-charset.html",
     13    "expected": "�\n" // 0x00A2 in windows-1252 is at the same position as 0x0386 in windows-1253
     14  },
     15  {
     16    "title": "Child with bogus Content-Type charset",
     17    "url": "resources/bogus-charset-http.py",
     18    "expected": "�\n"
     19  },
     20  {
     21    "title": "Child with bogus Content-Type charset, but valid <meta charset>",
     22    "url": "resources/bogus-charset-http-valid-meta.py",
     23    "expected": "\u045E\n"
     24  }
     25 ].forEach(({ title, url, expected }) => {
     26  async_test(t => {
     27    const frame = document.createElement("iframe");
     28    t.add_cleanup(() => frame.remove());
     29    frame.src = url;
     30    frame.onload = t.step_func_done(() => {
     31      assert_equals(frame.contentDocument.body.textContent, expected);
     32    });
     33    document.body.append(frame);
     34  }, title);
     35 });
     36 
     37 async_test(t => {
     38  self.onmessage = t.step_func_done(({ data }) => {
     39    assert_equals(data, "\u00A2\n");
     40  });
     41  const frame = document.createElement("iframe");
     42  t.add_cleanup(() => frame.remove());
     43  frame.src = get_host_info().HTTP_REMOTE_ORIGIN + new URL("resources/bogus-charset.html", location).pathname + "?postMessage";
     44  document.body.append(frame);
     45 }, "Cross-origin child with bogus <meta charset>");
     46 </script>