Commit Graph

2463 Commits

Author SHA1 Message Date
Karl Seguin
3d6af216dc document.write, document.close, document.open
Add support for both modes - parsing and post-parsing. In post-parsing mode,
document.write implicitly calls document open, and document.open wipes the
document. This mode is probably rarely, if ever, used.

However, while parsing, document.write does not call document.open and does not
remove all existing nodes. It just writes the html into the document where the
parser is. That isn't something we can properly do..but we can hack it. We
create a new DocumentFragment, parse the html into the document fragment, then
transfer the children into the document where we currently are.

Our hack probably doesn't work for some advance usage of document.write (e.g
nested calls), but it should work for more common cases, e.g. injecting a script
tag.
2025-12-19 21:29:28 +08:00
Karl Seguin
f475aa09e8 backport https://github.com/lightpanda-io/browser/pull/1265 2025-12-19 16:06:25 +08:00
Pierre Tachoire
1278dc28cd cdp: add accessibility domain 2025-12-19 10:34:41 +08:00
Karl Seguin
bb1ea39c54 backport a variety of smaller CDP changes 2025-12-19 10:31:07 +08:00
Pierre Tachoire
a087386af3 cdp: implement DOM.requestNode 2025-12-19 10:15:21 +08:00
Pierre Tachoire
fe96bc7895 cdp: use default value for grantUniveralAccess
In createIsolatedWorld, we set  a default value to false for optional
grantUniveralAccess parameter.
2025-12-19 10:10:41 +08:00
Pierre Tachoire
7a69e3fc9b cdp: add browser permissions noop 2025-12-19 10:07:04 +08:00
Karl Seguin
566fa72bcd various small backports from main 2025-12-19 10:05:42 +08:00
Karl Seguin
c3f8f9de54 merge https://github.com/lightpanda-io/browser/pull/1275 2025-12-18 21:17:13 +08:00
Karl Seguin
ba4900b61f import template parsing test from 'legacy' 2025-12-18 21:14:41 +08:00
Karl Seguin
3e03f7559f Document log_filter_scope argument
Add fetch logging
2025-12-18 20:48:14 +08:00
Karl Seguin
46f8a11339 Merge pull request #1277 from lightpanda-io/zigdom-ui-events
`UIEvent`, `MouseEvent` and `KeyboardEvent`
2025-12-18 20:26:42 +08:00
Karl Seguin
b3a0aaaeea Enable v8 snapshots
There are two layers here. The first is that, on startup, a v8 SnapshotCreator
is created, and a snapshot-specific isolate/context is setup with our browser
environment. This contains most of what was in Env.init and a good chunk of
what was in ExecutionWorld.createContext. From this, we create a v8.StartupData
which is used for the creation of all subsequent contexts. The snapshot sits
at the application level, above the Env - it's re-used for all envs/isolates, so
this gives a nice performance boost for both 1 connection opening multiple pages
or multiple connections opening 1 page.

The second layer is that the Snapshot data can be embedded into the binary, so
that it doesn't have to be created on startup, but rather created at build-time.
This improves the startup time (though, I'm not really sure how to measure that
accurately...).

The first layer is the big win (and just works as-is without any build / usage
changes).

with snapshot
total runs 1000
total duration (ms) 7527
avg run duration (ms) 7
min run duration (ms) 5
max run duration (ms) 41

without snapshot
total runs 1000
total duration (ms) 9350
avg run duration (ms) 9
min run duration (ms) 8
max run duration (ms) 42

To embed a snapshot into the binary, we first need to create the snapshot file:

zig build -Doptimize=ReleaseFast snapshot_creator -- src/snapshot.bin

And then build using the new snapshot_path argument:

zig build -Dsnapshot_path=../../snapshot.bin -Doptimize=ReleaseFast

The paths are weird, I know...since it's embedded, it needs to be inside the
project path, hence we put it in src/snapshot.bin. And since it's embedded
relative to the embedder (src/browser/js/Snapshot.zig) the path has to be
relative to that, hence ../../snapshot.bin. I'm open to suggestions on
improving this.
2025-12-18 20:10:38 +08:00
Karl Seguin
aa5e71112e v8 symbol -> []const support 2025-12-18 11:59:30 +08:00
Muki Kiboigo
9dbfac02b2 add KeyboardEvent 2025-12-17 14:45:36 -08:00
Muki Kiboigo
6f43d9979d add MouseEvent 2025-12-17 14:11:49 -08:00
Muki Kiboigo
d63a045534 proper UIEvent 2025-12-17 11:51:55 -08:00
Muki Kiboigo
fe2d309d33 begin UIEvent 2025-12-17 11:49:04 -08:00
Karl Seguin
94ca2c41e4 Element.slot, Element.assignedSlot and slotchange event 2025-12-17 07:42:29 +08:00
Karl Seguin
8873e613d2 improve domexception 2025-12-16 19:16:42 +08:00
Karl Seguin
761b35b199 zig fmt 2025-12-16 17:54:14 +08:00
Karl Seguin
8a2641d213 fetch/request/response improvement (legacy) 2025-12-16 17:54:05 +08:00
Karl Seguin
e47091f9a1 legacy for request/response/fetch 2025-12-16 16:24:49 +08:00
Karl Seguin
ea399390ef Improve DOMImplementation, DocumentType and DOMException 2025-12-16 14:58:36 +08:00
Karl Seguin
d26869278f dummy HTMLCanvasElement 2025-12-16 11:13:57 +08:00
Karl Seguin
1639ff1b98 improve XMLHTTPRequest. Legacy xhr.html pass 2025-12-15 17:56:23 +08:00
Karl Seguin
9b3107d4fe build FormData from optional form and optional submitter 2025-12-15 12:31:30 +08:00
Karl Seguin
4bebc4c142 simplify / standardized how HTMLFormControlsCollection 'inherits' from HTMLCollection 2025-12-15 10:35:41 +08:00
Karl Seguin
ac0601b141 add RadioNodeList 2025-12-15 10:31:44 +08:00
Karl Seguin
6040cd3338 improve Form, notably form.elements 2025-12-14 20:02:39 +08:00
Karl Seguin
f93403d3dc Remove thread local
Rework node.isConnected(), this now [correctly] returns true as long as a node
is part of _a_ document (it doesn't have to be the 'main' document). This
requires changes around id lookup optimization.
2025-12-14 16:16:54 +08:00
Karl Seguin
82cd5d4bab fix legacy intersection observer test 2025-12-13 21:23:16 +08:00
Karl Seguin
0d3055716e tweak timing of intersection observer and how it handles disconnected nodes 2025-12-13 20:33:43 +08:00
Karl Seguin
c9b4067686 Event listener can now be an object with a handleEvent function 2025-12-13 17:19:53 +08:00
Karl Seguin
52dcc6765a URLSearchParams from FormData 2025-12-13 12:47:54 +08:00
Karl Seguin
eab328e2b5 Tweak URL, refactor Anchor and URL to share more common code 2025-12-12 21:50:13 +08:00
Karl Seguin
23146f64ab Screen and ScreenOrientation (legacy) 2025-12-12 18:21:30 +08:00
Karl Seguin
a6d3a3d0ab Add properties to HTMLStyleelement 2025-12-12 18:01:12 +08:00
Karl Seguin
5eb54bbc95 Media/Audio/Video elements 2025-12-12 17:34:57 +08:00
Karl Seguin
a4fa40743a ErrorEvent error as undefined 2025-12-12 07:58:34 +08:00
Muki Kiboigo
669c934ae0 Event Options dont need to be pub 2025-12-11 12:17:07 -08:00
Muki Kiboigo
b568eb4e1e migrate events to use new inheritOptions 2025-12-11 12:14:00 -08:00
Muki Kiboigo
4d8d6c10c6 add option inheriting for Events 2025-12-11 12:13:01 -08:00
muki
3667fbc49e Merge pull request #1253 from lightpanda-io/zigdom-navigation
Backport Navigation (and friends)
2025-12-11 12:01:57 -08:00
Karl Seguin
269c880ee0 Merge pull request #1246 from lightpanda-io/nikneym/is-equal-node
Support `isEqualNode`
2025-12-11 21:04:23 +08:00
Halil Durak
fe89aad621 add isEqualNode
rework `isEqualNode`

Splits equality logic by node types and groups comparisons nicer.
prefer ancestor's`isEqualNode`

`nodeType` => `getNodeType`

fix attribute comparison logic

Also introduces attribute counting.

remove debug logging

add `isEqualNode` test
2025-12-11 15:55:33 +03:00
Karl Seguin
38fb5b101e add Document.elementFromPoint and elementsFromPoint 2025-12-11 19:49:51 +08:00
Karl Seguin
3d8b1abda4 More legacy tests
Largely around how URL attributes (a.href, img.href, link.href) handle empty
values.
2025-12-11 16:45:19 +08:00
Karl Seguin
695ed817e4 port remaining blob functionality 2025-12-11 15:30:43 +08:00
Halil Durak
7b6776345a backport: Remove _TYPED_ARRAY_ID_KLUDGE hack
Bonus: Add `ArrayBuffer`.
2025-12-11 10:26:13 +03:00