Skip to content

fix(webkit): do not report blob: URLs to route handlers - #42738

Closed
Mohan Ram (mohanram-dev) wants to merge 1 commit into
microsoft:mainfrom
mohanram-dev:fix/webkit-ignore-blob-urls
Closed

Mohan Ram (mohanram-dev) wants to merge 1 commit into
microsoft:mainfrom
mohanram-dev:fix/webkit-ignore-blob-urls

Conversation

@mohanram-dev

Copy link
Copy Markdown

Fixes #42727.

Description

In WebKit, blob: URLs were being dispatched to page.route handlers, whereas Chromium and Firefox do not dispatch network interception for blob: URLs.

In wkPage.ts and wvPage.ts, _onRequestWillBeSent already filters out data: and about: URLs, but did not exclude blob: URLs. When event.request.url.startsWith('blob:') is skipped in _onRequestWillBeSent, any subsequent requestIntercepted event continues cleanly without invoking route handlers or page.on('request').

Changes

  • In packages/playwright-core/src/server/webkit/wkPage.ts: return early in _onRequestWillBeSent if event.request.url.startsWith('blob:').
  • In packages/playwright-core/src/server/webkit/webview/wvPage.ts: return early in _onRequestWillBeSent if event.request.url.startsWith('blob:').
  • In tests/page/page-route.spec.ts: add regression test validating that blob: URLs from web workers and fetch() are not reported to route handlers.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

3 failed
❌ [firefox-library] › library/browsercontext-storage-state.spec.ts:453 › should work when service worker is intefering and the origin is not open @firefox-ubuntu-22.04-node20
❌ [webkit-library] › library/trace-viewer.spec.ts:1172 › should handle src=blob @webkit-ubuntu-22.04-node20
❌ [webkit-page] › page/interception.spec.ts:350 › should intercept blob url requests @webkit-ubuntu-22.04-node20

5 flaky ⚠️ [chromium-library] › library/video.spec.ts:495 › screencast › should capture static page in persistent context Radoslav Kirilov (@smoke) `@chromium-ubuntu-22.04-node20`
⚠️ [chromium-library] › library/video.spec.ts:664 › screencast › should capture full viewport `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-event-request.spec.ts:181 › should return response body when Cross-Origin-Opener-Policy is set `@firefox-ubuntu-22.04-node20`

51728 passed, 1247 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

2 failed
❌ [chromium] › mcp/annotate.spec.ts:386 › should cancel browser_annotate when the MCP request is aborted @mcp-windows-latest-chromium
❌ [chromium] › mcp/annotate.spec.ts:417 › should cancel browser_annotate when the MCP client disconnects @mcp-windows-latest-chromium

8562 passed, 1446 skipped


Merge workflow run.

// WebKit started dispatching network events for about:blank after https://commits.webkit.org/292206@main.
if (event.request.url.startsWith('about:'))
return;
if (event.request.url.startsWith('blob:'))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does a lot more than just preventing routing blob: and drops all network activity for blob:

@dcrousso

Copy link
Copy Markdown
Contributor

closing per #42727 (comment)

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.

[Bug]: WebKit reports blob: URLs to page.route handlers; Chromium and Firefox do not

2 participants