Files
brave-core/test
r0hit0303 483a4fbd26 [farbling] Add WebGLExtensionHandler to handle extensions related calls (#36762)
This change adds a dedicated `WebGLExtensionHandler` handler to handle farbling around WebGL's `getSupportedExtensions` and `getExtension` calls. The  handler is instantiated taking into account different levels of fingerprinting protections as follows:

#### 1) Balanced fingerprinting protections:
  - [WebGLBalancedFingerprintingProtection](https://sourcegraph.com/r/github.com/brave/brave-core/-/blob/chromium_src/third_party/blink/common/features.cc?L63) **enabled**:  calls to `getSupportedExtensions` will injects a fake extension to the list and will keep this new list consistent till the lifetime of that handler. Calls to getExtension on the fake extension would return a fake `ScriptObject` with the name of the fake extension in CamelCase.
  - [WebGLBalancedFingerprintingProtection](https://sourcegraph.com/r/github.com/brave/brave-core/-/blob/chromium_src/third_party/blink/common/features.cc?L63) **disabled**: No change in behaviour i.e we don't farble and return the true list of supported extensions. 
  
 #### 2) Maximum fingerprinting protections:
 - No change in behaviour i.e we continue to return a single entry for the getSupportedExtensions call viz. WEBGL_debug_renderer_info. 
 
 #### 3) No fingerprinting protections:
 - No change in behaviour. We return the true list of supported extensions. 

Please note that this is part of the change from the bigger [PR](https://github.com/brave/brave-core/pull/36605). The `WebGLExtensionHandler` would later be created by [BraveSessionCache](https://sourcegraph.com/r/github.com/brave/brave-core/-/blob/third_party/blink/renderer/core/farbling/brave_session_cache.h). This integration with `BraveSessionCache` and then with `WebGLRenderingContextBase` would be followed in later CLs.  

This change also adds unit_tests for the same. Browser tests would be followed up later once we have the full integration complete. 

<!-- Add brave-browser issue below that this PR will resolve -->
Related https://github.com/brave/brave-browser/issues/55858
2026-05-28 12:40:28 +01:00
..