fix(workers): swallow errors when auto-detaching from page subtargets (#2649)

Page subtargets (e.g. out-of-process iframes and others) sometimes
die before we send the 'detach' command.

This is harmless to us, but we shouldn't have an unhandled promise
rejection in this case.

Example crash: https://cirrus-ci.com/task/4884032470908928
This commit is contained in:
Andrey Lushnikov 2018-05-31 16:53:04 -07:00 committed by GitHub
parent 1c0ecc3d9c
commit 35e3f12afa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -97,7 +97,7 @@ class Page extends EventEmitter {
// If we don't detach from service workers, they will never die. // If we don't detach from service workers, they will never die.
client.send('Target.detachFromTarget', { client.send('Target.detachFromTarget', {
sessionId: event.sessionId sessionId: event.sessionId
}); }).catch(debugError);
return; return;
} }
const session = client._createSession(event.targetInfo.targetId, event.sessionId); const session = client._createSession(event.targetInfo.targetId, event.sessionId);