Commit Graph

2104 Commits

Author SHA1 Message Date
Muki Kiboigo
9f4ee7d6a8 update nixpkgs to 25.05 2025-06-03 10:44:03 -07:00
sjorsdonkers
7da83d2259 fix makebuilddev 2025-06-03 16:25:35 +02:00
sjorsdonkers
ceb9453006 Simplify testing 2025-06-03 16:04:31 +02:00
Karl Seguin
7091b37f3a Make stacktraces available in debug via page.stackTrace()
Automatically include the stack trace in a `console.error` output. This is
useful because code frequently does:

```
  try blah();
  catch (e) console.log(e);
```

Which we log, but, without this, don't get the stack.
2025-06-03 20:40:40 +08:00
Karl Seguin
18e6f9be71 Detached node can't have focus.
Refactor isNodeAttached because of the "law of three."
2025-06-03 20:25:15 +08:00
sjorsdonkers
19d40845a4 input prop testing 2025-06-03 14:11:35 +02:00
Karl Seguin
211ce20132 Add document.activeElement and HTMLElement.focus() 2025-06-03 20:10:33 +08:00
sjorsdonkers
275b97948b input element properties 2025-06-03 14:08:54 +02:00
Karl Seguin
13d602a9e0 Rework/fix URLSearchParams
Extracts the FormData logic, which is both more complete and more correct and
reuses it between FormData and URLSearchParams.

This includes the additional iterator behavior, `set` and URLSearchParams
constructor from FormData.
2025-06-03 20:01:01 +08:00
Francis Bouvier
69215e7d27 Merge pull request #751 from lightpanda-io/dummy_window_scroll_to
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
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / 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
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
add noop window.scrollTo
2025-06-03 13:49:29 +02:00
Karl Seguin
7e8df34681 add noop window.scrollTo 2025-06-03 18:43:35 +08:00
Karl Seguin
6451065c77 Poor support for functions/namespaces.
If you look at the specification for `console` [1], you'll note that it's a
namespace, not an interface (like most things). Furthermore, MDN lists its
methods as "static".

But it's a pretty weird namespace IMO, because some of its "functions", like
`count` can have state associated with them.

This causes some problems with our current implementation. Something like:

```
[1].forEach(console.log)
```

Fails, since `this` isn't our window-attached Console instance.

This commit introducing a new `static_XYZ` naming convention which does not
have the class/Self as a receiver:

```
pub fn static_log(values: []JsObject, page: *Page) !void {
```

This turns Console into a namespace for these specific functions, while still
being used normally for those functions that require state.

We could infer this behavior from the first parameter, but that seems more
error prone. For now, I prefer having the explicit `static_` prefix.

[1] https://console.spec.whatwg.org/#console-namespace
2025-06-03 14:40:10 +08:00
Karl Seguin
bde8c54e7e Merge pull request #748 from lightpanda-io/test_leak
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
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / 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
fix leak in test
2025-06-03 10:58:53 +08:00
Karl Seguin
97b17af056 fix leak in test 2025-06-03 10:49:52 +08:00
Karl Seguin
9c2e3e2c76 Merge pull request #740 from lightpanda-io/fix_anchor_href
Fix anchor href
2025-06-03 10:47:25 +08:00
Karl Seguin
3c637872f2 Merge pull request #743 from lightpanda-io/default_timeout_10s
Increase default timeout from 3s to 10s.
2025-06-03 10:47:10 +08:00
Karl Seguin
4c8e2a1258 Setting anchor href should consider document.url 2025-06-03 09:58:26 +08:00
Karl Seguin
e5a76d737c Increase default timeout from 3s to 10s.
The wait_for_network_idle demo often times out for me. I don't see any reason
to have the default so low. More likely to cause user scripts to unnecessarily
fail.
2025-06-03 09:57:51 +08:00
Karl Seguin
a482d5998d Merge pull request #739 from lightpanda-io/url_constructor
Fix url constructor
2025-06-03 09:55:47 +08:00
Karl Seguin
12bc540ec9 Merge pull request #744 from lightpanda-io/dockerfile_zig_path_fix
Update zig filename for new pattern used in 0.14.1+
2025-06-03 09:52:25 +08:00
Karl Seguin
b6a37f6fb8 Merge pull request #747 from lightpanda-io/fix_crash_on_error_exit
fix a silly log crash on exit error
2025-06-03 09:52:08 +08:00
Karl Seguin
bbdb25420a Merge pull request #746 from lightpanda-io/null_object_guard
Guard against null object when trying to fetch a function
2025-06-03 09:51:54 +08:00
Karl Seguin
e3099a16d4 fix a silly log crash on exit error 2025-06-02 23:34:09 +08:00
Karl Seguin
167fe5f758 Guard against null object when trying to fetch a function 2025-06-02 23:27:29 +08:00
Karl Seguin
36f59da7cc Update zig filename for new pattern used in 0.14.1+
https://github.com/lightpanda-io/browser/issues/711
2025-06-02 21:59:09 +08:00
Karl Seguin
1ac23ce191 Merge pull request #735 from lightpanda-io/improved_logging
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
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / 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
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
Improved logging
2025-06-02 21:53:51 +08:00
Karl Seguin
a000dfe676 include stack trace in JS function call log errors 2025-06-02 21:43:24 +08:00
Karl Seguin
9e834e0db5 Revert "experiment with reducing retained arena size"
This reverts commit 2f6b4c04da3e4659a3ebe8bcb9195f4625feaa16.
2025-06-02 21:43:20 +08:00
Karl Seguin
021fc8fb59 experiment with reducing retained arena size 2025-06-02 21:41:53 +08:00
Karl Seguin
625fa03c22 fix tests 2025-06-02 21:38:57 +08:00
Karl Seguin
6e80b03faa Improve script logging
1 - Add a custom console.lp function to make our debug logs stand out from
    script logs.

