Both IDL attributes were unimplemented and evaluated to `undefined`.
`select.type` reflects the element's mode: "select-multiple" when the
`multiple` attribute is present, "select-one" otherwise (derived from the
existing `getMultiple()`). `option.label` returns the `label` content
attribute when present and non-empty, otherwise the value of the `text`
IDL attribute. Both match the HTML Living Standard.
Select-enhancement libraries branch on `select.type` to choose single- vs
multi-select code paths; reading `undefined` there made them take a dead
path and throw during initialization.
Closes#2738
I don't know why I thought debug should `unreahcable` while release should
generate a crash report. The crash report always contains more info and whenever
I encounter a failed assertion in debug, the first thing I do is remove the
unreachable to get the more complete crash report.
(The crash report path skips sending the crash report in debug builds already)
This is a change to https://github.com/lightpanda-io/browser/pull/2706 which
applies the Config.validateUserAgent to CDP's network.setExtraHTTPHeaders. This
makes the CDP method consistent with all other forms of user-agent setting, i.e
not allowing 'mozilla'-container values.
console.log and console.warn were both dispatched as .info, so
Runtime.consoleAPICalled (and Console.messageAdded) reported type
"info" for all three of log/info/warn — clients filtering console
output by severity saw them collapsed into one bucket.
Add log/warning members to ConsoleMessageType (the protocol's wire
values — "warning", not "warn") and map console.log -> log,
console.warn -> warning. info/error/debug/trace already matched.
Closes#2730
A root navigation that fails before any response headers arrive
(connection refused, DNS failure, TLS error) never answered the
Page.navigate command: the success reply is only sent from the
response-header path (frame_navigated), and frameErrorCallback dropped
the stored cdp_id along with the pending Page. The CDP client awaiting
the response was left hanging forever.
Dispatch a frame_navigate_failed notification from frameErrorCallback
when no response headers were processed (_http_status == null guards
against double-answering mid-body failures), and answer the pending
command with {frameId, loaderId, errorText} — matching Chrome, where
errorText is "present if and only if navigation has failed".
Closes#2728
A caller-supplied User-Agent overrides the built-in default and goes out
on the wire, so reject non-printable values the same way
Emulation.setUserAgentOverride and the --user-agent flag do.
We deliberately do NOT apply validateUserAgent's reserved (Mozilla)
check here: unlike the Emulation override (kept Lightpanda-branded to
keep go-rod working), setExtraHTTPHeaders is the intended,
Chrome-compatible escape hatch for setting a real browser-like
User-Agent, which by definition contains Mozilla.
Refs #2704
Per https://w3c.github.io/gpc/#javascript-property the GPC signal
reflects an explicit user preference to opt out of tracking, and no
such preference is configured anywhere. Firefox defaults the property
to false; Chrome doesn't expose it at all. Returning true made
GPC-compliant consent managers treat every page load as an automated
reject-all and skip their consent UI entirely, diverging from every
default-config real browser.
Adds a value assertion next to the existing doNotTrack check in the
navigator fixture (the accessor-shape walk already covered the
property, but not its value).
Closes#2725
Introduces an `update` save mode that allows the LLM to revise an
existing script. Distinguishes this from `append`, which now performs
a blind append. Updates the save prompts and system instructions
accordingly.
A second /save with nothing recorded and no prompt sent an empty user
message, which Anthropic rejects (HTTP 400: text content blocks must be
non-empty). Bail out early instead, telling the user to run commands or
give a prompt.
When a /save targets an existing script (a remembered save path, or
choosing append for an existing file), feed the file contents back to
the model and ask for the complete updated script, then overwrite. This
makes '/save fix X' actually fix the saved script — previously the
blind regeneration was appended after the buggy one. The --no-llm dump
path keeps its verbatim append semantics.
Prior to adding support for preload/modulepreload, we'd just fire a dummy
load event on the next tick. But now that we have proper handling for these, we
should fire load (or error) when the file is loaded (or failed to load). Our
artificial Frame._to_load becomes a bit more generic...it still supports
synthetic loads (e.g. for images), but it also supports "error" event.
ScriptManage and ScriptManagerBase now queue a load/error event when a preloaded
script completed/errors.
Add the reflected IDL attributes to the existing HTMLSourceElement,
which previously reflected none: src (resolved as a URL like
HTMLEmbedElement.src), srcset, sizes, media, type, width and height.
Mirrors the reflection idiom used by HTMLEmbedElement. width and height
are reflected as strings, matching the sibling HTMLEmbedElement
accessors. Adds element/html/source.html covering parse-from-markup,
property/attribute round-trips and src URL resolution.
This adds more comprehensive and correct support for slot assignment. The
changes can be broken down into 3 buckets:
1 - Slot.assign is now implemented, and general correctness around finding/
assigning slots (e.g. Text.assignedSlot)
2 - Event dispatching for "composed" (propagating through the shadowdom) better,
specifically around the composedPath and slots
3 - The slotchange event is fires at the right time (snapshot before mutation
fire after mutation).
A number of WPT tests now pass, and there should be real-world impact for
slot-heavy frameworks (e.g. lit)
Every 300-399 status was routed into the redirect path, where the missing
Location header fails the transfer with error.LocationNotFound — the old
document is destroyed and nothing replaces it. Per the fetch standard's
HTTP-redirect fetch ("If locationURL is null, then return response") and
RFC 9110 §15.4, a 3xx without Location is a normal final response whose
body must be delivered. Guard both the redirect dispatch and the 3xx
skip-body branch on the header's presence so such responses fall through
to the regular completion path.
Closes#2713
:has() arguments may start with an explicit combinator (":has(> div)",
":has(~ p)", ":has(+ span)") and are anchored at the element being
matched. Absolutize each argument at parse time by prepending a :scope
anchor segment, then match candidates with :scope bound to the element,
searching the parent's subtree for sibling-anchored arguments. This also
anchors plain arguments at the element, so ":has(span p)" no longer
false-positives when the span is an ancestor of the element.
Closes#2711
The WebSocket opening handshake must carry the document's origin in an
Origin header when initiated from a browser client (RFC 6455 §4.1), and
origin-checking endpoints (CSRF protection on WS servers) reject
upgrades that arrive without it. WebSocket.init already assembles extra
upgrade headers (Sec-WebSocket-Protocol, Cookie) but never added Origin.
Serialize the executing document's origin via URL.getOrigin next to the
existing header setup — "null" for opaque origins (about:blank, data:),
matching what Chrome sends. The TestWSServer captures the upgrade's
Origin header and exposes it via a new get-origin command; an
origin_on_upgrade fixture in websocket.html asserts the served page's
origin arrives on the upgrade.
Closes#2709
Per the HTML Standard's "update the current document readiness" steps,
every change to document.readyState must fire a readystatechange event
at the Document - twice during a normal load: when readiness becomes
interactive (before DOMContentLoaded) and when it becomes complete
(before the load event). The readiness flips in Frame.zig updated
_ready_state but never dispatched the event, so page scripts driving
their lifecycle off readystatechange never observed any transition.
Dispatch the event (non-bubbling, non-cancelable, trusted) right after
each flip, mirroring how DOMContentLoaded is emitted.
Closes#2707
Updates agent documentation to reflect the removal of the status bar
in favor of ghost hints. Also documents the `/model` command and
updates the JS mode prompt examples.
Network.setExtraHTTPHeaders applied caller headers with a plain
curl_slist append. Requests are seeded with a default `User-Agent:
Lightpanda/1.0`, so a caller-supplied User-Agent produced two
User-Agent entries; libcurl keeps the first and the override was
silently dropped (origins always saw `Lightpanda/1.0`). Other headers
worked because they had no default to collide with.
Add Headers.set, which replaces any existing header with the same
(case-insensitive) name before appending, and use it when applying the
CDP extra headers. This matches Chrome, where Network.setExtraHTTPHeaders
overrides default request headers.
Refs #2704
Updates isocline to support idle callbacks and registers a hook to
pump the session's curl multi while waiting for user input. This
prevents connection timeouts. Also refactors the idle pumping logic
into `Session.idleSlice` to share it with the MCP server.