Skip to content

Conversation

@Skn0tt
Copy link
Member

@Skn0tt Skn0tt commented Nov 14, 2025

Closes #38207.

The current implementation of LNA doesn't really allow us to detect violations. fetch outside of a service worker automatically prompts for permission, but fetch inside a service worker does not and simply fails with "failed to fetch".

Even if we were able to detect it, the only way of obtaining the permission is through issuing a fetch. But since that always goes through the service worker in our case, and service-worker-initiated fetch doesn't prompt the permission, all we can do is ask the user to grant it in site settings.

@Skn0tt Skn0tt requested a review from dgozman November 14, 2025 11:30
@Skn0tt Skn0tt self-assigned this Nov 14, 2025
@Skn0tt
Copy link
Member Author

Skn0tt commented Nov 14, 2025

I deployed this to https://pw-trace-lna.netlify.app for manual testing. If you want to try it out, run npx serve -C in examples/todomvc and go to https://pw-trace-lna.netlify.app/?trace=http://localhost:3000/test-results/adding-new-todos-add-multi-640aa-s-should-add-multiple-todos-chromium/trace.zip

@Skn0tt
Copy link
Member Author

Skn0tt commented Nov 14, 2025

Screen.Recording.2025-11-14.at.12.42.02.mov

@github-actions
Copy link
Contributor

Test results for "MCP"

2432 passed, 116 skipped


Merge workflow run.

@github-actions
Copy link
Contributor

Test results for "tests 1"

3 flaky ⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1079 › cli codegen › should not throw csp directive violation errors `@firefox-ubuntu-22.04-node18`
⚠️ [firefox-library] › library/inspector/cli-codegen-pick-locator.spec.ts:35 › should update locator highlight `@firefox-ubuntu-22.04-node18`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:659 › should indicate current test status `@macos-latest-node18-2`

40288 passed, 787 skipped


Merge workflow run.

// Since all our requests go through the service worker, we cannot open the permission prompt for them.
const lnaPermission = await navigator.permissions.query({ name: 'local-network-access' as PermissionName }).catch(() => { });
if (lnaPermission && lnaPermission.state !== 'granted')
message += `\n\nIf your trace is in a local or private network, please grant Local Network Access in your browser's site settings and reload.`;
Copy link
Member

Choose a reason for hiding this comment

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

No such thing on my machine. How do I make things work?

Copy link
Member Author

Choose a reason for hiding this comment

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

If you're on latest Chrome, you should have it. Everybody else shouldn't see it because lnaPermission is undefined.

Copy link
Member

Choose a reason for hiding this comment

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

I don't see the setting. I can see the warning. How do I make it go away in my Chrome?

Copy link
Member Author

Choose a reason for hiding this comment

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

Follow the video in #38221 (comment). If you see the warning, you should also see the setting.

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]: Official trace-viewer (trace.playwright.dev) now refusing to load traces on local network

2 participants