Skip to content

fix: attribute window.open downloads to opener page - #203

Open
alectimison-maker wants to merge 1 commit into
Skyvern-AI:mainfrom
alectimison-maker:fix/window-open-download
Open

fix: attribute window.open downloads to opener page#203
alectimison-maker wants to merge 1 commit into
Skyvern-AI:mainfrom
alectimison-maker:fix/window-open-download

Conversation

@alectimison-maker

Copy link
Copy Markdown

What

  • discover transient popup targets when download events are enabled
  • correlate an initial window.open(url) target with Browser.downloadWillBegin and annotate the download with its opener
  • keep established popup and cross-page downloads scoped to their actual page
  • add sync, async, target-state, cross-page, and established-popup regression coverage

Closes #194.

Why

Chromium reports a window.open() navigation that becomes a download with a new target ID, then uses that ID as Browser.downloadWillBegin.frameId. Because the target never becomes a page, its frame is absent from the opener's frame tree and Rustwright rejects the download payload until expect_download() times out.

The core now tracks only direct-opener page targets that still have an empty URL. It stops treating them as transient after navigation or destruction, so downloads from an established popup are not reassigned to the opener. Python only performs the final target-identity check.

Testing

  • cargo fmt --all -- --check
  • cargo check --locked
  • cargo test --lib --locked (129 passed)
  • maturin develop --release
  • targeted download, popup, page-isolation, and async pytest subset (10 passed)

Heavyweight Docker and full-pytest verification were left to the repository's Blacksmith CI, per AGENTS.md.

Checklist

  • I kept this change focused.
  • I added or updated tests for behavior changes.
  • I did not include private credentials, tokens, or internal-only artifacts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Downloads triggered by window.open() never reach page.expect_download()

1 participant