Commit Graph

1857 Commits

Author SHA1 Message Date
Kilari Teja
b32839292c Support Data URI in scripts tags (#596)
* Support text/javascript mime type

* Support base64 encoded scripts

Related to https://github.com/lightpanda-io/browser/issues/412
2025-05-05 14:48:21 +08:00
Pierre Tachoire
2402443dcc cdp: add comments on setChildNodes event
Co-authored-by: Karl Seguin <karlseguin@users.noreply.github.com>
2025-05-05 08:48:04 +02:00
sjorsdonkers
9f72c98967 Error on null page/scope 2025-05-05 08:46:33 +02:00
sjorsdonkers
f6f744aea1 Fix gc_hints not being send 2025-05-05 08:46:33 +02:00
sjorsdonkers
cddc55694a load polyfills on creation 2025-05-05 08:46:32 +02:00
sjorsdonkers
8930e2f06e isolated polyfill + create when needed 2025-05-05 08:46:32 +02:00
Karl Seguin
b8e5e130b9 remove unused code, mostly imports 2025-05-05 13:29:41 +08:00
Karl Seguin
a8c5087a38 Remove undefined that causes crash
These values are set to undefined, and used (in the item function) before ever
being set. Causes crashes in release mode.
2025-05-04 21:18:30 +08:00
Karl Seguin
d9f21e0475 add empty cases to empty test suite (#594)
Some checks failed
e2e-test / zig build release (push) Has been cancelled
wpt / web platform tests (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
e2e-test / puppeteer-perf (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
zig-test / browser fetch (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
2025-05-03 14:11:39 +08:00
Karl Seguin
ca3fa3dc40 Rework WPT runner (#589)
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / puppeteer-perf (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
wpt / web platform tests (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / browser fetch (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
* Rework WPT runner

We have no crashing tests, remove safe mode. Allows better re-use of arenas,
and if we do introduce a crash, it won't be easy to ignore. Could allow for
re-using the environment across tests to further improve performance.

Remove console now that we have a working console api.

* Update workflows, add summary

Remove --safe option from WPT workflows (it's no longer valid)

Include a total test/case summary when --summary or --text (default) is used.

* remove wpt --safe flag from Makefile

* handle tests in the root of the test folder

* Fix a couple possible segfaults base on strange usage (WPT stuff)

* generate proper JSON

* generate proper JSON (for real this time?)

* fix tag type check
2025-05-03 07:53:02 +08:00
Karl Seguin
ddd0a42b26 add crypto web api 2025-05-03 07:52:12 +08:00
Pierre Tachoire
f884627927 cdp: sent setchildnodes once per node 2025-05-02 22:10:26 +02:00
Pierre Tachoire
9373cf9cf6 cdp: refacto sendChildNodes 2025-05-02 21:55:14 +02:00
Pierre Tachoire
f04030904e cdp: fix tests for setchildnodes 2025-05-02 15:55:49 +02:00
Pierre Tachoire
271b2a0417 Merge pull request #591 from lightpanda-io/element_matches
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / puppeteer-perf (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
wpt / web platform tests (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / browser fetch (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
add Element.matches web api
2025-05-02 11:57:55 +02:00
Karl Seguin
a4f7393fc8 Merge pull request #590 from lightpanda-io/zig_fmt
zig fmt
2025-05-02 16:40:24 +08:00
Karl Seguin
8f851beda1 add Element.matches web api 2025-05-02 16:30:49 +08:00
Karl Seguin
4489efa8d9 zig fmt 2025-05-02 16:03:13 +08:00
Pierre Tachoire
8b9084cb73 cdp: dispatch the correct dom hierarchy wit setChildNodes 2025-05-01 19:42:04 +02:00
Pierre Tachoire
1146453dc2 cdp: add session to setChildNodes event 2025-05-01 16:51:02 +02:00
Pierre Tachoire
bd54395948 Merge pull request #588 from lightpanda-io/custom_events
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / puppeteer-perf (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
wpt / web platform tests (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / browser fetch (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
Add CustomEvent api
2025-05-01 16:29:57 +02:00
Karl Seguin
89ac27ba97 Add CustomEvent api 2025-05-01 19:33:22 +08:00
Karl Seguin
74eaee53a4 Merge pull request #585 from lightpanda-io/union_params
Support union parameters
2025-05-01 19:20:21 +08:00
Karl Seguin
20e4261aa7 Support union parameters
There's ambiguity in mapping due to the flexible nature of JavaScript. Hopefully
most types are unambiguous, like a string or am *parser.Node.

We need to "probe" each field to see if it's a possible candidate for the JS
value. On a perfect match, we stop probing and set the appropriate union field.
There are 2 levels of possible matches: candidate and coerce. A "candidate"
match has higher precedence. This is necessary because, in JavaScript, a lot
of things can be coerced to a lot of other, seemingly wrong, things.

For example, say we have this union:

a: i32,
b: bool,

Field `a` is a perfect match for the value 123. And field b is a coerce match
(because, yes, 123 can be coerced to a boolean). So we map it to `a`.

Field `a` is a candidate match for the value 34.2, because float -> int are both
"Numbers" in JavaScript. And field b is a coerce match. So we map it to `a`.

Both field `a` and field `b` are coerce matches for "hello". So we map it to `a`
because it's declared first (this relies on how Zig currently works, but I don't
think the ordering of type declarations is guaranteed, so that's an issue).
2025-05-01 18:31:55 +08:00
Pierre Tachoire
312189fbde Merge pull request #586 from lightpanda-io/cancel_via_lookup
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / puppeteer-perf (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
wpt / web platform tests (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / browser fetch (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
Change the Linux cancel implementation to match MacOS'
2025-05-01 10:18:35 +02:00
Karl Seguin
d05063ec61 Merge pull request #579 from lightpanda-io/console
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / puppeteer-perf (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
wpt / web platform tests (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / browser fetch (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
add console web api
2025-05-01 09:50:37 +08:00
Karl Seguin
47c14db54c Merge pull request #577 from lightpanda-io/unified_intrusive_events
Unify the Zig and JS events using an intrusive node.
2025-05-01 09:50:19 +08:00
Karl Seguin
f0e0650244 Merge pull request #568 from lightpanda-io/notifications
Introduce more general notification capabilities
2025-05-01 09:50:06 +08:00
Pierre Tachoire
d2a68e62e9 cdp: add attributes to the node's writer 2025-04-30 15:56:06 +02:00
Pierre Tachoire
09fbbc1e17 netsurf: node's attributes can be null 2025-04-30 15:55:34 +02:00
Karl Seguin
8971822247 Change the Linux cancel implementation to match MacOS'
cancel on linux was a "real" cancel, but the implementation was unsafe. It took
whatever `id` it was given and @ptrFromInt'd it. This is problematic since the
`id` is user-supplied with virtually no validation.

Using the existing MacOS canceled lookup seems both easier and safer than trying
to validate the cancellation id.
2025-04-30 21:41:52 +08:00
Karl Seguin
1f0d1920bf Merge branch 'main' into unified_intrusive_events 2025-04-30 21:32:34 +08:00
Karl Seguin
cb7c8502b0 add console web api 2025-04-30 20:50:31 +08:00
Karl Seguin
27d1f79839 Merge pull request #583 from lightpanda-io/share-state-and-global-with-the-isolated
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / puppeteer-perf (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
wpt / web platform tests (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / browser fetch (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
Share underlying DOM global Window with the isolated World
2025-04-30 19:55:14 +08:00
sjorsdonkers
83ef21e699 page handlescope clarification 2025-04-30 12:01:56 +02:00
Karl Seguin
6c592669da Introduce more general notification capabilities
Replaces the existing, very specialized Notification with something more
general.

Currently, the existing page_navigate and page_navigated have been migrated.

Telemetry's page navigation event now also hooks into these events to generate
the telemetry record.
2025-04-30 17:33:51 +08:00
Pierre Tachoire
88f7687646 cdp: dispatch DOM.setChildNodes on performSearch 2025-04-30 09:19:59 +02:00
Pierre Tachoire
f12a527ae3 cdp: add ParentId to Node.Writer 2025-04-30 09:01:56 +02:00
sjorsdonkers
7dde0be043 share sessionstate and underlying DOM global with the isolated 2025-04-29 23:17:39 +02:00
Pierre Tachoire
2910f4f527 Merge pull request #581 from lightpanda-io/svgelement_dummy2
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / puppeteer-perf (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
wpt / web platform tests (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / browser fetch (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
Svgelement dummy2
2025-04-29 18:50:16 +02:00
Pierre Tachoire
93c0df33c2 Merge pull request #578 from lightpanda-io/scope_tightening
Reorganize v8 contexts and scope
2025-04-29 18:46:31 +02:00
sjorsdonkers
7d9f6eef27 instanceof svgelement test 2025-04-29 18:11:47 +02:00
sjorsdonkers
7d742d62b8 SVGElement dummy 2025-04-29 18:11:47 +02:00
sjorsdonkers
4db80cb9e7 Adopt state into the isolated world 2025-04-29 18:10:55 +02:00
Pierre Tachoire
addfbcb68f Merge pull request #582 from lightpanda-io/remove_main_shell
Remove unused main_shell
2025-04-29 17:31:42 +02:00
sjorsdonkers
fac46d9d0b Redo resolveNode 2025-04-29 16:56:50 +02:00
sjorsdonkers
e38ff08de2 Remove unused main_shell 2025-04-29 14:43:14 +02:00
sjorsdonkers
c31e2d91dd Remove global scope 2025-04-29 11:59:14 +02:00
Karl Seguin
7309fec51d Fully fake contextCreated
emit contextCreated when it's needed, not when it actually happens.

I thought we could make this sync-up, but we'd need to create 3 contexts to
satisfy both puppeteer and chromedp. So rather than having it partially
driven by notifications from Browser, I rather just fake it all for now.
2025-04-29 13:29:42 +08:00
Karl Seguin
2e01fa738a Make undefined->null safer, and apply the same trick to BrowserContext 2025-04-29 11:28:43 +08:00