pythonlib: [Rollback] Disable WebGL by default #90 0.4.3

Disables WebGL by default until a fix is available.
This commit is contained in:
daijro 2024-11-22 11:13:43 -06:00
parent 01aff40fc5
commit 145b737069
3 changed files with 16 additions and 9 deletions

View file

@ -456,6 +456,10 @@ def launch_options(
# Convert executable path to a Path object
executable_path = Path(abspath(executable_path))
# Block WebGL by default until a fix is avaliable.
if block_webgl is None:
block_webgl = True
# Handle virtual display
if virtual_display:
env['DISPLAY'] = virtual_display
@ -560,17 +564,20 @@ def launch_options(
if block_webrtc:
firefox_user_prefs['media.peerconnection.enabled'] = False
# Add back allow_webgl for compatibility
if block_webgl or not launch_options.pop('allow_webgl', True):
# Allow allow_webgl parameter for backwards compatibility
if block_webgl and not launch_options.pop('allow_webgl', False):
firefox_user_prefs['webgl.disabled'] = True
else:
# ROLLBACK: WebGL injection causing crashing on some devices.
"""
# Warn the user about WebGL
if not i_know_what_im_doing:
print(
'NOTICE: WebGL is known to cause crashing or behave unexpectedly.'
'A fix will be avaliable soon.'
)
# If the user has provided a specific WebGL vendor/renderer pair, use it
if webgl_config:
merge_into(config, sample_webgl(target_os, *webgl_config))
else:
merge_into(config, sample_webgl(target_os))
"""
# Use software rendering to be less unique
merge_into(

View file

@ -51,7 +51,7 @@ def sample_webgl(
if result[3] <= 0: # Check OS-specific probability
raise ValueError(
f'Vendor "{vendor}" and renderer "{renderer}" combination not valid for {os}'
f'Vendor "{vendor}" and renderer "{renderer}" combination not valid for {os.title()}.'
)
return {

View file

@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "camoufox"
version = "0.4.2"
version = "0.4.3"
description = "Wrapper around Playwright to help launch Camoufox"
authors = ["daijro <daijro.dev@gmail.com>"]
license = "MIT"