tor-browser

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

decode-common.js (1183B)


      1 var tests = [];
      2 
      3 function iframeRef(frameRef) {
      4    return frameRef.contentWindow
      5        ? frameRef.contentWindow.document
      6        : frameRef.contentDocument;
      7 }
      8 
      9 function showNodes(decoder) {
     10    var iframe = iframeRef(document.getElementById("scrwin"));
     11    nodes = iframe.querySelectorAll("span");
     12 
     13    for (var i = 0; i < nodes.length; i++) {
     14        var test = subsetTest(async_test,
     15                              "U+" +
     16                              nodes[i].dataset.cp +
     17                              " " +
     18                              String.fromCodePoint(parseInt(nodes[i].dataset.cp, 16)) +
     19                              " " +
     20                              decoder(nodes[i].dataset.bytes) +
     21                              " " +
     22                              nodes[i].dataset.bytes
     23        );
     24        if (test) {
     25            tests[i] = test;
     26        }
     27    }
     28 
     29    for (var i = 0; i < nodes.length; i++) {
     30        if (tests[i]) {
     31            tests[i].step(function() {
     32                assert_equals(
     33                    nodes[i].textContent,
     34                    decoder(nodes[i].dataset.bytes)
     35                );
     36            });
     37            tests[i].done();
     38        }
     39    }
     40 }