mirror of
https://github.com/daijro/camoufox.git
synced 2026-11-19 00:07:28 +00:00
* Pin Firefox 157.0 Camoufox beta.33 is built on Firefox 157.0 (was 156.0.1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * e2e: expect exactly the identity's input kinds from enumerateDevices() The probe asserted a non-empty pre-grant device list. Stock Firefox lists one entry per input kind the machine has and no outputs, so a speaker-only identity (about 6% of Windows draws) correctly lists nothing. Firefox 157.0's UA bump re-seeded the Windows preset onto such a machine, and 156.0.1 returns the same empty list for it. Compare against the kinds the config claims instead: it still fails on an empty list for a mic/camera identity, and it now also catches a wrong or missing kind, a host device leaking through, or an enumerateDevices() error. Gate-Change: Firefox 157.0's version in the UA re-seeds the Windows preset's media-device draw (pythonlib fingerprints.py from_preset -> identity_seed); verified the same empty list on 156.0.1-beta.32 and 157.0 for the no-mic/no-camera identity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep independent window placement with the WM, which Firefox 157 stopped doing Firefox 157 landed bug 2070008, which deleted the Unix special case in AppWindow::SizeShell(): bool positionSet = !mIgnoreXULPosition; #if defined(XP_UNIX) && !defined(XP_MACOSX) // don't override WM placement on unix for independent, top-level windows if (!parentWindow) positionSet = false; #endif so a top-level window now takes the position persisted in the profile's XUL store instead of leaving placement to the window manager. That makes window.screenX/screenY a function of leftover profile state, and a page can read it. Measured on this branch before the fix, same identity, same Xvfb: throwaway profile screenX 4 screenY 4 persistent profile screenX 26 screenY 0 v156.0.1-beta.32 reports 0/0 for both, so the two session types were indistinguishable and are no longer. fingerprint-injection.patch only answers GetScreenX/GetScreenY from the config when window.screenX is set, and the launcher does not draw it for every identity, so the real position shows through whenever it is absent. A position that varies with profile type correlates a user's fresh and persistent sessions, and it moves the browser rect MouseDispatch.js measures (docs/input-dispatch.md). Nobody places an automation browser's window by hand, so there is no UX here to gain and determinism to lose. Restores the guard for independent windows only; dependent windows are still placed relative to their parent, as upstream intended before and after. Both profile types report 0/0 again. Caught by typescript/tests/e2e.test.ts:506 in CI, which asserts a persistent profile presents the same device as a throwaway one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * Pin Firefox 157.0.1 Camoufox beta.33 is built on Firefox 157.0.1 (was 157.0). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Pin Firefox 158.0 Camoufox beta.33 is built on Firefox 158.0 (was 157.0.1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Port the Playwright bootstrap patch to Firefox 158 Firefox 158 moved the code under six hunks: - Bug 2072511 replaced HeadlessWidget::mCompositorWidget with a generic CompositorWidgetDelegate so the compositor can live in the GPU process. The screencast snapshot listener now reaches the in-process HeadlessCompositorWidget through AsHeadlessCompositorWidget(). - Bug 2071024 added movementX/movementY to SynthesizeMouseEventData and changed the mMovement coalescing check; jugglerEventId and the drag event synthesis sit beside the new code. - Bug 1688932 took bit 25 of nsIWebBrowserChrome's chrome flags for CHROME_MEDIA_PIP. JUGGLER_WINDOW_EXPLICIT_SIZE keeps bit 26, the last free one. - Bug 2070965 made UserAgentOverride an nsCString, which moved the context of the BrowsingContext field-namespace hunk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refresh camoufox-window-module.patch context for Firefox 158 Bug 2070772 removed PartnerLinkAttribution.sys.mjs from browser/modules, so the module list hunk applied only with fuzz. The change is the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Port config.patch to Firefox 158's top-level moz.build Bug 2070828 appended the SBOM GeneratedFile block to the end of the top-level moz.build, where config.patch adds the lw directory. The lw directory is still appended last. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Port the worker userAgent override to Firefox 158's nsCString Bug 2070965 made WorkerNavigator::GetUserAgent take an nsCString, so the navigator.userAgent override assigns the UTF-8 config value directly instead of converting it to UTF-16. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Port font-hijacker.patch to Firefox 158's gfx/thebes/moz.build Bug 2070824 appended license declarations to gfx/thebes/moz.build after the line the camoucfg include followed. The include is still appended at the end of the file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Port the network geolocation override to Firefox 158 Bug 2060572 moved the request's logging into the try block and made it throw first when geo.provider.network.url is unset. The CAMOU_CONFIG coordinates are now chosen before that check, so a configured location is reported without depending on the provider URL, as on Firefox 156. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Port the per-context userAgent to Firefox 158's nsACString getters Bug 2070965 made Navigator::GetUserAgent and WorkerNavigator::GetUserAgent return UTF-8 and collapsed the window's custom user agent lookup. The per-context value is still checked first in both getters and is converted from the UTF-16 it is stored as. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refresh screen-spoofing.patch context for Firefox 158 nsRFPService::GetSpoofedStorageLimit, next to the declaration the patch changes, now returns int64_t, so the hunk applied only with fuzz. The change is the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refresh sessionstore-popup-close-crash.patch context for Firefox 158 Firefox 158 documented SessionStore.maybeDontRestoreTabs with a JSDoc block, so the guard applied only with fuzz. The guard is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Port webrtc-ip-spoofing.patch's include to Firefox 158 Bug 2072208 removed NS_PRINTING and the nsIPrintSettings.h include that followed xpcpublic.h in nsGlobalWindowInner.cpp. WebRTCIPManager.h is still included after xpcpublic.h. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Qualify webgl-spoofing's dom names in ClientWebGLContext.cpp ClientWebGLContext.cpp declares no 'using namespace mozilla::dom'. It compiled on Firefox 157 only because CanvasImageCache.cpp, earlier in the same unified dom/canvas chunk, did. Bug 2048943 removed that directive ahead of renaming nsRange to dom::Range, so the patch now names RoverfoxStorageManager, WorkerPrivate and WebGLParamsManager with their dom:: namespace. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Record Firefox 158.0's content-accessible files and chrome names The contentaccessible-parity guard compares a build against what stock Firefox of the same version exposes to pages, and refuses a manifest recorded from another release. Regenerated with scripts/gen-contentaccessible-manifest.py from the official 158.0 Linux x86_64 build (BuildID 20261007201254). Among the changes, Firefox 158 no longer registers the extra-themes-previews resource host (bug 1990883 removed colorways). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Claim EXT_polygon_offset_clamp where Firefox 158 exposes it Bug 1854003 added EXT_polygon_offset_clamp to WebGL1 and WebGL2 wherever the GL backend clamps polygon offsets (GLFeature::polygon_offset_clamp: GL 4.6, ARB_ or EXT_polygon_offset_clamp). fpgen's records come from Firefox 146, so no identity claimed it, and stock-gpu-parity found stock 158.0 exposing it on this Linux host where Camoufox did not. - Windows: ANGLE's D3D11 backend sets polygonOffsetClampEXT from feature level 10_0 (renderer11_utils.cpp), which WebGL2 needs, so devices with WebGL2 claim it. - Linux: Mesa (radeonsi, llvmpipe on this host, in GL and GLES contexts) and NVIDIA's GL 4.6 driver expose it. Recordings from a desktop GL profile, marked by EXT_depth_clamp (96.6% of Linux records), claim it; the GLES-only records keep what the device reported. - macOS: release builds keep webgl.disable-angle and run WebGL on CGL's GL 4.1, which lacks it. Metal ANGLE is Nightly-only (bug 2072535). Both launchers place it in Firefox's alphabetical extension order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Expect EXT_polygon_offset_clamp from the backends Firefox 158 adds it on The converter and draft-extension tests hard-coded Firefox 156's backend extensions. The GTX 980 Linux fixture's expected lists now include EXT_polygon_offset_clamp in Firefox's order, and the Windows device with WebGL2 expects it beside EXT_depth_clamp; every other assertion is unchanged. A new test derives the expectation for 100 draws per OS from each draw itself: Windows devices with WebGL2, Linux desktop GL recordings, never macOS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Gate-Change: Firefox 158 (bug 1854003) exposes EXT_polygon_offset_clamp where GLFeature::polygon_offset_clamp holds, and ANGLE D3D11 sets it from feature level 10_0; verified in the 158.0 source (dom/canvas/WebGLExtensions.cpp, gfx/gl/GLContextFeatures.cpp, third_party/angle renderer11_utils.cpp) and by stock-gpu-parity against stock 158.0 on this host * Follow Firefox 158's WebSocket frame callbacks in Juggler Bug 1719394 added the HTTP channel ID to nsIWebSocketEventListener.frameReceived and frameSent, ahead of the frame. Juggler's listener still took (serialID, frame), so it read the channel ID as the frame, found no opCode and dropped every frame: Playwright's framereceived and framesent events never fired (test_websocket.py::test_should_emit_frame_events and test_should_reject_wait_for_event_on_close_and_error failed on 158 and pass on 156.0.1). The listener now takes the new argument. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Key Juggler's pending promises by their Debugger.Object Bug 2044184 removed Debugger.Object.promiseID in Firefox 158. Juggler keyed the promises it awaits by it, so every pending promise shared the key undefined: a second awaited evaluate overwrote the first, which then never resolved. Playwright waits that poll in the page (waitForElementState, selectText waiting for visibility) hung whenever another evaluate returning a promise ran meanwhile. The Debugger.Object is unique per promise within the debugger and serves as the key instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep the environment out of forked children's command lines Firefox's setproctitle() marks the end of the old argv space so the kernel shows only the new title, then copies the environment strings right after the title, inside that space. When an environment string's null lands on the marker, the kernel shows the whole space: the title followed by the environment. Whether it does depends only on the length of the install path and of the environment, so it is rare in stock Firefox. The Firefox 158 package at the parity harness's path hit it on the RDD process, whose /proc/PID/cmdline then ended in the launching shell's environment instead of 'rdd'. The marker is set again after the copy; it lies outside /proc/PID/environ, which is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
265 lines
12 KiB
Python
265 lines
12 KiB
Python
"""WebGL identities drawn from fpgen's recorded Firefox devices (camoufox.webgl)."""
|
|
|
|
import json
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
from test_identity_salt import host, launch
|
|
|
|
from camoufox import coherence, utils
|
|
from camoufox import fingerprints as fp
|
|
from camoufox import webgl
|
|
from camoufox.fingerprints import gpu_screen_is_plausible, is_software_renderer
|
|
from camoufox.webgl import sample_webgl_for_screen, webgl_for_gpu
|
|
|
|
PROPERTIES = Path(__file__).resolve().parents[2] / "browser" / "settings" / "properties.json"
|
|
SEEDS = range(300)
|
|
OSES = ("win", "mac", "lin")
|
|
|
|
_GTX_980_LINUX = ("NVIDIA Corporation", "NVIDIA GeForce GTX 980, or similar")
|
|
_BASIC_RENDER_DRIVER = (
|
|
"Google Inc. (Microsoft)",
|
|
"ANGLE (Microsoft, Microsoft Basic Render Driver Direct3D11 vs_5_0 ps_5_0), or similar",
|
|
)
|
|
|
|
# Limits WebGL1 and WebGL2 read from the same device: MAX_TEXTURE_SIZE,
|
|
# MAX_VIEWPORT_DIMS, MAX_RENDERBUFFER_SIZE, MAX_CUBE_MAP_TEXTURE_SIZE,
|
|
# MAX_VERTEX_ATTRIBS, MAX_TEXTURE_IMAGE_UNITS, MAX_VERTEX_TEXTURE_IMAGE_UNITS,
|
|
# MAX_COMBINED_TEXTURE_IMAGE_UNITS and the three uniform/varying vector limits.
|
|
_SHARED_LIMITS = ("3379", "3386", "34024", "34076", "34921", "34930", "35660", "35661", "36347", "36348", "36349")
|
|
|
|
|
|
def _as_json(value):
|
|
# JSON has one number type: 2**64 stored as an int and as a float is the
|
|
# same value to the browser's parser.
|
|
return json.loads(json.dumps(value), parse_int=float)
|
|
|
|
|
|
def test_converter_reproduces_the_recorded_device():
|
|
"""The fixture is what the retired webgl_data.db gave launch_options for
|
|
this GPU. fpgen records the same device, so everything the browser reads
|
|
must come out identical: parameters are compared where the old row had a
|
|
value, less the UNMASKED_* strings, which the browser takes from
|
|
webGl:vendor/renderer rather than the table. Keys since marked removed
|
|
(contextAttributes) are no longer sent. WebGL1's line width range is
|
|
WebGL2's since Firefox 156 (test_webgl1_line_width_range_is_webgl2s), and
|
|
Firefox 158 adds EXT_polygon_offset_clamp on this desktop GL device
|
|
(test_polygon_offset_clamp_follows_the_backend)."""
|
|
removed = {
|
|
entry["property"]
|
|
for entry in json.loads(PROPERTIES.read_text())
|
|
if "removed" in entry
|
|
}
|
|
old = json.loads((Path(__file__).parent / "data" / "webgl-gtx980-linux.json").read_text())
|
|
old = {key: value for key, value in old.items() if key not in removed}
|
|
old["webGl:parameters"]["33902"] = old["webGl2:parameters"]["33902"]
|
|
for key in ("webGl:supportedExtensions", "webGl2:supportedExtensions"):
|
|
old[key] = sorted([*old[key], "EXT_polygon_offset_clamp"], key=str.casefold)
|
|
new = webgl_for_gpu("lin", *_GTX_980_LINUX, seed=0)
|
|
|
|
assert new.keys() == old.keys()
|
|
for key in old:
|
|
if key.endswith(":parameters"):
|
|
recorded = {
|
|
pname: value
|
|
for pname, value in old[key].items()
|
|
if value is not None and pname not in ("37445", "37446")
|
|
}
|
|
assert _as_json({pname: new[key].get(pname) for pname in recorded}) == _as_json(recorded), key
|
|
else:
|
|
assert new[key] == old[key], key
|
|
|
|
|
|
def test_same_seed_same_device():
|
|
for target_os in OSES:
|
|
for seed in (0, 1, 12345):
|
|
assert sample_webgl_for_screen(target_os, 1920, 1080, seed) == sample_webgl_for_screen(
|
|
target_os, 1920, 1080, seed
|
|
)
|
|
gpu = ("AMD", "Radeon R9 200 Series, or similar")
|
|
assert webgl_for_gpu("lin", *gpu, seed=7) == webgl_for_gpu("lin", *gpu, seed=7)
|
|
|
|
|
|
def test_seed_chooses_among_a_gpus_recorded_devices():
|
|
# fpgen records several Linux R9 200 devices; one seed must not pin them all.
|
|
drawn = {json.dumps(webgl_for_gpu("lin", "AMD", "Radeon R9 200 Series, or similar", seed=s)) for s in range(40)}
|
|
assert len(drawn) > 1
|
|
|
|
|
|
@pytest.mark.parametrize("target_os", OSES)
|
|
def test_synthetic_draw_is_a_hardware_gpu_the_os_reports(target_os):
|
|
renderers = {sample_webgl_for_screen(target_os, 1920, 1080, s)["webGl:renderer"] for s in SEEDS}
|
|
for renderer in renderers:
|
|
assert not is_software_renderer(renderer), renderer
|
|
assert renderer != "Mozilla"
|
|
assert coherence.gpu_fits_os(renderer, target_os), renderer
|
|
# A single GPU per OS is its own tell.
|
|
assert len(renderers) >= 2
|
|
|
|
|
|
@pytest.mark.parametrize("target_os", OSES)
|
|
def test_netbook_screen_never_draws_a_discrete_gpu(target_os):
|
|
for seed in SEEDS:
|
|
renderer = sample_webgl_for_screen(target_os, 1024, 600, seed)["webGl:renderer"]
|
|
assert gpu_screen_is_plausible(renderer, 1024, 600), renderer
|
|
|
|
|
|
def test_no_coherent_gpu_raises(monkeypatch):
|
|
# A pool with nothing that fits is a data defect; substituting a GPU the
|
|
# filters rejected would present exactly what they exist to prevent.
|
|
only_software = tuple(r for r in webgl._trace("gpu", "lin") if is_software_renderer(r.value["renderer"]))
|
|
assert only_software
|
|
monkeypatch.setattr(webgl, "_trace", lambda *a, **kw: only_software)
|
|
with pytest.raises(ValueError, match="No recorded lin GPU"):
|
|
sample_webgl_for_screen("lin", 1920, 1080, seed=0)
|
|
|
|
|
|
@pytest.mark.parametrize("target_os", OSES)
|
|
def test_webgl2_comes_from_the_same_device_as_webgl1(target_os):
|
|
# webgl2 is pinned to the drawn webgl; drawn on the GPU alone, a Linux
|
|
# Intel identity paired MAX_TEXTURE_SIZE 8192 with 16384.
|
|
for seed in SEEDS:
|
|
config = sample_webgl_for_screen(target_os, 1920, 1080, seed)
|
|
for pname in _SHARED_LIMITS:
|
|
assert config["webGl:parameters"][pname] == config["webGl2:parameters"][pname], (seed, pname)
|
|
|
|
|
|
def test_gpu_is_pinned_by_vendor_and_renderer():
|
|
# "Mesa" and "AMD" both report this renderer on Linux. A dict condition on
|
|
# fpgen matches the renderer alone and mixed their devices.
|
|
for seed in range(40):
|
|
assert webgl_for_gpu("lin", "Mesa", "Radeon HD 3200 Graphics, or similar", seed)["webGl:vendor"] == "Mesa"
|
|
|
|
|
|
def test_device_without_webgl2():
|
|
config = webgl_for_gpu("win", *_BASIC_RENDER_DRIVER, seed=0)
|
|
assert config["webGl2Enabled"] is False
|
|
assert not any(key.startswith("webGl2:") for key in config)
|
|
|
|
with host():
|
|
options = utils.launch_options(
|
|
os="windows", webgl_config=_BASIC_RENDER_DRIVER, headless=True, i_know_what_im_doing=True
|
|
)
|
|
assert options["firefox_user_prefs"]["webgl.enable-webgl2"] is False
|
|
|
|
|
|
def test_unknown_webgl_config_raises():
|
|
with pytest.raises(ValueError, match="No recorded WebGL data"):
|
|
launch(os="windows", webgl_config=("Apple", "Apple M1, or similar"))
|
|
|
|
|
|
def test_preset_keeps_its_own_gpu():
|
|
preset = fp.load_presets("152")["presets"]["linux"][0]
|
|
gpu = (preset["webgl"]["unmaskedVendor"], preset["webgl"]["unmaskedRenderer"])
|
|
config = launch(os="linux", fingerprint_preset=preset)
|
|
assert (config["webGl:vendor"], config["webGl:renderer"]) == gpu
|
|
pinned = (webgl._pin("gpu", {"vendor": gpu[0], "renderer": gpu[1]}),)
|
|
recorded = [
|
|
webgl.to_config(w1.value, w2.value, "lin")["webGl:parameters"]
|
|
for w1 in webgl._trace("webgl", "lin", pinned)
|
|
for w2 in webgl._trace("webgl2", "lin", (*pinned, webgl._pin("webgl", w1.value)))
|
|
]
|
|
assert config["webGl:parameters"] in recorded
|
|
|
|
|
|
def test_preset_gpu_fpgen_has_never_seen_raises():
|
|
preset = fp.load_presets("152")["presets"]["windows"][0]
|
|
gpu = "ANGLE (Acme, Acme GPU 9000 Direct3D11 vs_5_0 ps_5_0)"
|
|
preset = {**preset, "webgl": {"unmaskedVendor": "Google Inc. (Acme)", "unmaskedRenderer": gpu}}
|
|
with pytest.raises(ValueError, match="Acme GPU 9000"):
|
|
launch(os="windows", fingerprint_preset=preset)
|
|
|
|
|
|
# -- extensions ---------------------------------------------------------------
|
|
|
|
|
|
def _extensions(target_os, key):
|
|
return [
|
|
set(sample_webgl_for_screen(target_os, 1920, 1080, s).get(key) or ()) for s in range(100)
|
|
]
|
|
|
|
|
|
def test_windows_keeps_ovr_multiview2_on_webgl2():
|
|
assert any("OVR_multiview2" in exts for exts in _extensions("win", "webGl2:supportedExtensions"))
|
|
|
|
|
|
def test_linux_filters_ovr_multiview2():
|
|
# fpgen records it on ~20% of Linux WebGL2 devices.
|
|
assert not any("OVR_multiview2" in exts for exts in _extensions("lin", "webGl2:supportedExtensions"))
|
|
|
|
|
|
def test_draft_extensions_filtered_on_every_os():
|
|
recorded = {
|
|
"vendor": "v",
|
|
"renderer": "r",
|
|
"contextAttributes": {},
|
|
"params": {"33902": {"value": [1, 1]}},
|
|
"shaderPrecisionFormats": [],
|
|
"supportedExtensions": ["ANGLE_instanced_arrays", "WEBGL_multi_draw", "WEBGL_compressed_texture_etc1"],
|
|
}
|
|
webgl2 = {**recorded, "supportedExtensions": ["EXT_texture_norm16", "WEBGL_clip_cull_distance", "OVR_multiview2"]}
|
|
for target_os in OSES:
|
|
config = webgl.to_config(recorded, webgl2, target_os)
|
|
# A device with WebGL2 is D3D11 feature level 10_0 or above, where ANGLE
|
|
# also clamps polygon offsets; the recording carries no desktop GL mark.
|
|
backend = ["EXT_depth_clamp", "EXT_polygon_offset_clamp"] if target_os == "win" else []
|
|
assert config["webGl:supportedExtensions"] == ["ANGLE_instanced_arrays", *backend]
|
|
assert config["webGl2:supportedExtensions"] == (backend + ["OVR_multiview2"] if target_os == "win" else [])
|
|
|
|
|
|
def test_windows_exposes_ext_depth_clamp_on_every_device():
|
|
"""ANGLE's D3D11 backend reports depth clamp on every GPU from Firefox 156;
|
|
fpgen's Windows records come from Firefox 146, which did not."""
|
|
for key in ("webGl:supportedExtensions", "webGl2:supportedExtensions"):
|
|
assert all("EXT_depth_clamp" in exts for exts in _extensions("win", key) if exts), key
|
|
|
|
|
|
def test_polygon_offset_clamp_follows_the_backend():
|
|
"""Firefox 158 exposes EXT_polygon_offset_clamp on ANGLE's D3D11 backend
|
|
from feature level 10_0 (every device with WebGL2) and on Linux desktop GL
|
|
(the recordings with EXT_depth_clamp), never on macOS's GL 4.1; fpgen's
|
|
Firefox 146 records predate it."""
|
|
for target_os in OSES:
|
|
for s in range(100):
|
|
config = sample_webgl_for_screen(target_os, 1920, 1080, s)
|
|
desktop_gl = "EXT_depth_clamp" in config["webGl:supportedExtensions"]
|
|
want = {"win": config["webGl2Enabled"], "lin": desktop_gl, "mac": False}[target_os]
|
|
for key in ("webGl:supportedExtensions", "webGl2:supportedExtensions"):
|
|
if key in config:
|
|
assert ("EXT_polygon_offset_clamp" in config[key]) == want, (target_os, s, key)
|
|
|
|
|
|
def test_extensions_are_in_firefoxs_order():
|
|
"""getSupportedExtensions lists in WebGLExtensionID order: alphabetical,
|
|
ignoring case. An extension the backend adds takes its place there."""
|
|
recorded = {
|
|
"vendor": "v",
|
|
"renderer": "r",
|
|
"params": {},
|
|
"shaderPrecisionFormats": [],
|
|
"supportedExtensions": ["ANGLE_instanced_arrays", "EXT_color_buffer_half_float", "EXT_disjoint_timer_query"],
|
|
}
|
|
assert webgl.to_config(recorded, [], "win")["webGl:supportedExtensions"] == [
|
|
"ANGLE_instanced_arrays",
|
|
"EXT_color_buffer_half_float",
|
|
"EXT_depth_clamp",
|
|
"EXT_disjoint_timer_query",
|
|
]
|
|
for target_os in OSES:
|
|
for s in range(100):
|
|
config = sample_webgl_for_screen(target_os, 1920, 1080, s)
|
|
for key in ("webGl:supportedExtensions", "webGl2:supportedExtensions"):
|
|
exts = config.get(key, [])
|
|
assert exts == sorted(exts, key=str.casefold), (target_os, s, key)
|
|
|
|
|
|
def test_webgl1_line_width_range_is_webgl2s():
|
|
"""Firefox 156 creates WebGL1 on the same GL profile as WebGL2. 146 forced
|
|
a compatibility profile for WebGL1, where fpgen recorded the driver's
|
|
wide-line range (Linux: [1, 2048], [1, 7.375], [1, 10] ...)."""
|
|
for target_os in OSES:
|
|
for s in range(100):
|
|
config = sample_webgl_for_screen(target_os, 1920, 1080, s)
|
|
if config["webGl2Enabled"]:
|
|
assert config["webGl:parameters"]["33902"] == config["webGl2:parameters"]["33902"], (target_os, s)
|