GoogleChrome / lighthouse

Automated auditing, performance metrics, and best practices for the web.
https://developer.chrome.com/docs/lighthouse/overview/
Apache License 2.0
28.02k stars 9.32k forks source link

core: handle target crash at any point #15985

Closed connorjclark closed 1 month ago

connorjclark commented 1 month ago

11840 added a specific error code when the chrome target crashes, but it only applied to navigations within the waitFor condition check. Any other runner, or during teardown in navigation, and a crash would still result in a PROTOCOL_TIMEOUT.

This PR adds the crash promise to ProtocolSession, and checks during any sendCommand that there was not a crash.

Alternatively, we can introduce a wrapper around gatherFn and check if the Driver is in a crash state. This PR has both approaches (thus Draft).

connorjclark commented 1 month ago

bringing fatal promise over to the session is awesome. works great. let's go with that

OK

I realized the Driver shouldn't be the thing handling this crash promise. I just moved it to ProtocolSession, dropped all the wiring being used to get it there, and added a session.onCrashPromise() for use by navigation's wait-for-conditions.

connorjclark commented 1 month ago

Oh, this new approach also means we handle crashes in all sessions, not just the root.