You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run npm test to execute the Playwright test suite.
Observe the results across different browsers (Chromium, WebKit, Firefox).
Expected behavior
The tests should behave consistently across all supported browsers (Chromium, WebKit, and Firefox), ensuring correct handling of Blob URLs in scenarios like:
Creating a Web Worker from a Blob URL.
Fetching content using fetch with a Blob URL.
Opening a new tab or window with window.open using a Blob URL.
Actual behavior
In WebKit (Safari), the following behavior is observed:
When page.route is used:
Tests fail with the following error in the WebKit console:
Failed to load resource: The operation couldn't be completed. (WebKitBlobResource error 1.)
This error occurs in tests involving:
Web Workers initialized with a Blob URL.
Fetching content using a revoked Blob URL.
Opening a new tab or window with window.open using a revoked Blob URL.
Without page.route:
The tests pass successfully. Blob URLs function as expected, and no resource errors are observed in the WebKit console.
This confirms the issue is specific to the combination of page.route and strict handling of Blob URL revocation in WebKit.
This issue is not observed in Chromium or Firefox. Both browsers handle Blob URL revocation more leniently, allowing the tests to pass regardless of page.route.
The text was updated successfully, but these errors were encountered:
maxmaxme
changed the title
[Bug]: Blob revokeObjectURL too early causes new page to fail loading in WebKit
[Bug]: Blob revokeObjectURL too early causes failures in WebKit when using page.route
Nov 28, 2024
In all three tests, the code calls revokeObjectURL before the associated resource has been fully loaded. While this might work in some browsers, there is no guarantee that the resource will have finished loading by the time the blob URL is revoked. You need to wait for a reliable signal before revoking blob URLs:
new Worker(url) - It is only safe to revoke the URL after receiving a message or an error from the worker, indicating it has been initialized.
fetch(url) - Ensure the fetch operation is complete and the URL is no longer needed before revoking. Fetch is asynchronous, so you must wait for the result.
window.open(blobURL) - same thing, you should wait for the new page to load before revoking the blob URL. A simple setTimeout(f, 0) is not necessarily enough.
All the tests use page.route(), which introduces extra hops in the network handling. This can slow down some operations, increasing the likelihood of failure. Since the web app relies on unspecified behavior when revoking blob URLs, this issue is not something we will address on the Playwright side. You should update the code as described above to handle blob URL revocation properly.
Version
1.49.0
Steps to reproduce
npm install
to install dependencies.npm test
to execute the Playwright test suite.Expected behavior
The tests should behave consistently across all supported browsers (Chromium, WebKit, and Firefox), ensuring correct handling of Blob URLs in scenarios like:
fetch
with a Blob URL.window.open
using a Blob URL.Actual behavior
In WebKit (Safari), the following behavior is observed:
When
page.route
is used:window.open
using a revoked Blob URL.Without
page.route
:page.route
and strict handling of Blob URL revocation in WebKit.Notes
page.route
.Environment
The text was updated successfully, but these errors were encountered: