fix: improve headless engine startup and shutdown#6222
Conversation
Fixes projectdiscovery#6221 Instead of enumerating all chrome processes to determine which ones need to be killed on shutdown, use the launcher.Kill() method to terminate the process that was launched for this browser instance.
WalkthroughThe changes update the browser process management in the headless engine by removing manual tracking and cleanup of Chrome process IDs. Instead, the code now uses the Chrome launcher's built-in kill functionality to manage the lifecycle of the browser process, simplifying the logic and removing unnecessary imports. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Browser (engine.go)
participant Launcher
User->>Browser (engine.go): New()
Browser (engine.go)->>Launcher: Initialize Chrome launcher
User->>Browser (engine.go): Close()
Browser (engine.go)->>Launcher: Kill()
Launcher-->>Browser (engine.go): Chrome process terminated
Assessment against linked issues
Poem
Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (4)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
ignoring test failure, fixed in #6230 |
Fixes #6221
Proposed changes
Instead of enumerating all chrome processes to determine which ones need to be killed on shutdown, use the launcher.Kill() method to terminate the process that was launched for this browser instance.
Checklist
Summary by CodeRabbit
Bug Fixes
Chores