File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -365,7 +365,12 @@ final class ChromiumProcess {
365365 private func routeEvent( _ event: [ String : Any ] ) {
366366 let method = event [ " method " ] as? String
367367 if method == " Target.attachedToTarget " {
368- handleAttachedToTarget ( event)
368+ // Auto-attach is only enabled for a restricted allowlist. Ignoring
369+ // this event on an unrestricted host keeps attachToTarget from
370+ // closing the agent page it just created.
371+ if processNavigationAllowlist. isRestricted {
372+ handleAttachedToTarget ( event)
373+ }
369374 return
370375 }
371376 let sessionID = event [ " sessionId " ] as? String
@@ -438,6 +443,7 @@ final class ChromiumProcess {
438443 }
439444
440445 private func handleAttachedToTarget( _ event: [ String : Any ] ) {
446+ guard processNavigationAllowlist. isRestricted else { return }
441447 guard let parameters = event [ " params " ] as? [ String : Any ] ,
442448 let sessionID = parameters [ " sessionId " ] as? String ,
443449 let targetInfo = parameters [ " targetInfo " ] as? [ String : Any ] ,
You can’t perform that action at this time.
0 commit comments