perf: skip blank page on first browser command#710
Merged
Conversation
Two changes that eliminate the about:blank → target-domain navigation on first command execution: 1. Extension: getAutomationWindow() accepts an optional initialUrl. When creating a new window, uses the target URL directly instead of about:blank. handleNavigate() passes cmd.url through so the window starts on the correct domain. 2. CLI: Remove isAlreadyOnDomain() check before pre-nav. Instead, always call page.goto(preNavUrl) — the extension's handleNavigate already has a fast-path that skips navigation when the tab is already at the target URL. This avoids an extra exec round-trip (getCurrentUrl eval) on first command. Net effect: first command saves ~1-3s (one fewer page load), subsequent commands behave the same (navigate fast-path handles domain matching efficiently via chrome.tabs.get).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
about:blank→ target-domain navigation on first command execution, saving ~1-3sgetAutomationWindow()now accepts an optionalinitialUrlto create the window directly on the target domainisAlreadyOnDomain()exec-based check and always callspage.goto()— the extension'shandleNavigatealready fast-paths when the tab is at the target URLHow it works
Before:
After:
Changes
extension/src/background.ts:getAutomationWindow(workspace, initialUrl?)uses target URL for window creation;resolveTabIdandhandleNavigatepass URL throughsrc/execution.ts: RemoveisAlreadyOnDomain()check, always navigate directly. Extension handles domain-match efficientlyTest plan
npx tsc --noEmitpasses (both CLI and extension)