Skip to content

Commit

Permalink
core(target-manager): ignore targets that don't implement `Target.get…
Browse files Browse the repository at this point in the history
…TargetInfo`
  • Loading branch information
adamraine committed Oct 10, 2024
1 parent 0c7c183 commit 1d36435
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/gather/driver/target-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,15 @@ class TargetManager extends ProtocolEventEmitter {
let targetType;

try {
const {targetInfo} = await newSession.sendCommand('Target.getTargetInfo');
// This can throw an error when attaching to certain target types.
// If a target type doesn't implement `Target.getTargetInfo` then Lighthouse should probably
// ignore it anyways.
const target = await newSession.sendCommand('Target.getTargetInfo').catch(() => null);
if (!target) {
return;
}

const {targetInfo} = target;
targetType = targetInfo.type;

// TODO: should detach from target in this case?
Expand Down

0 comments on commit 1d36435

Please sign in to comment.