Skip to content

feat!: return Download objects, window_bounds in its writer's shape, add Response cache predicates - #751

Merged
route merged 1 commit into
mainfrom
ref/raw-hashes
Nov 30, 2026
Merged

route merged 1 commit into
mainfrom
ref/raw-hashes

Conversation

@route

@route route commented Nov 30, 2026

Copy link
Copy Markdown
Member

A few methods handed out CDP's raw hashes where a Ruby shape is clearer.

Downloads
downloads.files and await_download return Ferrum::Download instead of the merged downloadWillBegin/downloadProgress hashes:

download = page.await_download { page.at_css("#download").click }
download.completed?         # => true
download.path               # => "/tmp/downloads/attachment.pdf"
download.suggested_filename # => "attachment.pdf"
  • path is Chrome's own filePath, so it's right for behavior: :allowAndName too, where the file is named after the guid.
  • state is :in_progress, :completed or :canceled, plus received_bytes, total_bytes, url, frame_id and guid.
  • to_h returns the raw event params.

window_bounds
It returns {left:, top:, width:, height:, window_state:}, the shape window_bounds= takes, instead of "left", ..., "windowState". So page.window_bounds = page.window_bounds works.

Network::Response
from_disk_cache? and from_service_worker?, instead of response.params.dig("response", "fromDiskCache").

Breaking:

  • downloads.files and await_download no longer return hashes.
  • window_bounds returns symbol keys and window_state:.

…add Response cache predicates

downloads.files and await_download return Ferrum::Download objects instead of merged CDP event hashes, with path
(Chrome's filePath, the guid with allowAndName), state, completed?, canceled?, suggested_filename, byte counts and
to_h for the raw params.

window_bounds returns symbol keys with window_state:, the shape window_bounds= takes, instead of CDP's string keys
and "windowState". The position RBS is fixed to the [left, top] it returns.

Network::Response gets from_disk_cache? and from_service_worker?, so callers stop digging into params.
@route
route merged commit d522b34 into main Nov 30, 2026
7 checks passed
@route
route deleted the ref/raw-hashes branch November 30, 2026 06:31
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.

1 participant