tor-browser

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

test_webgl_renderer_constant_fpp.html (1506B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>WebGL Renderer Constant with FPP - Renderer should be "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 WebGLRendererConstant
     10  await SpecialPowers.pushPrefEnv({
     11    set: [
     12      ["privacy.fingerprintingProtection", true],
     13      ["privacy.fingerprintingProtection.overrides", "+WebGLRendererConstant"],
     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 WebGLRendererConstant enabled, the renderer should be "Mozilla"
     41  let renderer = gl.getParameter(ext.UNMASKED_RENDERER_WEBGL);
     42 
     43  SimpleTest.is(renderer, "Mozilla",
     44    "UNMASKED_RENDERER_WEBGL should be 'Mozilla' with WebGLRendererConstant enabled");
     45 
     46  SimpleTest.finish();
     47 });
     48 </script>