#!/usr/bin/env python3 """Binary search for which Playwright default arg causes Chrome SIGTRAP on Ubuntu 26.04.""" from playwright.sync_api import sync_playwright default_args = [ '--disable-field-trial-config', '--disable-background-networking', '--disable-background-timer-throttling', '--disable-backgrounding-occluded-windows', '--disable-back-forward-cache', '--disable-breakpad', '--disable-client-side-phishing-detection', '--disable-component-extensions-with-background-pages', '--disable-component-update', '--no-default-browser-check', '--disable-default-apps', '--disable-dev-shm-usage', '--disable-extensions', '--disable-features=AvoidUnnecessaryBeforeUnloadCheckSync,BoundaryEventDispatchTracksNodeRemoval,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Translate,AutoDeElevate,RenderDocument,OptimizationHints', '--enable-features=CDPScreenshotNewSurface', '--allow-pre-commit-input', '--disable-hang-monitor', '--disable-ipc-flooding-protection', '--disable-popup-blocking', '--disable-prompt-on-repost', '--disable-renderer-backgrounding', '--force-color-profile=srgb', '--metrics-recording-only', '--no-first-run', '--password-store=basic', '--use-mock-keychain', '--no-service-autorun', '--export-tagged-pdf', '--disable-search-engine-choice-screen', '--unsafely-disable-devtools-self-xss-warnings', '--edge-skip-compat-layer-relaunch', '--enable-automation', '--disable-infobars', '--disable-sync', '--enable-unsafe-swiftshader', '--hide-scrollbars', '--mute-audio', '--blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4', ] def test(ignored_flags): try: p = sync_playwright().start() b = p.chromium.launch( executable_path='/usr/bin/google-chrome-stable', headless=True, args=['--no-sandbox', '--disable-gpu'], ignore_default_args=ignored_flags, timeout=10000, ) b.close() p.stop() return True except Exception: return False # Test groups suspects = [ ([a for a in default_args if 'disable-features' in a], 'disable-features'), ([a for a in default_args if 'enable-features' in a], 'enable-features'), ([a for a in default_args if 'blink-settings' in a or 'swiftshader' in a], 'blink/GPU'), ([a for a in default_args if 'color-profile' in a or 'force-color' in a], 'color-profile'), ] for group, name in suspects: ok = test(group) print(f'{name}: {"OK" if ok else "CRASH (PROBLEM HERE)"}')