2 - In some cases, significantly improve how JavaScript values are serialized
    in debug logs and in console.log.
2025-06-02 21:38:57 +08:00
Karl Seguin
c3f3eea7fb Improve logging
1 - Make log_level a runtime option (not a build-time)
2 - Make log_format a runtime option
3 - In Debug mode, allow for log scope filtering

Improve the general usability of scopes. Previously, the scope was more or less
based on the file that the log was in. Now they are more logically grouped.
Consider the case where you want to silence HTTP request information, previously
you'd have to filter out the `page`, `xhr` and `http_client` scopes, but that
would also elimiate other page, xhr and http_client logs. Now, you can just
filter out the `http` scope.
2025-06-02 21:38:56 +08:00
Karl Seguin
47da5e0338 Merge pull request #737 from lightpanda-io/release_fast
Run puppeteer-perf using ReleaseFast
2025-06-02 21:20:07 +08:00
Karl Seguin
2ef7ea6512 change stitch alloc default to .always 2025-06-02 19:24:08 +08:00
Karl Seguin
6b1f2c0ed2 Merge pull request #741 from lightpanda-io/2xx_status
Allow any 2xx status code for scripts
2025-06-02 19:20:59 +08:00
Karl Seguin
bb465ed1ed Allow any 2xx status code for scripts
DDG will sometimes return a 202 for its result javascript, meaning it isn't
ready and the rest of the JS will then handle that case. It's weird, but there's
no reason for us to abort on a 2xx code.
2025-06-02 17:20:28 +08:00
Karl Seguin
ac75f9bf57 Fix url constructor
url, base were being joined in the wrong order. Switch to using URL.stitch if
a base is given.
2025-06-02 16:43:01 +08:00
Karl Seguin
c80deeb5ec Merge pull request #738 from lightpanda-io/buttons_submit_form
Submit input and button submits can now submit forms
2025-06-02 16:30:51 +08:00
sjorsdonkers
1b87f9690c remove superflous text 2025-06-02 10:23:06 +02:00
sjorsdonkers
e799fcd48a xmlserializer for doctype 2025-06-02 10:23:06 +02:00
Karl Seguin
4644e55883 Do not reset transfer_arena if page navigation results in delayed navigation
We normally expect a navigation event to happen at some point after the page
loads, like a puppeteer script clicking on a link. But, it's also possible for
the main navigation event to result in a delayed navigation. For example, an
html page with this JS:

<script>top.location = '/';</script>

Would result in a delayed navigation being called from the main navigate
function. In these cases, we cannot clear the transfer_arena when navigate is
completed, as its memory is needed by the new "sub" delayed navigation.
2025-06-02 14:16:36 +08:00
Karl Seguin
747a8ad09c Submit input and button submits can now submit forms 2025-06-02 11:27:44 +08:00
Karl Seguin
32dc19cb1c Run puppeteer-perf using ReleaseFast 2025-06-01 19:30:33 +08:00
Karl Seguin
527579aef4 Merge pull request #720 from lightpanda-io/clean_xhr_shutdown
Some checks failed
e2e-test / zig build release (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
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / 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
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
Clean Http Request Shutdown
2025-05-31 07:51:11 +08:00
Karl Seguin
1869ef0c38 Merge pull request #734 from lightpanda-io/url_resolve_buffer_size
increase buffer size 1024->4096
2025-05-31 07:50:57 +08:00
Karl Seguin
e7007b4231 fix test 2025-05-31 07:31:05 +08:00
Karl Seguin
6ca57c1f8c Merge pull request #723 from lightpanda-io/form_submit
Form submit
2025-05-31 07:23:49 +08:00
Karl Seguin
f2f7a349ce Merge pull request #715 from lightpanda-io/location_change
Implement location.reload(), location.assign() and location setter
2025-05-31 07:23:36 +08:00
Karl Seguin
f696aa3748 Merge pull request #726 from lightpanda-io/fix_set_innerhtml_and_html_collection
Fix set_innerHTML, fix HTMLCollection fixed (postAttached) return type
2025-05-31 07:23:24 +08:00
Karl Seguin
f35e3ec78a Merge pull request #725 from lightpanda-io/dynamic_script_onload
Execute onload for dynamic script
2025-05-31 07:23:14 +08:00