Commit Graph

1567 Commits

Author SHA1 Message Date
Pierre Tachoire
7f308f59b4 test: re-introduce js source name
Having a js source name is useful to detect where the error comes from.

Using `null` generates messages with `<anonymous>` source name.
eg. `ReferenceError: report is not defined\n    at <anonymous>:1:1`
vs. `ReferenceError: report is not defined\n    at teststatus:1:1`
2025-04-17 10:08:13 +02:00
Karl Seguin
f4e8bb6c66 Re-introduce postAttach
index_get seems to be ~1000x slower than setting the value directly on the
v8.Object. There's a lot of information on "v8 fast properties", and values
set directly on objects seem to be heavily optimized. Still, I can't imagine
indexed properties are always _that_ slow, so I must be doing something wrong.
Still, for now, this brings back the original functionality / behavior / perf.

Introduce the ability for Zig functions to take a Env.JsObject parameter. While
this isn't currently being used, it aligns with bringing back the postAttach /
JSObject functionality in main.

Moved function *State to the end of the function list (making it consistent with
getters and setters). The optional Env.JsObject parameter comes after the
optional state.

Removed some uncessary arena deinits from a few webapis.
2025-04-17 09:26:37 +08:00
Karl Seguin
e3638053d0 better error messages in WPT report (in line with what main branch is doing) 2025-04-16 19:34:36 +08:00
Karl Seguin
d688d8812d add missing try/catch around loop wait for wpt tests 2025-04-16 19:20:35 +08:00
Karl Seguin
753a093689 zig fmt :| 2025-04-15 21:16:20 +08:00
Karl Seguin
ea6f8ce4d9 Add more tests
Remove index and named setters, since they aren't working, and they aren't
currently needed.
2025-04-15 20:37:59 +08:00
Karl Seguin
180359e148 zig build test --json to get duration/memory stats 2025-04-15 18:49:39 +08:00
Karl Seguin
5816443ad3 improve XHR test reliability 2025-04-15 18:24:43 +08:00
Karl Seguin
e9fce9223e add some debug lines to see if we can fix the github action 2025-04-15 15:42:55 +08:00
Karl Seguin
f6c43eaf9c Fix dockerfile (hopefully)
Add dummy --json stats output to tests

Comment typos fixed

Add make get-v8, build-v8 and build-v8-dev make targets
2025-04-15 15:18:06 +08:00
Karl Seguin
8af71be551 Import some of the zig-js-runtime env tests
- Fix passing nothing into variadic (i.e. slice) parameter
- Optimize @sizeOf(T) == 0 types by avoiding uncessary allocations
  (something zig-js-runtime is doing)
2025-04-15 15:18:06 +08:00
Karl Seguin
9e36702eb2 Improve documentation
Remove Env from caller, and don't store Env in isolate. We don't need it, we
can execute all runtime code from the Executor (which we store a pointer to
in the v8.Context)
2025-04-15 15:18:06 +08:00
Karl Seguin
cda6f89dba work on fixing github workflows 2025-04-15 15:18:06 +08:00
Karl Seguin
b8d7744563 replace zig-js-runtime 2025-04-15 15:18:04 +08:00
Karl Seguin
25dcae7648 Merge pull request #529 from lightpanda-io/document-cookie
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
Document cookie
2025-04-11 23:34:44 +08:00
Pierre Tachoire
ee6382ef03 dom: use cookie jar's allocator to parse cookie 2025-04-11 16:23:03 +02:00
Pierre Tachoire
0310192660 dom: assume we are using an arena for cookie 2025-04-11 14:27:08 +02:00
Pierre Tachoire
c88bc65379 cookie: use a ; w/o space for cookie separator in requests 2025-04-11 12:40:16 +02:00
Pierre Tachoire
37340dc549 dom: implement document.cookie 2025-04-11 12:19:11 +02:00
Pierre Tachoire
9b6764a852 Merge pull request #527 from lightpanda-io/update-cla
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 bornlex to cla whitelist
2025-04-11 11:14:46 +02:00
Pierre Tachoire
b176857b8d add bornlex to cla whitelist 2025-04-11 11:14:01 +02:00
Pierre Tachoire
f034065247 Merge pull request #520 from lightpanda-io/navigate_notifications
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
Communicate page navigation state via notifications
2025-04-10 13:42:30 +02:00
Karl Seguin
64bd4dee38 Merge pull request #523 from lightpanda-io/url-about-blank
url: accept about:blank
2025-04-10 19:15:04 +08:00
Pierre Tachoire
22307239ae url: accept about:blank 2025-04-10 13:00:14 +02:00
Karl Seguin
3fc7ffadbf rename ts => timestamp, ctx => notify_ctx 2025-04-10 18:27:14 +08:00
Pierre Tachoire
b87a80a32d Merge pull request #521 from lightpanda-io/remove_wpt_env_wait
Remove the WPT js_env.wait() on error.
2025-04-10 11:40:33 +02:00
Karl Seguin
c775de260a Remove the WPT js_env.wait() on error.
40c0c7d421

