Don't abort blob URLs in e2e tests

The remote request guard read the empty hostname of a `blob:` URL as
remote, so embed previews never loaded in tests.
This commit is contained in:
Rūdolfs Ošiņš
2026-10-07 16:41:54 +02:00
parent 9ca793f393
commit 1bc5ffa9fe
+6 -1
View File
@@ -79,7 +79,12 @@ export const test = base.extend<{
const playwrightLabel =
" ".repeat(23) + "→ " + chalk.yellowBright("playwright") + ": ";
function isLocalhost(url: URL) {
function isLocalhost(url: URL): boolean {
// A blob URL has no hostname of its own; it belongs to the origin
// that created it.
if (url.protocol === "blob:") {
return isLocalhost(new URL(url.pathname));
}
return url.hostname === "localhost" || url.hostname === "127.0.0.1";
}