Skip to content

Commit

Permalink
Resume tab target from page taregt
Browse files Browse the repository at this point in the history
  • Loading branch information
sadym-chromium committed Oct 9, 2024
1 parent 94e8b35 commit e745e75
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/bidiMapper/modules/cdp/CdpTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ export class CdpTarget {
}),
this.#initAndEvaluatePreloadScripts(),
this.#cdpClient.sendCommand('Runtime.runIfWaitingForDebugger'),
// Resume tab execution as well if it was paused by the debugger.
this.#parentCdpClient.sendCommand('Runtime.runIfWaitingForDebugger'),
this.toggleDeviceAccessIfNeeded(),
]);
} catch (error: any) {
Expand Down
5 changes: 3 additions & 2 deletions src/bidiMapper/modules/cdp/CdpTargetManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,15 @@ export class CdpTargetManager {
// Tab targets are required only to handle page targets beneath them.
this.#setEventListeners(targetCdpClient);

// Auto-attach to the page target and resume the tab target.
// Auto-attach to the page target and resume the tab target. No need in resuming
// tab target debugger, as it should preserve the page target debugger state, and
// will be resumed by the page target.
void (async () => {
await targetCdpClient.sendCommand('Target.setAutoAttach', {
autoAttach: true,
waitForDebuggerOnStart: true,
flatten: true,
});
await targetCdpClient.sendCommand('Runtime.runIfWaitingForDebugger');
})();
return;
case 'page':
Expand Down

0 comments on commit e745e75

Please sign in to comment.