tor-browser

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

test_rfp_clamp_limits_off.html (1235B)


      1 <!doctype html>
      2 <html>
      3  <head>
      4    <meta charset="utf-8" />
      5    <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6    <link rel="stylesheet" href="/tests/SimpleTest/test.css" />
      7  </head>
      8  <body>
      9    <script>
     10      ok(
     11        SpecialPowers.getBoolPref("dom.webgpu.enabled"),
     12        "Pref should be enabled."
     13      );
     14 
     15      const func = async function () {
     16        const adapter = await navigator.gpu.requestAdapter();
     17        const device = await adapter.requestDevice();
     18 
     19        const limitKeys = Object.keys(device.limits.__proto__).filter(
     20          key => !["constructor"].includes(key)
     21        );
     22        const adapterLimits = limitKeys.map(key => adapter.limits[key]);
     23        const deviceLimits = limitKeys.map(key => device.limits[key]);
     24 
     25        for (let i = 0; i < limitKeys.length; i++) {
     26          if (adapterLimits[i] !== deviceLimits[i]) {
     27            ok(true, "Adapter and device limits are different");
     28            return;
     29          }
     30        }
     31        ok(false, "Adapter and device limits are the same");
     32      };
     33 
     34      SimpleTest.waitForExplicitFinish();
     35      func()
     36        .catch(e => ok(false, "Unhandled exception " + e))
     37        .finally(() => SimpleTest.finish());
     38    </script>
     39  </body>
     40 </html>