tor-browser

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

eucjp-decode-errors.html (3418B)


      1 <!DOCTYPE html>
      2 <html lang="en-GB">
      3 <head>
      4 <meta charset="utf-8"/>
      5 <title>EUC-JP decoding errors</title>
      6 <meta name="timeout" content="long">
      7 <script src="/resources/testharness.js"></script>
      8 <script src="/resources/testharnessreport.js"></script>
      9 <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org">
     10 <link rel="help" href="https://encoding.spec.whatwg.org/#euc-jp">
     11 <meta name="assert" content="The browser decodes characters that are not recognised from the euc-jp encoding as replacement characters.">
     12 <style>
     13 iframe { display:none }
     14 form { display:none }
     15 </style>
     16 </head>
     17 
     18 <body onload="showNodes();">
     19 
     20 <iframe src="eucjp_errors.html" name="scriptWindow" id="scrwin"></iframe>
     21 
     22 <div id="log"></div>
     23 
     24 <script>
     25 var tests = [];
     26 
     27 function iframeRef(frameRef) {
     28    return frameRef.contentWindow
     29        ? frameRef.contentWindow.document
     30        : frameRef.contentDocument;
     31 }
     32 
     33 function showNodes() {
     34    var iframe = iframeRef(document.getElementById("scrwin"));
     35    nodes = iframe.querySelectorAll("span");
     36 
     37    t = -1;
     38    t++;
     39    tests[t] = async_test("lead not 0x00 and no more bytes: B0");
     40    t++;
     41    tests[t] = async_test("lead not 0x00 and no more bytes: B0 B5 B0");
     42    t++;
     43    tests[t] = async_test("lead not 0x00 and no more bytes: B0 B0 B0");
     44 
     45    t++;
     46    tests[t] = async_test(
     47        "lead byte outside 0x8E, 0x8F, or the range 0xA1 to 0xFE: FF"
     48    );
     49    t++;
     50    tests[t] = async_test(
     51        "lead byte outside 0x8E, 0x8F, or the range 0xA1 to 0xFE: B0 B5 FF"
     52    );
     53    t++;
     54    tests[t] = async_test(
     55        "lead byte outside 0x8E, 0x8F, or the range 0xA1 to 0xFE: 91"
     56    );
     57    t++;
     58    tests[t] = async_test(
     59        "lead byte outside 0x8E, 0x8F, or the range 0xA1 to 0xFE: B0 B5 91"
     60    );
     61 
     62    t++;
     63    tests[t] = async_test("trail byte outside 0xA1-0xFE: B0 31");
     64    t++;
     65    tests[t] = async_test("trail byte outside 0xA1-0xFE: B0 FF");
     66    t++;
     67    tests[t] = async_test("trail byte outside 0xA1-0xFE: B0 A0");
     68 
     69    t++;
     70    tests[t] = async_test("pointer is null: A2 B9");
     71 
     72    t = -1;
     73    t++;
     74    tests[t].step(function() {
     75        assert_equals(nodes[0].textContent, "�");
     76    });
     77    tests[t].done();
     78    t++;
     79    tests[t].step(function() {
     80        assert_equals(nodes[1].textContent, "圧�");
     81    });
     82    tests[t].done();
     83    t++;
     84    tests[t].step(function() {
     85        assert_equals(nodes[2].textContent, "旭�");
     86    });
     87    tests[t].done();
     88    t++;
     89    tests[t].step(function() {
     90        assert_equals(nodes[3].textContent, "�");
     91    });
     92    tests[t].done();
     93    t++;
     94    tests[t].step(function() {
     95        assert_equals(nodes[4].textContent, "圧�");
     96    });
     97    tests[t].done();
     98    t++;
     99    tests[t].step(function() {
    100        assert_equals(nodes[5].textContent, "�");
    101    });
    102    tests[t].done();
    103    t++;
    104    tests[t].step(function() {
    105        assert_equals(nodes[6].textContent, "圧�");
    106    });
    107    tests[t].done();
    108    t++;
    109    tests[t].step(function() {
    110        assert_equals(nodes[7].textContent, "�1");
    111    });
    112    tests[t].done();
    113    t++;
    114    tests[t].step(function() {
    115        assert_equals(nodes[8].textContent, "�");
    116    });
    117    tests[t].done();
    118    t++;
    119    tests[t].step(function() {
    120        assert_equals(nodes[9].textContent, "�");
    121    });
    122    tests[t].done();
    123    t++;
    124    tests[t].step(function() {
    125        assert_equals(nodes[10].textContent, "�");
    126    });
    127    tests[t].done();
    128 }
    129 </script>
    130 </body>
    131 </html>