tor-browser

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

image.html (1263B)


      1 <script src=/resources/testharness.js></script>
      2 <script src=/resources/testharnessreport.js></script>
      3 <div id=log></div>
      4 <script>
      5  // Note: images get always sniffed, nosniff doesn't do anything
      6  // (but note the tentative Cross-Origin Read Blocking (CORB) tests
      7  // - for example wpt/fetch/corb/img-mime-types-coverage.tentative.sub.html).
      8  var passes = [
      9      // Empty or non-sensical MIME types
     10      null, "", "x", "x/x",
     11 
     12      // Image MIME types
     13      "image/gif", "image/png", "image/png;blah", "image/svg+xml",
     14 
     15      // CORB-protected MIME types (but note that CORB doesn't apply here,
     16      // because CORB ignores same-origin requests).
     17      "text/html", "application/xml", "application/blah+xml"
     18  ]
     19 
     20  const get_url = (mime) => {
     21    let url = "resources/image.py"
     22    if (mime != null) {
     23        url += "?type=" + encodeURIComponent(mime)
     24    }
     25    return url
     26  }
     27 
     28  passes.forEach(function(mime) {
     29    async_test(function(t) {
     30      var img = document.createElement("img")
     31      img.onerror = t.unreached_func("Unexpected error event")
     32      img.onload = t.step_func_done(function(){
     33        assert_equals(img.width, 96)
     34      })
     35      img.src = get_url(mime)
     36      document.body.appendChild(img)
     37    }, "URL query: " + mime)
     38  })
     39 </script>