tor-browser

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

sec-ch-width.https.html (876B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <meta http-equiv="Delegate-CH" content="Sec-CH-Width">
      4 <title>Tests Sec-CH-Width</title>
      5 <link rel="help" href="https://wicg.github.io/responsive-image-client-hints/#sec-ch-width">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 
      9 <script>
     10  setup({explicit_done: true});
     11 
     12  function run() {
     13    test(() => {
     14      const testImage = document.getElementsByTagName('img')[0];
     15      // Spec: sec-ch-width MUST be an integer greater than or equal to 0.
     16      const width = Math.ceil(0.10 * innerWidth * devicePixelRatio);
     17      assert_equals(testImage.naturalWidth, 2 * width);
     18      assert_equals(testImage.naturalHeight, 3 * width);
     19    }, 'Sec-CH-Width should be set');
     20    done();
     21  }
     22 </script>
     23 
     24 <img onload="run()" src="resources/2x3-svg-scaled-by-sec-ch-width.py" sizes="10vw">