Commit graph

7 commits

Author SHA1 Message Date
Sam Atkins
a3e85ada85 LibDevTools: Share storage field descriptor creation
Storage actors all describe table columns with the same DevTools field
object shape. Extract a helper for constructing those objects so that
cookies, local storage, session storage, and soon IndexedDB, do not each
spell out the JSON fields by hand.
2026-06-19 14:25:39 +02:00
Sam Atkins
5b5f848689 LibDevTools: Make ErrorOr -> JsonValue helpers public
We want these for local/session storage too, so avoid duplicating them.
2026-06-11 16:08:33 +01:00
Sam Atkins
aa4139d002 LibDevTools: Allow adding and removing DevTools cookies
Firefox enables the Storage panel cookie toolbar from the storage traits
and calls addItem, removeItem, removeAll, or removeAllSessionCookies
for the selected host.

Advertise those operations and route them through the existing cookie
mutation delegate. Deletions reuse the visible storage host matching so
bulk actions stay scoped to the cookie tree item Firefox selected.
2026-06-11 15:03:47 +01:00
Sam Atkins
4113968e77 LibDevTools: Allow editing DevTools cookies
Firefox sends editItem when a cookie table cell is changed. Handle
that request by locating the original cookie, applying the edited
field, and forwarding the replacement through the delegate mutation
hook.

Return Firefox-style errorString values so invalid edits can be
rejected without changing the table contents.
2026-06-11 15:03:47 +01:00
Sam Atkins
47204bd3dd LibDevTools: Report cookie storage changes
Firefox keeps the Storage table current through storesUpdate messages
from the storage actor. Forward browser cookie change notifications to
the cookies actor and classify visible rows against a fresh cookie
snapshot.

The existing cookie-change notifications report cookies that are
relevant to a specific page, whereas DevTools wants all cookies
relevant for a host, so we end up having to provide two different sets
of cookies to `notify_cookies_changed()`.
2026-06-11 15:03:47 +01:00
Sam Atkins
20f922cbdb LibWebView+LibDevTools: Populate DevTools cookies
Firefox asks the cookies actor for rows after selecting a Storage host.
Read the browser cookie jar through the DevTools delegate and serialize
matching cookies with the fields Firefox expects.

This keeps mutation support disabled, but makes existing cookies visible
in the Storage panel.
2026-06-11 15:03:47 +01:00
Sam Atkins
deec1ec2c3 LibDevTools: Add cookie storage actor
Firefox discovers Storage panel data through watcher resources. This
adds a read-only cookies actor with the fields and empty store response
expected by the Storage panel.

Mutation traits are reported as unsupported for now.

DevTools storage resources all have a "host" key derived from the URL,
which we produce in `storage_host_for_url()`.
2026-06-11 15:03:47 +01:00