core: handle target crash at any point#15985
Conversation
There was a problem hiding this comment.
bringing fatal promise over to the session is awesome. works great. let's go with that
for my own posterity.. i test this with adding this to gatherers/trace.js right after the Tracing.end line:
setTimeout(() => {
session.sendCommand('Page.navigate', {url: 'chrome://crash'});
}, 100);
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 |
|
Oh, this new approach also means we handle crashes in all sessions, not just the root. |
paulirish
left a comment
There was a problem hiding this comment.
not gonna lie this is like.. sooooooooooooooo good.
net negative line count change.. and expanded the functionality. and its easier to follow.
just a huge win all around.
tested it a few ways and it looks good. i get an LHR regardless, whenever the crash happens.
NIIIIIIIIIIIIIIIIIIICE
#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).