Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core(driver): attach to worker targets #14212

Merged
merged 15 commits into from
Sep 11, 2023
Merged

core(driver): attach to worker targets #14212

merged 15 commits into from
Sep 11, 2023

Conversation

adamraine
Copy link
Member

@adamraine adamraine commented Jul 13, 2022

Closes #14211

Worker requests will appear in network-requests and total-byte-weight but are excluded from the page dependency graph used for lantern simulation.

@adamraine adamraine requested a review from a team as a code owner July 13, 2022 22:55
@adamraine adamraine requested review from connorjclark and removed request for a team July 13, 2022 22:55
@connorjclark
Copy link
Collaborator

This also adds --legacy-navigation support for the DevTools runner

These are two disparate changes, can you split this off?

@connorjclark
Copy link
Collaborator

👀
image

@adamraine
Copy link
Member Author

Split out #14217

@adamraine

This comment was marked as resolved.

@adamraine adamraine changed the title core(driver): handle worker events in legacy mode core(driver): attach to worker targets Feb 15, 2023
const target = await newSession.sendCommand('Target.getTargetInfo').catch(() => null);
const targetType = target?.targetInfo?.type;
const hasValidTargetType = targetType === 'page' || targetType === 'iframe';
const {targetInfo} = await newSession.sendCommand('Target.getTargetInfo');
Copy link
Member Author

Choose a reason for hiding this comment

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

Before M110 this command would throw an error on worker targets. With this patch we would require a Chrome version >=M110 which is the current stable.

copybara-service bot pushed a commit to ChromeDevTools/devtools-frontend that referenced this pull request Mar 14, 2023
Resuming a worker that is not waiting on the debugger will resume the
worker even if there is another worker session still waiting on the
debugger.

This CL is a workaround to prevent DevTools from prematurely resuming
worker targets.

This was causing issues for Lighthouse listening to network requests:
GoogleChrome/lighthouse#14212

Bug: 1423096
Change-Id: I757f4fd3ee0969ea33e1acc95e1190c99146a023
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4326967
Commit-Queue: Adam Raine <asraine@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
@adamraine adamraine changed the title core(driver): attach to worker targets core(driver): attach to worker target Mar 14, 2023
@adamraine adamraine changed the title core(driver): attach to worker target core(driver): attach to worker targets Mar 14, 2023
@@ -65,7 +65,7 @@ class ScriptElements extends BaseGatherer {

const scriptRecords = networkRecords
.filter(record => record.resourceType === NetworkRequest.TYPES.Script)
.filter(record => !record.isOutOfProcessIframe);
.filter(record => record.sessionTargetType === 'page');
Copy link
Member Author

Choose a reason for hiding this comment

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

There are several places isOutOfProcessIframe is used where it could make more sense to use a sessionTargetType === 'page' now that we have worker requests as well. This is just the only place that caused a test failure.

Copy link
Member Author

Choose a reason for hiding this comment

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

Update: I changed the other usages of isOutOfProcessIframe too. We don't use isOutOfProcessIframe anywhere now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lighthouse doesn't listen to network events on worker targets
3 participants