Commit Graph

5785 Commits

Author SHA1 Message Date
Karl Seguin
8ba960ecbc window.open
Adds limited support for window.open. This leverages the new page container and
behaves similarly to an iframe. There are many things not implemented, but the
most significant are:

1- target=window_name or target=_blank don't work (but this could be added
   pretty easily I think)

2- Windows (which are is just a Frame) are shutdown when the Page is shutdown.
   They would need to be owned by the Session (rather than the Page), but I'm
   not really confident in that right now.

3- No CDP testing. There are maybe CDP-specific messages we need to emit (or
   maybe messages that we shouldn't emit).

As-is, this should help with common cases where:
1. window.open is called but doesn't matter (won't give a JS error)
2. window.open is short-lived, or, more specifically, lives only for the
   duration of the page that opened it (e.g. a login popup).
3. WPT tests! (because most of these fit in #2).
2026-04-24 21:29:41 +08:00
Karl Seguin
3f0cc7a0df Merge pull request #2227 from lightpanda-io/better_errdefer_cleanups
Improve various errdefer flows
2026-04-24 16:37:28 +08:00
Karl Seguin
ae24343dce Merge pull request #2220 from lightpanda-io/performance_observer_functions
Add getEntriesByType and getEntriesByName to PerformanceObserver entr…
2026-04-24 16:35:32 +08:00
Karl Seguin
b15a40adc4 Merge pull request #2224 from lightpanda-io/console_own_properties
Define v8 functions directly on console instance.
2026-04-24 16:34:46 +08:00
Karl Seguin
308a9a8ccd Merge pull request #2230 from lightpanda-io/update_ws_main
Update go run ws/main.go to new go run runner/main.go -serve
2026-04-24 16:08:40 +08:00
Karl Seguin
a9e4ee41e3 Update go run ws/main.go to new go run runner/main.go -serve 2026-04-24 15:56:46 +08:00
Karl Seguin
402981fc55 Improve various errdefer flows
This possibly addresses some release overflows that could happen during various
failures. For example, if Frame.init fails during a navigation event, this will
make sure to remove the frame from the parent list preventing a double-free
on the frame.
2026-04-24 11:04:17 +08:00
Karl Seguin
a18b5deed1 Merge pull request #2222 from lightpanda-io/flaky_test_maybe_fix
try to make a flaky test more robust
2026-04-24 06:50:17 +08:00
Karl Seguin
813c7d2aa0 Merge pull request #2219 from lightpanda-io/unused_imports
Remove unused imports
2026-04-24 06:49:58 +08:00
Nikolay Govorov
bf72f57f65 Merge pull request #2223 from lightpanda-io/wp/mrdimidium/fix-canadaca-problem
Fix canada.ca problem
2026-04-23 14:07:23 +01:00
Karl Seguin
f450bddcc3 Define v8 functions directly on console instance.
functions should be defined directly on the window.console (and window.CSS)
instances. This is necessary for being able to iterate their "own" properties.
businessinsider.com has code that proxies console via such an iterator (through
Object.entries(console)). This commit allows types to declare that they own
their properties (as opposed to the prototype).

Also fixed HTMLDocument.location. This was using Document._location, but that
field wasn't always set. The new code removes the _location field and changes
the getter to get window._location. (Also an issue on businessinsider.com)
2026-04-23 20:16:28 +08:00
Halil Durak
c8d45af112 Merge pull request #2221 from lightpanda-io/cli_default_serve 2026-04-23 14:54:23 +03:00
Nikolay Govorov
c964604c7a Fix canada.ca problem 2026-04-23 12:15:57 +01:00
Karl Seguin
f883084406 try to make a flaky test more robust 2026-04-23 18:08:42 +08:00
Karl Seguin
6ca9208260 Default command 'serve' for backwards compatibility 2026-04-23 17:31:25 +08:00
Karl Seguin
f15561d531 Add getEntriesByType and getEntriesByName to PerformanceObserver entry list
Seen on dropbox.com
2026-04-23 17:25:38 +08:00
Karl Seguin
b6fbf01203 Merge pull request #2218 from lightpanda-io/user_agent_data
Adds navigator.userAgentData
2026-04-23 17:05:31 +08:00
Karl Seguin
859a41ab4e Adds navigator.userAgentData
This API isn't supported by FireFox (yet), so it isn't a huge priority, but I
did notice that its used across many Google properties. It uses the same value
as Sec-Ch-Ua (https://github.com/lightpanda-io/browser/pull/2100) to provide
consistent data.

Smaller changes:
1 - Allow `OffscreenCanvas` to be used with Worker (noticed this error too)
2 - Don't like JS execution errors at "error" level for "load" and
    "DOMContentLoaded". "error" should be reserved for things we can fix and
    should never be triggered from invalid a bug in JavaScript.
2026-04-23 16:24:42 +08:00
Karl Seguin
0a8f4ff75f Remove unused imports
As a general rule, I keep `std` if its there and unused, mostly for debug.print
debugging.
2026-04-23 16:21:56 +08:00
Halil Durak
7aca1732fe Merge pull request #2098 from lightpanda-io/nikneym/cli-parser 2026-04-23 11:17:44 +03:00
Karl Seguin
1c62d90e23 Merge pull request #2211 from lightpanda-io/page_container
Introduce Page (container)
2026-04-23 16:06:18 +08:00
Karl Seguin
4fdf04972e zig fmt 2026-04-23 15:48:15 +08:00
Karl Seguin
550fb58f3f Introduce Page (container)
Follow up to https://github.com/lightpanda-io/browser/pull/2200

This change is actually pretty mundane, but a bunch of files that used to
take a *Session (e.g. every WebAPI releaseRef and deinit) now take a *Page.

This aims to separate the 2 lifetimes currently managed by Session by moving
the "Page" lifetime to a dedicated container: Page. Ultimately, the goal is to
remove the 1-page-per-session limit of the current design. Not to explicitly
support multiple pages per session (though, that's more possible now), but
in order to better emulate Chrome where, during a navigation event, the old and
new page both exist.
2026-04-23 15:48:13 +08:00
Karl Seguin
553b32b3b8 Merge pull request #2217 from lightpanda-io/css_insert_rule_index_clamp
Clamp insert index
2026-04-23 15:39:16 +08:00
Karl Seguin
3d052794d5 Merge pull request #2216 from lightpanda-io/cdp_audit_placeholder
Add placeholder handlers for Audit enable/disable CDP methods
2026-04-23 15:39:01 +08:00
Karl Seguin
15ab2379e3 Merge pull request #2215 from lightpanda-io/set_body
Add setter for document.body
2026-04-23 15:38:48 +08:00
Karl Seguin
2c1abb4500 Merge pull request #2208 from lightpanda-io/worker_apis
More Worker APIs
2026-04-23 15:37:51 +08:00
Karl Seguin
e68dd2b284 Clamp insert index
Because we don't fully process CSS, indexes that code expect might be out of
bounds. The specific case comes from https://github.com/lightpanda-io/browser/issues/2214
which uses fullcalender library. This library uses a @font-face which we do not
process and thus end up with incorrect indexes. As a quick workaround aligned
with previous fixes for these types of cases (and what the original issue
recommended), we simply clamp the index.
2026-04-23 11:23:37 +08:00
Karl Seguin
73320e163d Add placeholder handlers for Audit enable/disable CDP methods
Might help with: https://github.com/lightpanda-io/browser/issues/2177

I say "might" because there are a 2 more methods in Audit which I haven't
implemented. This is just the most basic placeholder for now.
2026-04-23 09:19:49 +08:00
Karl Seguin
338e53460a Add setter for document.body
Fixes: https://github.com/lightpanda-io/browser/issues/2213
2026-04-23 09:15:00 +08:00
Karl Seguin
cd40491267 Merge pull request #2210 from lightpanda-io/build-extras-off-default
build: move snapshot_creator and legacy_test to an `extras` step
2026-04-23 07:42:33 +08:00
Karl Seguin
b774fc4cfb Merge pull request #2212 from lightpanda-io/cdp/ax-promote-hidden-input-labels
cdp: promote <label> to checkbox/radio for CSS-hidden inputs
2026-04-23 07:42:19 +08:00
Adrià Arrufat
e9c93a49f0 cdp: promote <label> to checkbox/radio for CSS-hidden inputs
Chromium's accessibility tree prunes elements hidden via `display:none`,
`visibility:hidden`, the `hidden` attribute, `inert`, or `aria-hidden="true"`
and we match this behavior. It's correct for most elements, but it breaks
a common form pattern: CSS-only toggle switches and custom radio groups
hide the real `<input>` and style the `<label>` as the interactive surface.

Before, an agent walking the AX tree for a toggle switch saw:

    {role: "none", name: "Enable feature", ignored: false}

a generic element with no indication it's interactive and no exposure of
the underlying `checked` state. The input was pruned and the label had no
intrinsic role.

Now, when a `<label>` is associated (via `for=` or by wrapping) with a
hidden checkbox or radio input, the label is promoted to the input's role
and state:

    {role: "checkbox", name: "Enable feature",
     properties: [..., {checked: "true"}, {focusable: true}, ...]}

Native browsers already forward label clicks to the associated input, so
the label's `backendDOMNodeId` remains a valid click target — no action-
side changes needed.

Scope is intentionally narrow:

  - Only checkbox and radio inputs. Other labelable controls (textarea,
    select, etc.) don't have the "visible label as interactive surface"
    idiom.
  - Skipped when the label has an explicit `role=` attribute, to respect
    the page's declared semantics.
  - Skipped when the input is visible: normal AX tree flow already
    surfaces it, and promoting would double-count.

The fixture `src/browser/tests/cdp/ax_tree.html` covers:

  - `display:none` checkbox, checked, referenced by `<label for=id>`
  - `display:none` radio, checked, referenced by `<label for=id>`
  - `visibility:hidden` radio, unchecked, referenced by `<label for=id>`
  - Wrapping `<label>` containing a `display:none` checkbox
2026-04-22 16:04:29 +02:00
Halil Durak
fa302a1db1 cli: report failure on lightpanda serve serve case 2026-04-22 16:37:37 +03:00
Halil Durak
7035317e3e Config: rebase to main 2026-04-22 16:14:28 +03:00
Halil Durak
1022875234 cli: improve failure messages 2026-04-22 16:08:15 +03:00
Halil Durak
59afb9e773 cli: --strip -> --strip-mode in sniff and doc-comment 2026-04-22 16:08:15 +03:00
Halil Durak
77a494f1fb cli: update doc-comment 2026-04-22 16:08:15 +03:00
Halil Durak
79319485ea cli: catch unknown arguments on options that take packed struct 2026-04-22 16:08:14 +03:00
Halil Durak
3619af2d4c cli: reintroduce old --help 2026-04-22 16:08:14 +03:00
Halil Durak
f389e1945f rebase to main 2026-04-22 16:08:14 +03:00
Halil Durak
44849fdaf3 cli: splitScalar -> tokenizeScalar 2026-04-22 16:08:14 +03:00
Halil Durak
baf97bb607 cli: remove shortcut bits in sniffCommand 2026-04-22 16:08:13 +03:00
Halil Durak
7acbd54172 cli: accept defaults for boolean
Setting a boolean option, instead of setting it to `true`, prefers the opposite of `default`. The `default` is `false` if not provided.
2026-04-22 16:08:13 +03:00
Halil Durak
1da11d8da8 Config: revert to --strip-mode 2026-04-22 16:08:13 +03:00
Halil Durak
4a4e3643f5 cli: prefer full over all to enable everything 2026-04-22 16:08:12 +03:00
Halil Durak
012fe40bb5 cli: remove aliases and shortcuts 2026-04-22 16:08:12 +03:00
Halil Durak
a3af914cda Config: adaptation to new cookie arguments 2026-04-22 16:08:12 +03:00
Halil Durak
29d8e0c9b7 Config: bring back validateUserAgent 2026-04-22 16:08:12 +03:00
Halil Durak
5e0c046e96 rebase and remove commented out code 2026-04-22 16:08:11 +03:00