Makes it unecessary as wait is now always called on deinit.
2025-04-10 16:30:44 +08:00
Karl Seguin
30fd358286 improve playwright pafe lifecycle message compatibility 2025-04-10 16:07:31 +08:00
Karl Seguin
71c3d484a9 Communicate page navigation state via notifications
In order to support click handling on anchors from JavaScript, we need some hook
from the page/session to the CDP instance. This first phase adds notifications
in page.navigate, as well as a primitive notification hook to the session.

CDP's existing Page.navigate uses this new notifiation system.
2025-04-10 14:25:19 +08:00
Pierre Tachoire
66bac32e33 Merge pull request #519 from lightpanda-io/url
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 URL struct
2025-04-09 16:43:44 +02:00
Pierre Tachoire
4f0ea888ef Merge pull request #513 from lightpanda-io/resolveNode
Resolve node
2025-04-09 15:00:35 +02:00
Pierre Tachoire
bc1a83d04a Update src/cdp/domains/dom.zig 2025-04-09 14:46:53 +02:00
sjorsdonkers
32d9fc0d32 Pass objectGroup as groupName 2025-04-09 13:40:00 +02:00
Karl Seguin
41bd3704ef update lightpanda and wpt URL usage 2025-04-09 19:21:59 +08:00
Karl Seguin
be75b5b237 Add URL struct
Combine uri + rawuri into single struct.

Try to improve ownership around URIs and URI-like things.
 - cookie & request can take *const std.Uri
   (TODO: make them aware of the new URL struct?)
 - Location (web api) should own its URL (web api URL)
 - Window should own its Location

Most of these changes result in (a) a cleaner Page and (b) not having to carry
around 2 nullable objects (URI and rawuri).
2025-04-09 18:19:07 +08:00
sjorsdonkers
3a7da6665f unittest scaffolding 2025-04-09 11:33:44 +02:00
sjorsdonkers
2f47e04de7 Use findOrAddValue for precise JsValue 2025-04-09 11:33:41 +02:00
sjorsdonkers
7dc3add5fd reolveNode WIP 2025-04-09 11:32:23 +02:00
Pierre Tachoire
8b296534a4 Merge pull request #517 from lightpanda-io/wpt-fix
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
Wpt fix
2025-04-09 08:39:18 +02:00
Karl Seguin
f9c4cefe59 Update zig-js-runtime, wait for loop on wpt error
Updates zig-js-runtime to latest, reverting the loop reset change. This solves
the introduced memory leak.

On WPT error, call js_env.wait() to ensure all pending events are completed.
Without this, on error, the code is likely to crash as the timeout callback
executes AFTER env.deinit() is called. This is now possible to do safely on
Mac now that cancel is pseudo-implemented.
2025-04-09 09:01:04 +08:00
Pierre Tachoire
d772eaf4a2 upgrade zig-jsruntime 2025-04-08 17:34:56 +02:00
Pierre Tachoire
27ec1a13da wpt: add missing renderer 2025-04-08 17:34:18 +02:00
Pierre Tachoire
07e8dfa257 Merge pull request #501 from karlseguin/renderer
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 a dumb renderer to get coordinates
2025-04-08 17:12:49 +02:00
Karl Seguin
0fbf48ab4d actually dispatch click 2025-04-08 22:51:19 +08:00
Karl Seguin
f38a0d2d67 Remove BrowserContext URL
Add BrowserContext.getURL which gets the URL from the session.page.
2025-04-08 22:51:17 +08:00
Karl Seguin
b76875bf5d use netsurf's mousevent 2025-04-08 22:43:53 +08:00
Karl Seguin
0253de80de Add a dumb renderer to get coordinates
FlatRenderer positions items on a single row, giving each a height and width of
1.

Added getBoundingClientRect to the DOMelement which, when requested for the
first time, will place the item in with the renderer.

The goal here is to give elements a fixed position and to make it easy to map
x,y coordinates onto an element. This should work, at least with puppeteer,
since it first requests the boundingClientRect before issuing a click.
2025-04-08 22:43:53 +08:00
Pierre Tachoire
647575261e Merge pull request #515 from karlseguin/html_document_subtype
add 'node' subtype to htmldocument
2025-04-08 15:45:40 +02:00
Pierre Tachoire
3c2b348ce5 Merge pull request #502 from lightpanda-io/cdp_node_children
Cdp node children
2025-04-08 15:45:16 +02:00
Karl Seguin
8aef6ca372 add 'node' subtype to htmldocument 2025-04-08 10:40:52 +08:00