Lazily probes and caches Ollama server reachability for `/provider`
autocomplete. Validates Ollama availability when manually setting
the provider. Updates zenai dependency.
Renames `wouldResolve` to `hasDetectableKey` and removes the Ollama
probe from it. Defers printing the welcome banner for Ollama-only
paths to prevent probing the local server twice. Also bumps zenai.
Replaces global blocking functions with a `Page` class. `page.goto` is
now asynchronous and must be awaited, while other methods remain
synchronous. Scripts are wrapped in an async IIFE to support top-level
await, and output is returned via `return <value>`.
Passes the `HF_BILL_TO` environment variable to the ZenAI client
to route Hugging Face billing to an organization. Also updates
the `zenai` dependency.
clearConversation reset the recorded action buffer but left save_path
set, so after /clear or /reset a /save <newfile> was rejected with
"already saving to <oldfile>". Free and clear save_path alongside the
buffer so a cleared session can save to a fresh file.
This continues some previous fixes aimed at iframe/popup scenarios where the DOM
is manipulated from a different frame. The simplest example is:
iframe.contentDocument.domain
should return the domain of the iframe, not the domain of the context this is
being run in. For a case like this, it's easy, use self._frame rather than
the calling context's frame.
Besides these easy cases, there are two other changes here:
1 - ResolveURL has to get an Element's owning document's frame
2 - getElementById has to get the lookup from the element's document
As part of #2, `Frame.getElementByIdFromNode` was optimized to avoid the
double document lookup. Rather than calling isConnected() then finding the root
node, we can just call getRootNode().
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