Skip to content

[pull] master from apify:master#215

Merged
pull[bot] merged 1 commit into
threatcode:masterfrom
apify:master
Jun 12, 2026
Merged

[pull] master from apify:master#215
pull[bot] merged 1 commit into
threatcode:masterfrom
apify:master

Conversation

@pull

@pull pull Bot commented Jun 12, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

…lements` (#3732)

`enqueueLinksByClickingElements` installs a context-wide interceptor
(`context.route('**', onInterceptedRequest)`); the handler calls
`isTopFrameNavigationRequest` -> `req.frame()`, which **throws** when
the owning frame is unavailable (request issued by a service worker, or
before/after the frame exists). The throw escapes the async `route`
handler, so the route is never `continue()`/`abort()`ed: that request
hangs and can abort the whole click-and-intercept pass. Reproduces on
PWAs and on pages where clicking detaches frames (galleries, paginated
forums).

### Fix
Wrap the check in `try/catch`; a throw means "not a top-frame
navigation", so return `false` and let the request `continue()` normally
instead of crashing the route handler.

### Secondary fix (same function)
The interceptor is registered with `context.route('**', ...)` but torn
down with `context.unroute('*', ...)`. Playwright matches `unroute` by
the same URL glob, and `'*' !== '**'`, so the handler is not actually
removed - leaking an interceptor across page reuses. Changed to
`unroute('**', ...)`.

Fixes #3216.

Signed-off-by: Gil Cohen <gilc83@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@pull pull Bot locked and limited conversation to collaborators Jun 12, 2026
@pull pull Bot added the ⤵️ pull label Jun 12, 2026
@pull pull Bot merged commit 7b98cc3 into threatcode:master Jun 12, 2026
@pull pull Bot had a problem deploying to github-pages June 12, 2026 10:19 Failure
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant