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: single network monitor kept on Driver #15055

Merged
merged 3 commits into from
Jul 21, 2023
Merged

Conversation

connorjclark
Copy link
Collaborator

@connorjclark connorjclark commented May 9, 2023

ref #14078

Moves NetworkMonitor to Driver, so that the navigation runner and FPS gatherer can use the same instance.

Without changing the lifecycle of the monitor: the navigation runner enables/disables it for goToURL only, and the FPS does the same in getArtifact (so after the monitor has been disabled in navigation mode - but for the first and only time in other modes). If a gatherer wanted to use the monitor in earlier gathering stages, we need to modify how the monitor is enabled. One option is to track a counter of enables/disables (like we do for protocol domains). Another is to just enable unconditionally in Driver.connect, so it's on constantly for all modes and gatherers. The second commit in the PR tries this approach.

@@ -50,6 +51,7 @@ declare module Gatherer {
on(event: 'protocolevent', callback: (payload: Protocol.RawEventMessage) => void): void
off(event: 'protocolevent', callback: (payload: Protocol.RawEventMessage) => void): void
};
networkMonitor: NetworkMonitor;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I know I should type just the public interface here, but then we get this error...

image

How can we resolve this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should we pull waitForFullyLoaded (and whatever else...) into NetworkMonitor? expose as NetworkMonitor.waitForFullyLoaded(session, opts)?

Copy link
Member

Choose a reason for hiding this comment

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

Eh, waitForFullyLoaded does other non-network stuff like CPU idle. I think it's fine this way personally.

@adamraine
Copy link
Member

adamraine commented Jul 19, 2023

Looks like you have to do the import * as LH from '../types/lh.js'; trick for network-monitor.js and network-recorder.js

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.

4 participants