fix(args): align feature set with stock Chrome for the Windows font profile

Playwright's launch defaults switch off a feature stock Chrome ships enabled.
When the Windows font-metrics profile is requested, re-enable it so the feature
set matches a real browser rather than a test harness. Merged into any existing
--enable-features value instead of appending a second flag.

Python, JS and .NET wrappers.
This commit is contained in:
CloakHQ
2026-07-29 01:09:36 +02:00
parent 35f5eb9408
commit 7f78805b06
3 changed files with 44 additions and 0 deletions
+12
View File
@@ -1222,6 +1222,18 @@ def build_args(
logger.debug("Arg override: %s -> %s", seen[key], arg)
seen[key] = arg
# Playwright's default launch args switch off a browser feature that stock Chrome
# ships enabled. Re-enable it alongside the Windows font-metrics profile so the
# feature set matches a stock browser rather than a test harness. Merged into any
# existing --enable-features value rather than added as a second flag.
if "--fingerprint-windows-font-metrics" in seen:
key = "--enable-features"
current = seen[key].split("=", 1)[-1] if key in seen else ""
features = [f for f in current.split(",") if f]
if "MediaRouter" not in features:
features.append("MediaRouter")
seen[key] = f"{key}={','.join(features)}"
# Timezone/locale flags are independent of stealth_args — always inject when set
if timezone:
key = "--fingerprint-timezone"
+18
View File
@@ -376,6 +376,24 @@ public static class CloakLauncher
Set(arg.Split('=', 2)[0], arg);
}
// Playwright's default launch args switch off a browser feature that stock Chrome
// ships enabled. Re-enable it alongside the Windows font-metrics profile so the
// feature set matches a stock browser rather than a test harness. Merged into any
// existing --enable-features value rather than added as a second flag.
if (seen.ContainsKey("--fingerprint-windows-font-metrics"))
{
const string key = "--enable-features";
var current = seen.TryGetValue(key, out var existing)
? existing.Split('=', 2).ElementAtOrDefault(1) ?? ""
: "";
var features = current.Split(',', StringSplitOptions.RemoveEmptyEntries).ToList();
if (!features.Contains("MediaRouter"))
{
features.Add("MediaRouter");
Set(key, $"{key}={string.Join(",", features)}");
}
}
if (!string.IsNullOrEmpty(timezone))
Set("--fingerprint-timezone", $"--fingerprint-timezone={timezone}");
+14
View File
@@ -38,6 +38,20 @@ export function buildArgs(options: LaunchOptions): string[] {
seen.set(key, arg);
}
}
// Playwright's default launch args switch off a browser feature that stock Chrome
// ships enabled. Re-enable it alongside the Windows font-metrics profile so the
// feature set matches a stock browser rather than a test harness. Merged into any
// existing --enable-features value rather than added as a second flag.
if (seen.has("--fingerprint-windows-font-metrics")) {
const key = "--enable-features";
const current = seen.get(key)?.split("=")[1] ?? "";
const features = current.split(",").filter(Boolean);
if (!features.includes("MediaRouter")) {
features.push("MediaRouter");
seen.set(key, `${key}=${features.join(",")}`);
}
}
if (options.timezone) {
const key = "--fingerprint-timezone";
const flag = `${key}=${options.timezone}`;