CodeVetter · Repo Unpack · Behavior traces
puppeteer/puppeteer
The investigated flows follow concrete calls from consumer entrypoints to browser processes, protocol commands, and filesystem output. Launch includes browser-dependent connection branches and cleanup behavior. Navigation distinguishes document replacement from same-document changes, while capture guards shared browser-context operations. Installation has separate cache-hit, incomplete-install, download, extraction, and metadata branches.
- Startup: importing puppeteer constructs PuppeteerNode → launch selects the default/requested browser → #getLauncher returns ChromeLauncher or FirefoxLauncher → the selected launcher receives LaunchOptions.
- Chrome launch: ChromeLauncher.launch → BrowserLauncher.launch → computeLaunchArguments assembles flags, allocates a temporary profile when needed, and resolves the executable → launch spawns the browser.
- CDP connection startup: BrowserLauncher chooses pipe or socket → socket startup waits for the browser's endpoint output and creates WebSocketTransport → Connection is constructed → CdpBrowser._create initializes the browser → waitForPageTarget runs unless disabled.
- New page: CdpBrowser.newPage → defaultContext.newPage → screenshot-operation guard → _createPageInContext → Target.createTarget → waitForTarget → initialization check → target.page.
- Navigation: Page.goto → mainFrame().goto → URL restriction check → LifecycleWatcher → Page.navigate raced with termination → loaderId selects new/same-document completion → navigationResponse → watcher.dispose.
- Locator click: Locator.#click waits for a handle → checks viewport/stability/enabled conditions → emits Action → ElementHandle.click scrolls and finds a clickable point → mouse.click; errors are retried under timeout/abort control.
- Screenshot persistence: Page.screenshot obtains the context guard → validates and normalizes options → optionally changes/restores viewport → CdpPage._screenshot sends Page.captureScreenshot → byte-output branch decodes and writes the optional path.
- Browser installation: downloadBrowsers applies proxy/configuration and skip conditions → concurrent downloadBrowser jobs resolve builds → install → installWithProviders → installUrl reuses a valid installed executable or downloads/unpacks, records aliases, runs setup, and removes the archive.