Commit Graph

4964 Commits

Author SHA1 Message Date
Pierre Tachoire
1739ae6b9a check submit element and form into Form.requestSubmit 2026-03-17 21:34:48 +01:00
Pierre Tachoire
ba62150f7a add Form.requestSubmit(submitter) 2026-03-17 17:05:30 +01:00
Pierre Tachoire
9ef8d9c189 Merge pull request #1887 from lightpanda-io/disable_observer_weak_ref
disable observer weak ref
2026-03-17 14:09:43 +01:00
Karl Seguin
9f27416603 zig fmt 2026-03-17 20:03:31 +08:00
Karl Seguin
0729f4a03a Merge pull request #1872 from lightpanda-io/wp/mrdimidium/fix-cdp-close
Gracefull close ws socket
2026-03-17 19:58:48 +08:00
Karl Seguin
21f7b95db9 disable observer weak ref
https://github.com/lightpanda-io/browser/pull/1870 doesn't work. I think there
are ways for the inspector to move objects into a context that skips our
reference count (those remote objects?). This disables weak references for
MutationObserver and IntersectionObserver. The issue is probably more widespread
but these are two types CDP drivers us _a lot_ via inspector, so this should
fix a number of immediate crashes.

I believe the correct fix is to remove Origin and store things at the Session-
level.
2026-03-17 19:54:21 +08:00
Nikolay Govorov
4125a5aa1e Merge pull request #1874 from JasonOA888/fix/add-git-version-option
feat: add `git_version` build option for release version detection
2026-03-17 11:27:27 +00:00
Nikolay Govorov
6d0dc6cb1e Gracefull close ws socket 2026-03-17 11:15:12 +00:00
Nikolay Govorov
0675c23217 Merge pull request #1883 from Tenith01/fix/port-already-in-use
fix: show actionable error when server port is already in use
2026-03-17 10:53:36 +00:00
Karl Seguin
d0e6a1f5bb Merge pull request #1882 from Tenith01/fix/window-onerror-special-case
fix: special-case Window#onerror per WHATWG spec (5-arg signature)
2026-03-17 18:36:11 +08:00
Karl Seguin
91afe08235 Merge pull request #1878 from mvanhorn/osc/1770-window-event
Implement window.event property
2026-03-17 18:35:30 +08:00
Karl Seguin
7009fb5899 Merge pull request #1880 from lightpanda-io/logfilter-init-slice
Some checks failed
zig-test / zig test using v8 in debug mode (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
LogFilter: init with slice and silence tests
2026-03-17 17:42:23 +08:00
Tenith01
ce002b999c fix: special-case Window#onerror per WHATWG spec (5-arg signature) 2026-03-17 13:49:59 +05:30
Adrià Arrufat
5b1056862a Merge pull request #1879 from lightpanda-io/fix-leak-add-from-element
ScriptManager: fix memory leak and resource handover
2026-03-17 16:33:49 +09:00
Tenith01
cc4ac99b4a fix: show actionable error when server port is already in use 2026-03-17 13:02:55 +05:30
Adrià Arrufat
46df341506 ScriptManager: defer resource handover until request success 2026-03-17 15:45:11 +09:00
Adrià Arrufat
b698e2d078 LogFilter: init with slice and silence tests 2026-03-17 13:42:35 +09:00
Karl Seguin
5cc5e513dd Merge pull request #1876 from lightpanda-io/more-mcp-tools
Add click, fill, and scroll DOM interaction tools to MCP and CDP
2026-03-17 12:39:35 +08:00
Adrià Arrufat
e048b0372f ScriptManager: fix memory leak and resource handover
Release the arena when an inline script is empty and ensure the
handover flag is set correctly for all script execution modes.
2026-03-17 13:32:29 +09:00
Adrià Arrufat
d7aaa1c870 Merge branch 'main' into more-mcp-tools 2026-03-17 13:26:44 +09:00
Adrià Arrufat
463aac9b59 browser.actions: refactor click to use trusted MouseEvent 2026-03-17 13:22:55 +09:00
Karl Seguin
d9cdd78138 Merge pull request #1875 from lightpanda-io/history_test_stability
Try to improve stability of history test
2026-03-17 12:21:29 +08:00
Adrià Arrufat
44a83c0e1c browser.actions: use .wrap directly
Co-authored-by: Karl Seguin <karlseguin@users.noreply.github.com>
2026-03-17 12:55:10 +09:00
Matt Van Horn
96f24a2662 Implement window.event property
Add the deprecated-but-widely-used window.event property that returns
the Event currently being handled. Returns undefined when no event is
being dispatched.

Implementation saves and restores window._current_event around handler
invocation in both dispatchDirect and dispatchNode, supporting nested
event dispatch correctly.

Fixes #1770

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 20:42:45 -07:00
Karl Seguin
deb08b7880 Try to improve stability of history test
Tests cannot navigate away from the page page. If they do, the testRunner will
crash, as it tries to access `assertOk` on a page that no longer exists. This
commit hacks the history test, using an iframe, to try to test the history API
without navigating off the main page.
2026-03-17 08:15:49 +08:00
JasonOA888
96e5054ffc feat: add git_version build option for release version detection
- Add git_version option to build.zig (similar to git_commit)
- Update version command to output git_version when available
- Falls back to git_commit when not on a tagged release
- CI can pass -Dgit_version=$(git describe --tags --exact-match) for releases

Fixes #1867
2026-03-17 07:41:11 +08:00
Karl Seguin
c9753a690d Merge pull request #1863 from jnMetaCode/fix/cdp-missing-disable-methods
Some checks failed
zig-test / zig test using v8 in debug mode (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
wpt / zig build release (push) Has been cancelled
wpt / build wpt runner (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
e2e-integration-test / zig build release (push) Has been cancelled
e2e-integration-test / demo-integration-scripts (push) Has been cancelled
fix(cdp): add missing disable methods to Performance, Inspector, Security domains
2026-03-17 07:21:14 +08:00
Karl Seguin
27aaf46630 Merge pull request #1873 from lightpanda-io/fix/domexception-default-messages
Fix/domexception default messages
2026-03-17 07:20:15 +08:00
Karl Seguin
84190e1e06 fix test for new messages 2026-03-17 07:07:16 +08:00
Karl Seguin
b0b1f755ea Merge pull request #1870 from lightpanda-io/mutation_observer_rc
Switch to reference counting for Mutation Observer and Intersection O…
2026-03-17 06:43:45 +08:00
Karl Seguin
fcf1d30c77 Merge pull request #1864 from lightpanda-io/trusted_cdp_clicks
click event dispastched from CDP should be trusted
2026-03-17 06:43:32 +08:00
Karl Seguin
3c532e5aef Merge pull request #1846 from lightpanda-io/origin_cdp_fix
Fix use-after-free with certain CDP scripts
2026-03-17 06:43:07 +08:00
Karl Seguin
3efcb2705d Merge pull request #1840 from lightpanda-io/script_manager_arena_pool
Move ScriptManager to ArenaPool.
2026-03-17 06:42:48 +08:00
Karl Seguin
c25f389e91 Merge pull request #1817 from lightpanda-io/frames_postMessage
window.postMessage across frames
2026-03-17 06:42:32 +08:00
Karl Seguin
533f4075a3 Merge pull request #1868 from lightpanda-io/bom_charset
Some checks failed
zig-test / zig test using v8 in debug mode (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
nightly build / build-linux-x86_64 (push) Has been cancelled
nightly build / build-linux-aarch64 (push) Has been cancelled
nightly build / build-macos-aarch64 (push) Has been cancelled
nightly build / build-macos-x86_64 (push) Has been cancelled
Set charset based on BOM
2026-03-16 23:36:44 +08:00
Adrià Arrufat
f508d37426 lp: validate params in node actions and rename variables 2026-03-16 23:50:15 +09:00
Adrià Arrufat
548c6eeb7a browser.actions: remove redundant result ignores 2026-03-16 23:45:07 +09:00
Adrià Arrufat
c8265f4807 browser.actions: improve error handling 2026-03-16 23:41:22 +09:00
Adrià Arrufat
a74e46debf actions: make scroll coordinates optional
Updates the scroll action to accept optional x and y coordinates. This
allows scrolling on a single axis without resetting the other to zero.
2026-03-16 22:44:37 +09:00
Karl Seguin
1ceaabe69f Switch to reference counting for Mutation Observer and Intersection Observer
This may be a stopgap.

Our identity model assumes that v8 won't allow cross-origin access. It turns out
that with CDP and Inspector, this isn't true. Inspectors can break / violate
cross-origin restrictions. The result is that 2 origins can see the same zig
instance, which causes 2 v8::Objects to reference the same Zig instance.

This likely causes some consistency issue. Like, if you take mo in 1 context,
and write an arbitrary property, mo.hack = true, you won't observe that in the
2nd context (because it's a different v8::Object). But, it _is_ the same Zig
instance, so if you set a known/real property, it will be updated.

That's probably a pretty minor issue. The bigger issue is that it can result in
a use-after-free when using explicit strong/weak ref:

1 - Mutation observer is created in Origin1
2 - It's automatically set to weak
3 - Something is observed, the reference is made strong
4 - The MO is accessed from Origin2
5 - Creates a new v8::Object
6 - Sets it to weak
7 - Object goes out of scope in Origin2
8 - Finalizer is called  <- free
9 - MO is manipulated in Origin 1 <- use after free

Maybe the right option is to have a single shared identity map. I need to think
about it. As a stopgap, switching to reference counting (which we already
support) shold prevent the use-after free. While we'll still create 2
v8::Objects, they'll each acquireRef (_rc = 2) and thus it won't be freed until
they both release i
Maybe the right option is to have a single shared identity map. I need to think
about it. As a stopgap, switching to reference counting (which we already
support) shold prevent the use-after free. While we'll still create 2
v8::Objects, they'll each acquireRef (_rc = 2) and thus it won't be freed until
they both release it.
2026-03-16 20:56:18 +08:00
Pierre Tachoire
91a2441ed8 Merge pull request #1829 from salmanmkc/upgrade-github-actions-node24
Upgrade GitHub Actions for Node 24 compatibility
2026-03-16 12:19:22 +01:00
Pierre Tachoire
2ecbc833a9 Merge pull request #1858 from lightpanda-io/flaky-wbatest
ci: fix wba flaky test
2026-03-16 11:13:43 +01:00
Pierre Tachoire
dac456d98c ci: fix wba flaky test
Sometimes the GHA secret isn't dump in file correctly.
So this commit inject the value directly to the command line
2026-03-16 10:57:40 +01:00
Karl Seguin
422320d9ac Set charset based on BOM
Small follow up to https://github.com/lightpanda-io/browser/pull/1837 If we
sniff the content type from the byte order mark (BOM), then we should set the
charset. This has higher precedence than sniffing the content type from the
content of the document (e.g. meta tags)
2026-03-16 17:54:01 +08:00
Karl Seguin
18b635936c Merge pull request #1837 from mvanhorn/osc/531-charset-prescan
Some checks failed
zig-test / zig test using v8 in debug mode (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
e2e-test / zig build release (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / wba-demo-scripts (push) Has been cancelled
e2e-test / wba-test (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
e2e-test / browser fetch (push) Has been cancelled
Implement charset detection from first 1024 bytes of HTML
2026-03-16 17:39:58 +08:00
Karl Seguin
7b2895ef08 click event dispastched from CDP should be trusted 2026-03-16 17:33:12 +08:00
jnMetaCode
b09e9f7398 fix(cdp): add missing disable method to Security
Signed-off-by: JiangNan <1394485448@qq.com>
2026-03-16 17:21:20 +08:00
jnMetaCode
ac651328c3 fix(cdp): add missing disable method to Inspector
Signed-off-by: JiangNan <1394485448@qq.com>
2026-03-16 17:21:18 +08:00
jnMetaCode
0380df1cb4 fix(cdp): add missing disable method to Performance
Signed-off-by: JiangNan <1394485448@qq.com>
2026-03-16 17:21:14 +08:00
jnMetaCode
21421d5b53 fix(dom): add default messages for all DOMException error codes
The getMessage() fallback returned raw tag names like
"wrong_document_error" instead of human-readable messages.
Fill in all 18 error codes with messages based on the
WebIDL spec error descriptions.

Closes #82

Signed-off-by: JiangNan <1394485448@qq.com>
2026-03-16 17:20:29 +08:00