Commit Graph

1644 Commits

Author SHA1 Message Date
Karl Seguin
ba0505c13c Merge pull request #571 from lightpanda-io/remove-log.zig
Remove log.zig
2025-04-25 08:47:30 +08:00
Karl Seguin
dd8432e8fd Merge pull request #572 from lightpanda-io/framenavigated-order
cdp: dispatch Page.frameNavigated before DOM.documentUpdated
2025-04-25 08:47:07 +08:00
Pierre Tachoire
11c7f57745 cdp: dispatch Page.frameNavigated before DOM.documentUpdated
chromedp client expects to receive Page.frameNavigated before
DOM.documentUpdated.
2025-04-24 18:28:43 +02:00
sjorsdonkers
89a3fac316 log.zig does not appear to be used 2025-04-24 15:17:16 +02:00
Pierre Tachoire
332508f563 Merge pull request #567 from lightpanda-io/kind_before_deinit
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
access the executor kind before it becomes invalid
2025-04-24 10:43:37 +02:00
Karl Seguin
158d11e93c access the executor kind before it becomes invalid 2025-04-24 16:36:04 +08:00
Pierre Tachoire
18a49601a0 Merge pull request #566 from lightpanda-io/null_prefix_namespace
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
pass null namespace/prefix to libdom
2025-04-24 09:27:03 +02:00
Karl Seguin
b971b4754f update libdom to latest version, fixing null ptr usage and stack overflow 2025-04-24 15:18:22 +08:00
Pierre Tachoire
cfef22257e Merge pull request #560 from lightpanda-io/remove_arena_frees
Remove unnecessary cleanup when we know we have an arena
2025-04-24 09:04:46 +02:00
Karl Seguin
3153d8ee8c pass null namespace/prefix to libdom 2025-04-24 11:52:01 +08:00
sjorsdonkers
b2a975fe4a remove executionContextCreated
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
2025-04-23 17:00:22 +02:00
sjorsdonkers
b2ba505954 Check if it works with v8 97bcfb6 2025-04-23 17:00:22 +02:00
sjorsdonkers
a1b673175a errdefer in the right scope 2025-04-23 17:00:22 +02:00
sjorsdonkers
d666de07a7 test scaffolding 2025-04-23 17:00:22 +02:00
sjorsdonkers
64508cec61 Executor World kind 2025-04-23 17:00:22 +02:00
sjorsdonkers
e0bcb625c2 browsercontext arena 2025-04-23 17:00:22 +02:00
sjorsdonkers
9534e765e5 refix page.contextCreated 2025-04-23 17:00:22 +02:00
sjorsdonkers
39124d2878 text fix 2025-04-23 17:00:22 +02:00
sjorsdonkers
9ae4d66194 page cleanup 2025-04-23 17:00:22 +02:00
sjorsdonkers
09850d7500 Fix executor used in resolveNode 2025-04-23 17:00:22 +02:00
sjorsdonkers
8897d9179c isolated world 2025-04-23 17:00:22 +02:00
Karl Seguin
2d1b9d64bd Remove unnecessary cleanup when we know we have an arena
Change a few old alloc+memcpy to dupe

Some other smaller cleanups.
2025-04-23 17:52:13 +08:00
Pierre Tachoire
e603a1707c Merge pull request #559 from lightpanda-io/processing_instruction_clone
Manually "clone" processing_instruction
2025-04-23 09:51:33 +02:00
Pierre Tachoire
6b1e7a1c5d Merge pull request #558 from lightpanda-io/node_is_equal
Implement custom isEqualNode
2025-04-23 09:50:43 +02:00
Pierre Tachoire
5acd4b5fd4 Revert "browser: temporary ignore mime sniff"
This reverts commit 0b2c4679fd.
2025-04-23 09:26:10 +02:00
Pierre Tachoire
9e88adb0da Merge pull request #557 from lightpanda-io/fix_peek
peek must check existing data first
2025-04-23 09:25:59 +02:00
Karl Seguin
69eaf0d338 Manually "clone" processing_instruction
When you clone a processing_node via the node_clone_node, or directly via the
processing_node copy, you end up in _dom_pi_copy:
da8b967905/src/core/pi.c (L104)

For whatever, reason, the node created here gets a vtable that doesn't seem
compatible with how we cast vtables in netsurf.zig. For now, a simple fix is
to create a new new and copy the attributes over.

Fixes https://github.com/lightpanda-io/browser/issues/123 and a WPT crash.
2025-04-23 13:31:05 +08:00
Karl Seguin
680de2dca1 Implement custom isEqualNode
Netsurf's dom_node_is_equal appears to be both unsafe and incorrect. It's unsafe
because various node types don't have the dom_node_get_attributes implementation
so they default to setting the node attributes to null:
https://github.com/lightpanda-io/libdom/blob/master/src/core/node.c#L658

However, it doesn't do a NULL check when comparing them, so it crashes:
da8b967905/src/core/namednodemap.c (L312)

Furthermore, specific nodes need to be compared using specific attributes/values.

