Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion packages/trace-viewer/src/sw/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ function loadTrace(clientId: string, url: URL, isContextRequest: boolean, progre
return loadedTrace;
const promise = innerLoadTrace(traceUrl, progress);
loadedTraces.set(traceUrl, promise);
promise.catch(() => loadedTraces.delete(traceUrl));
return promise;
}

Expand All @@ -118,7 +119,17 @@ async function innerLoadTrace(traceUrl: string, progress: Progress): Promise<Loa
throw new Error('Could not load trace. Did you upload a Playwright HTML report instead? Make sure to extract the archive first and then double-click the index.html file or put it on a web server.');
if (error instanceof TraceVersionError)
throw new Error(`Could not load trace from ${traceUrl}. ${error.message}`);
throw new Error(`Could not load trace from ${traceUrl}. Make sure a valid Playwright Trace is accessible over this url.`);

let message = `Could not load trace from ${traceUrl}. Make sure a valid Playwright Trace is accessible over this url.`;

// The local-network-access implementation doesn't allow detecting violations, so we can only suspect it as a possible failure reason.
// Obtaining the permission is done by issuing a `fetch`, but it doesn't work from a service worker.
// 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.

Copy link
Member

Choose a reason for hiding this comment

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

Ah! Mind giving user a hint via rendering more helpful instructions? I went to the settings and did not find it there.


throw new Error(message);
}
const snapshotServer = new SnapshotServer(traceModel.storage(), sha1 => traceModel.resourceForSha1(sha1));
return { traceModel, snapshotServer };
Expand Down
1 change: 1 addition & 0 deletions packages/trace-viewer/src/ui/workbenchLoader.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ body .drop-target {
font-weight: bold;
text-align: center;
margin: 30px;
white-space: pre-line;
}

.drop-target input {
Expand Down