Skip to content

Commit

Permalink
check
Browse files Browse the repository at this point in the history
  • Loading branch information
adamraine committed Nov 4, 2024
1 parent 7986439 commit 051385f
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions core/gather/driver/target-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,7 @@ class TargetManager extends ProtocolEventEmitter {
let targetType;

try {
// 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;
const {targetInfo} = await newSession.sendCommand('Target.getTargetInfo');
targetType = targetInfo.type;

// TODO: should detach from target in this case?
Expand Down Expand Up @@ -178,6 +170,10 @@ class TargetManager extends ProtocolEventEmitter {
// Sometimes targets can be closed before we even have a chance to listen to their network activity.
if (/Target closed/.test(err.message)) return;

// `Target.getTargetInfo` is not implemented for certain target types.
// Lighthouse isn't interested in these targets anyway so we can just ignore them.
if (/'Target.getTargetInfo' wasn't found/.test(err)) return;

Check warning on line 176 in core/gather/driver/target-manager.js

View check run for this annotation

Codecov / codecov/patch

core/gather/driver/target-manager.js#L173-L176

Added lines #L173 - L176 were not covered by tests
// Worker targets can be a bit fickle and we only enable them for diagnostic purposes.
// We shouldn't throw a fatal error if there were issues attaching to them.
if (targetType === 'worker') {
Expand Down

0 comments on commit 051385f

Please sign in to comment.