This PR fixes a WPT crash.
2025-04-23 09:59:57 +08:00
Karl Seguin
837188f8d1 peek must check existing data first 2025-04-23 08:28:20 +08:00
Pierre Tachoire
4a696b4053 Merge pull request #556 from lightpanda-io/mime-sniff-skip
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
browser: temporary ignore mime sniff
2025-04-22 18:55:57 +02:00
Pierre Tachoire
0b2c4679fd browser: temporary ignore mime sniff 2025-04-22 18:47:52 +02:00
Pierre Tachoire
5a08c92d02 Merge pull request #553 from lightpanda-io/mime_sniffing
Try to sniff the mime type based on the body content
2025-04-22 17:25:29 +02:00
Pierre Tachoire
faf93441f6 Merge pull request #555 from lightpanda-io/wpt_filter_non_tests
Don't [try] to run non-tests
2025-04-22 17:00:19 +02:00
Karl Seguin
8aa3608a3c Don't [try] to run non-tests
Currently, we treat every .html file in tests/wpt as-if it's a test. That
isn't always the case. wpt has a manifest tool to generate a manifest (in
JSON) of the tests, we should probably use that (but it's quite large).

This PR filters out two groups. First, everything in resources/ appears to
be things to _run_ the tests, not actual tests.

Second, any file without a "testharness.js" doesn't appear to be a test
either. Note that WPT's own manifest generator looks at this:
43a0615361/tools/manifest/sourcefile.py (L676)
(which is used later in the file to determine the type of file).
2025-04-22 21:05:12 +08:00
Pierre Tachoire
9727a9d000 Merge pull request #547 from lightpanda-io/jsruntime_arenas
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
Re-introduce call_arena
2025-04-22 13:58:16 +02:00
Pierre Tachoire
1b74289c43 Merge pull request #543 from lightpanda-io/describeNode2
descibeNode for new js runtime
2025-04-22 13:57:18 +02:00
sjorsdonkers
a698ff8309 describeNode feedback 2025-04-22 13:49:01 +02:00
sjorsdonkers
5026c48805 Update zig-v8 to v0.1.18 2025-04-22 13:49:00 +02:00
sjorsdonkers
2ac63b6985 describeNode 2025-04-22 13:49:00 +02:00
Karl Seguin
114e11f52a Partially revert some changes.
The call_arena is still re-added, and the call_depth is still used, but
the call_arena and scope_arenas are no longer part of the Env - they remain on
the Executor.

This is to accommodate upcoming changes where multiple executors will exist at
once. While the shared allocators _might_ have been safe in some cases, the
performance gains don't justify the risk of having 2 executors interacting in a
way where sharing the allocators would cause issues.
2025-04-22 16:56:26 +08:00
Karl Seguin
3277d1baac Re-introduce call_arena
Because of callbacks, calls into Zig can be nested. Previously, the call_arena
was reset after _every_ call. When calls are nested, this doesn't work - the
nested call resets the arena, which the caller might still need. A `call_depth`
integer was added to the Executor. Each call starts by incrementing the
call_depth and, on deinit, decrements the call_depth. The call_arena is only
reset when the call_depth == 0. This could result in lower memory use.

Also promoted the call_arena and scope_arena to the Env. Practically speaking,
nothing has changed, since they're still reset under the exact same conditions.
However, when an executor ends and a new one is started, it can now reuse the
retained_capacity of the previous arenas. This should result in fewer
allocations.
2025-04-22 15:20:37 +08:00
Pierre Tachoire
f3d8ec040c Merge pull request #549 from lightpanda-io/type_error_on_non_zig_values
Return TypeError if trying to turn an unknown v8.Object into a toa
2025-04-22 09:14:03 +02:00
Pierre Tachoire
0a29e9b3cf Merge pull request #548 from lightpanda-io/namednodemap_indexed_get
add indexed_get to namednodemap
2025-04-22 09:13:05 +02:00
Pierre Tachoire
4b7c17ac03 Merge pull request #546 from lightpanda-io/jsruntime_js_to_null_terminated_string
Support binding JS strings to [:0]const u8
2025-04-22 09:11:36 +02:00
Pierre Tachoire
1849f4c11d Merge pull request #544 from lightpanda-io/token_list_iterators
Add missing TokenList APIs
2025-04-22 09:03:19 +02:00
Karl Seguin
b9f61466ba Try to sniff the mime type based on the body content
Synchronous body reader now exposes a peek() function to get the first few bytes
from the response body. This will be no less than 100 bytes (assuming the body
is that big), but could be more. Streaming API, via res.next() continues to work
as-is even if peek() is called.

Introduce Mime.sniff() that detects a few common types - the ones that we care
about right now - from the body content.
2025-04-22 10:58:26 +08:00
Karl Seguin
d8fa9b8c4f Return TypeError if trying to turn an unknown v8.Object into a toa 2025-04-20 12:47:28 +08:00
Karl Seguin
42bc80e5b5 add indexed_get to namednodemap 2025-04-19 21:28:16 +08:00
Karl Seguin
9f7446ba56 use allocSentinel (which i didn't know about) 2025-04-19 17:25:01 +08:00
Karl Seguin
7bdea1befa Support binding JS strings to [:0]const u8
Some APIs need a null-terminated string. Currently, they have to ask for a
`[]const u8` and then convert it to a `[:0]const u8`. This is 2 allocations: 1
for jsruntime to get the `[]const u8` from v8, and then one to get the [:0]. By
supporting `[:0]const u8` directly, this is now a single allocation.
2025-04-19 16:19:46 +08:00