Skip to content

Backport patchrightInitScript route flag plumbing#6

Open
missin9 wants to merge 1 commit into
DevEnterpriseSoftware:masterfrom
missin9:fix/initscript-proxy-route-flag
Open

Backport patchrightInitScript route flag plumbing#6
missin9 wants to merge 1 commit into
DevEnterpriseSoftware:masterfrom
missin9:fix/initscript-proxy-route-flag

Conversation

@missin9
Copy link
Copy Markdown

@missin9 missin9 commented May 21, 2026

Summary

This mirrors the route fallback and continue plumbing from Kaliiiiiiiiii-Vinyzu/patchright-python#115 for Patchright.NET.

Patchright init-script injection rewrites document requests through the internal patchright-init-script-inject.internal sentinel. The driver has a patchrightInitScript path that treats this as internal init-script traffic and continues with response interception. The .NET binding patcher did not pass that flag through route fallback and continue, so the sentinel could reach normal network or proxy handling.

Changes

  • Adds RouteFallbackOptions.PatchrightInitScript.
  • Copies the flag through fallback override application.
  • Sends patchrightInitScript in route continue and fallback protocol params.
  • Marks the generated Page and BrowserContext init-script fallback route with PatchrightInitScript = true.

Validation

  • Built a local package from this patch with Patchright driver 1.60.0.
  • Confirmed the generated source contains the flag in route options, fallback overrides, route protocol params, Page injection, and BrowserContext injection.
  • Consumed the package from a downstream .NET Patchright application.
  • Verified baseline browser launch.
  • Verified AddInitScript still lands on a strict-CSP page through DOM reflection.
  • Verified real HTTPS navigation through an authenticated residential proxy via a local HTTP CONNECT forwarder no longer fails with ERR_NAME_NOT_RESOLVED or ERR_EMPTY_RESPONSE from the internal init-script sentinel.
  • Verified multiple all-proxied browser contexts in one Chrome process can navigate with distinct proxy sessions and context-level identity settings.

Notes

This keeps the .NET binding behavior close to patchright-python#115 and relies on the existing driver-side patchrightInitScript handling.

@missin9 missin9 force-pushed the fix/initscript-proxy-route-flag branch from 6ba4b0f to 8ada3f5 Compare May 21, 2026 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant