Commit Graph

2021 Commits

Author SHA1 Message Date
Karl Seguin
73a59dcd7d Move jsValueToZig from Caller to the Scope
Caller is a transient object that exists only for calling Zig functions from
JS. But jsValueToZig is more generally useful and can be used outside of an
explicit JS call. The scope is a better place for these as it's generally
referenced already by any code that would need to map values (i.e. a Callback).
2025-05-21 18:32:50 +08:00
Karl Seguin
3a15790847 Merge pull request #671 from lightpanda-io/webapi_destructor
Allow webapis to register a destructor to do cleanup on scope (page) end
2025-05-21 18:09:42 +08:00
sjorsdonkers
3f31573bcb No need to navigate to about:blank 2025-05-21 09:43:15 +02:00
sjorsdonkers
967ab18d53 default:blank as default document 2025-05-21 09:43:15 +02:00
sjorsdonkers
0929bd217d load aboutblank doc 2025-05-21 09:43:15 +02:00
Karl Seguin
ce832a8063 Rollback XHR/HTTP.client change
This PR will be only for having the destructor hook. XHR/http.client changes to
leverage this will be done in a subsequent PR.
2025-05-21 11:38:26 +08:00
Karl Seguin
fc0281b563 Merge pull request #665 from lightpanda-io/log_debug
Tweak debug logging
2025-05-21 09:03:06 +08:00
Karl Seguin
f42bd02cfc Don't crash on success
Keep request around, as the http/client needs it for cleanup. Calling abort
on an already deinit'd request is safe.
2025-05-20 19:22:43 +08:00
Karl Seguin
52634ddeb3 Allow webapis to register a destructor to do cleanup on scope (page) end
Add destructor to XHR to abort any inflight requests.
2025-05-20 18:56:22 +08:00
Karl Seguin
ed79b4ebd8 FormData constructor form & submitter parameter
FormData takes two optional parameters: a form and a submitter.

Building the FormData from these is a first step in supporting form submission.

Basic extension of the HTMLForm element. There was more work done on the Select
web api, because the netsurf implementation isn't great. But all of the input
elements will need to have their web api extended.
2025-05-20 18:18:03 +08:00
Pierre Tachoire
36ca7839d6 Merge pull request #666 from lightpanda-io/playwright-support-disclaimer
Playwright support disclaimer
2025-05-20 10:20:13 +02:00
Pierre Tachoire
fa5d583657 fix space 2025-05-20 10:19:56 +02:00
Sjors
5e67f09583 Disclaimer feedback 2025-05-20 09:48:08 +02:00
Sjors
8b74d96f12 Playwright support disclaimer 2025-05-20 09:26:51 +02:00
Karl Seguin
769d99e7bd Tweak debug logging
1 - Add a log_level build option to control the default log level from
    the build (e.g. -Dlog_level=debug). Defaults to info

2 - Add a new boolean log_unknown_properties build option to enable
    logging unknown properties. Defautls to false.

3 - Remove the log debug for script eval - this can be a huge value
    (i.e. hundreds of KB), which makes the debug log unusable IMO.
2025-05-20 11:29:14 +08:00
Karl Seguin
812f4d2699 Merge pull request #650 from lightpanda-io/http_client_async_gzip
Add support for gzip responses in AsyncHandler
2025-05-20 11:26:58 +08:00
sjorsdonkers
f95defe82f Do not getComputedStyle 2025-05-19 17:52:00 +02:00
sjorsdonkers
226dafa9e3 refix rebase regressions 2025-05-19 16:53:59 +02:00
sjorsdonkers
6c92d50c68 elementsFromPoint cleanup 2025-05-19 16:53:59 +02:00
sjorsdonkers
384e74fe7e Also return body and html elements 2025-05-19 16:53:59 +02:00
sjorsdonkers
216f6cc8e8 handle detached elements 2025-05-19 16:53:59 +02:00
sjorsdonkers
333c377bc7 make elementFromPoint more robust against future changes 2025-05-19 16:53:59 +02:00
sjorsdonkers
59b33faf61 confirm data is retained in elementFromPoint 2025-05-19 16:53:59 +02:00
sjorsdonkers
b87003427c fix unset heap_ptr 2025-05-19 16:53:59 +02:00
sjorsdonkers
cb48000df7 elementsFromPoint 2025-05-19 16:53:59 +02:00
Pierre Tachoire
58cc5d8d1a Merge pull request #660 from lightpanda-io/implementation-update
implementation: remove the setTitle method call
2025-05-19 16:14:46 +02:00
Karl Seguin
39799d3006 Merge pull request #662 from lightpanda-io/fix_broken_test_build
fix broken test build
2025-05-19 22:14:16 +08:00
Karl Seguin
73bf4479b5 fix broken test build 2025-05-19 22:03:34 +08:00
Pierre Tachoire
9f0f84bbee Merge pull request #658 from lightpanda-io/ready_state
Add document.readyState
2025-05-19 15:49:31 +02:00
Karl Seguin
1ff422a29c Merge pull request #659 from lightpanda-io/dedup-document
Deduplicate document
2025-05-19 19:07:16 +08:00
Pierre Tachoire
8daa525cc1 implementation: remove the setTitle method call
Libdom uses the doc's body and title attributes by default.
But it fallback to the DOM tree if the attributes are NULL.

I think it's better to have only the DOM tree set on document creation.
2025-05-19 12:16:07 +02:00
sjorsdonkers
76f1fcb634 dedup document 2025-05-19 11:35:29 +02:00
Karl Seguin
2b6cf95752 Add document.readyState
To support this, add the ability to embedded data into libdom nodes, so that
we can extend libdom without having to alter it.
2025-05-19 16:48:11 +08:00
Pierre Tachoire
a99d193b12 Merge pull request #653 from lightpanda-io/document_default_view
add defaultView getter to HTMLDocument
2025-05-19 10:19:54 +02:00
Pierre Tachoire
a3b576abd8 Merge pull request #656 from lightpanda-io/module-exception
module: report module's evaluation error
2025-05-17 11:17:28 +02:00
Pierre Tachoire
2261eac288 expection: fix non-nullable return 2025-05-17 11:02:37 +02:00
Karl Seguin
9366729d7a Merge pull request #655 from lightpanda-io/dom-parser
Some checks failed
e2e-test / zig build release (push) Waiting to run
e2e-test / puppeteer-perf (push) Blocked by required conditions
e2e-test / demo-scripts (push) Blocked by required conditions
zig-test / zig build dev (push) Waiting to run
zig-test / browser fetch (push) Blocked by required conditions
zig-test / zig test (push) Waiting to run
zig-test / perf-fmt (push) Blocked by required conditions
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 DOMParser
2025-05-17 09:56:32 +08:00
Karl Seguin
ad1a4fe450 Merge pull request #652 from lightpanda-io/transfer_arena
Introduce a "transfer_arena"
2025-05-17 09:44:21 +08:00
Pierre Tachoire
9f97725894 module: report module's evaluation error 2025-05-16 20:27:41 +02:00
Muki Kiboigo
bff3d27518 add DOMParser 2025-05-16 09:56:18 -07:00
Karl Seguin
2bc1192ad3 reduce lifetime of transfer_arena 2025-05-16 22:04:13 +08:00
Karl Seguin
f165131da8 add defaultView getter to HTMLDocument 2025-05-16 20:33:28 +08:00
Karl Seguin
afd29fef81 Merge pull request #651 from lightpanda-io/html_all_collection
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
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 HTMLAllCollection
2025-05-16 17:26:26 +08:00
Karl Seguin
071a4f97e5 Introduce a "transfer_arena"
Some data has to exist specifically for the navigation of one page to another.
For example, if a hyperlink is clicked, the URL begins its life with the
original page, but is transferred to the new page. The page_arena cannot be used
for such data.

It's possible to use the session_arena, but it's lifetime is much longer and,
given enough navigation, could accumulate a lot of memory.

The new transfer_arena exists within the session, but only exists until the
next navigation.

While currently only used for the navigation URL, the main goal here is to have
a place to put the request body on form submission, which has a lifetime similar
to a click url.

While I'm at it, I promoted the existing session arena and the new transfer
arena to the browser, allowing better memory re-use between sessions.
2025-05-16 15:53:25 +08:00
Karl Seguin
04c990de89 Merge pull request #649 from lightpanda-io/html_collection_named_properties
Fix HTMLCollection named property issues
2025-05-16 14:47:02 +08:00
Karl Seguin
b08ffcc437 Rework HTMLAllCollection
Capture its unique properties:
1- instances are falsy, and
2- instance can be called as a function

The behavior is used for browser detection (i.e. duckduckgo treats us as a
legacy browser because we document.all != false)
2025-05-16 13:39:27 +08:00
Karl Seguin
7156df8d9a Add support for gzip responses in AsyncHandler
Compliments https://github.com/lightpanda-io/browser/pull/601 which added this
behavior to the SyncHandler.
2025-05-16 12:51:53 +08:00
Karl Seguin
1a83e69669 Fix HTMLCollection named property issues
1 - Named properties should not be enumerable
2 - Empty key should always result in a null/undefined (depending on the API)
    even if there's an element with an empty id/name

To address the first issue, we now require PropertyAttributes to be specified
when setting an object's value.
2025-05-16 11:31:52 +08:00
Karl Seguin
210d4f6aa1 Merge pull request #620 from lightpanda-io/upgrade_v8
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
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
Upgrade v8
2025-05-16 08:17:15 +08:00
Karl Seguin
b559506d4e remove unecessary space 2025-05-16 08:10:16 +08:00