tor-browser

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

test_webgl_constant_vendor_fpp.html (1497B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>WebGL Constant Vendor with FPP - Vendor should be constant "Mozilla"</title>
      4 <script src="/tests/SimpleTest/SimpleTest.js"></script>
      5 <script>
      6 /* global SimpleTest SpecialPowers */
      7 SimpleTest.waitForExplicitFinish();
      8 document.addEventListener("DOMContentLoaded", async function() {
      9  // Enable FPP with WebGLVendorConstant
     10  await SpecialPowers.pushPrefEnv({
     11    set: [
     12      ["privacy.fingerprintingProtection", true],
     13      ["privacy.fingerprintingProtection.overrides", "+WebGLVendorConstant"],
     14      ["privacy.resistFingerprinting", false]
     15    ]
     16  });
     17 
     18  let canvas = document.body.appendChild(document.createElement("canvas"));
     19  if (!canvas) {
     20    SimpleTest.ok(false, "Cannot create canvas");
     21    SimpleTest.finish();
     22    return;
     23  }
     24 
     25  let gl = canvas.getContext("webgl");
     26  if (!gl) {
     27    SimpleTest.ok(false, "Cannot get WebGL context");
     28    SimpleTest.finish();
     29    return;
     30  }
     31 
     32  // Try to get the WEBGL_debug_renderer_info extension
     33  let ext = gl.getExtension("WEBGL_debug_renderer_info");
     34  if (!ext) {
     35    SimpleTest.ok(false, "WEBGL_debug_renderer_info extension should be available with FPP");
     36    SimpleTest.finish();
     37    return;
     38  }
     39 
     40  // With FPP and WebGLVendorConstant enabled, the vendor should be "Mozilla"
     41  let vendor = gl.getParameter(ext.UNMASKED_VENDOR_WEBGL);
     42  SimpleTest.is(vendor, "Mozilla", "UNMASKED_VENDOR_WEBGL should be constant 'Mozilla' with WebGLVendorConstant enabled");
     43 
     44  SimpleTest.finish();
     45 });
     46 </script>