test_webgl_renderer_constant_fpp_explicit.html (1620B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>WebGL Renderer Constant with FPP (explicit) - 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 explicit -AllTargets,+WebGLRendererConstant 10 // This ensures only WebGLRendererConstant is active, nothing else 11 await SpecialPowers.pushPrefEnv({ 12 set: [ 13 ["privacy.fingerprintingProtection", true], 14 ["privacy.fingerprintingProtection.overrides", "-AllTargets,+WebGLRendererConstant"], 15 ["privacy.resistFingerprinting", false] 16 ] 17 }); 18 19 let canvas = document.body.appendChild(document.createElement("canvas")); 20 if (!canvas) { 21 SimpleTest.ok(false, "Cannot create canvas"); 22 SimpleTest.finish(); 23 return; 24 } 25 26 let gl = canvas.getContext("webgl"); 27 if (!gl) { 28 SimpleTest.ok(false, "Cannot get WebGL context"); 29 SimpleTest.finish(); 30 return; 31 } 32 33 // Try to get the WEBGL_debug_renderer_info extension 34 let ext = gl.getExtension("WEBGL_debug_renderer_info"); 35 if (!ext) { 36 SimpleTest.ok(false, "WEBGL_debug_renderer_info extension should be available with FPP"); 37 SimpleTest.finish(); 38 return; 39 } 40 41 // With FPP and WebGLRendererConstant enabled, the renderer should be "Mozilla" 42 let renderer = gl.getParameter(ext.UNMASKED_RENDERER_WEBGL); 43 44 SimpleTest.is(renderer, "Mozilla", 45 "UNMASKED_RENDERER_WEBGL should be 'Mozilla' with WebGLRendererConstant enabled"); 46 47 SimpleTest.finish(); 48 }); 49 </script>