Skip to content

Commit

Permalink
core(fetcher): disable auto-attaching for injected iframe (#12347)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamraine authored Apr 13, 2021
1 parent db76ab3 commit c23486f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lighthouse-core/gather/fetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,25 @@ class Fetcher {
requestInterceptionPromise,
]).finally(() => clearTimeout(timeoutHandle));

// Temporarily disable auto-attaching for this iframe.
await this.driver.sendCommand('Target.setAutoAttach', {
autoAttach: false,
waitForDebuggerOnStart: false,
});

const injectionPromise = this.driver.executionContext.evaluate(injectIframe, {
args: [url],
useIsolation: true,
});

const [fetchResult] = await Promise.all([racePromise, injectionPromise]);

await this.driver.sendCommand('Target.setAutoAttach', {
flatten: true,
autoAttach: true,
waitForDebuggerOnStart: true,
});

return fetchResult;
}
}
Expand Down

0 comments on commit c23486f

Please sign in to comment.