Commit Graph

75 Commits

Author SHA1 Message Date
Karl Seguin
3fe28d5441 Optimize memory usage
The two bigger changes here are:

1- The http_client has been moved from the Session to the Browser, allowing
   its connection pool to be re-used across multiple sessions

2- The browser now has a page_arena which is used for all page-level allocation
   and which can be re-used between pages (currently retains 1MB of memory).
   Previously, pages uses an arena that was tied to the lifetime of the page,
   thus it could not be re-used.

Using the Bench allocator for zig-js-runtime, allocated bytes went from
1347037879 to 834932438 (in a RUNS=1000 of puppeteer demo).

Various other changes to try to simplify the API and remove the possibility
of invalid states. For example, session.newPage() now includes the logic for
page.start() so that there should now never be a page that wasn't started.
2025-03-12 13:38:22 +08:00
Karl Seguin
fc0ec860b0 Tweak generate.Tuple and generate.Union
Leverage comptime fields to give generated Tuple a default value, allowing
TupleT and Tuple to be merged.

Only call generate.Tuple on the final output. This eliminates redundant
deduplication, and results in a simpler API (nested types just need to expose
a natural Zig tuple).

generate.Union leverages the new Tuple and removes unused features.
2025-02-01 14:53:00 +08:00
Pierre Tachoire
7b35bb4c0f dom: improve location impl 2025-01-27 12:33:06 +01:00
Pierre Tachoire
318e2bd1c6 dom: expose document.location 2025-01-27 12:33:05 +01:00
Pierre Tachoire
d7069df80d dom: first draft for location 2025-01-23 11:51:05 +01:00
Pierre Tachoire
11d28b0bc3 dom: add placeholder for history interface 2025-01-15 11:45:30 +01:00
Pierre Tachoire
974cf780c0 dom: clean history file 2025-01-14 15:04:40 +01:00
Pierre Tachoire
cb8b80c856 Merge pull request #345 from lightpanda-io/modules
browser: support for modules
2025-01-13 10:45:31 +01:00
Pierre Tachoire
43678f8dc0 upgrade zig-js-runtime 2025-01-13 10:36:34 +01:00
Pierre Tachoire
1587122efa navigator: remove useless import 2025-01-10 17:42:20 +01:00
Pierre Tachoire
2af4545e10 dom: implement more navigator API 2025-01-08 11:03:26 +01:00
Pierre Tachoire
b96644d893 dom: implement navigatorLanguage 2025-01-08 11:03:26 +01:00
Pierre Tachoire
3cb77c0a32 dom: implement navigatorID 2025-01-08 11:03:25 +01:00
Pierre Tachoire
b3f7fb7be3 dom: implement navigator.userAgent 2025-01-08 11:03:11 +01:00
Pierre Tachoire
487aaffa94 dom: implement innerText 2024-11-28 17:47:41 +01:00
Pierre Tachoire
b712a4771e html: implement empty style property 2024-10-16 10:22:23 +02:00
Pierre Tachoire
95c0ff6f39 dom: implement currentScript 2024-09-24 10:01:13 +02:00
Pierre Tachoire
aeaa745600 clearTimeout: ignore invalid timeout ids 2024-09-19 16:37:42 +02:00
Pierre Tachoire
be27359109 dom: implement clearTimeout 2024-09-19 16:37:42 +02:00
Pierre Tachoire
0559fb9365 dom: first draft for window setTimeout 2024-09-19 16:36:34 +02:00
Pierre Tachoire
f2a406d224 move netsurf and mimalloc into modules 2024-06-18 16:13:27 +02:00
Pierre Tachoire
ef364f83c8 upgrade to zig 0.12.1 2024-06-18 16:13:27 +02:00
Pierre Tachoire
ead08557bf script: implement interface 2024-05-14 16:19:22 +02:00
Pierre Tachoire
6d808d89b0 anchor: implement set_host 2024-05-14 13:44:27 +02:00
Pierre Tachoire
6b42b5abdd anchor: implement HTMLHyperlinkElementUtils interface
https://html.spec.whatwg.org/#htmlhyperlinkelementutils
2024-05-14 13:44:27 +02:00
Pierre Tachoire
7da440e9d3 anchro: implement url manipulation 2024-05-14 13:44:26 +02:00
Pierre Tachoire
8d6ee42096 anchor: follow up 2024-05-14 13:44:25 +02:00
Pierre Tachoire
df6a905683 dom: add target and href accessors to anchor 2024-05-14 13:44:16 +02:00
Pierre Tachoire
2a3a243d1c add AGPL license header in zig files 2024-05-13 20:51:36 +02:00
Pierre Tachoire
3c5d601622 storage: first implementation of webstorage API 2024-04-24 11:54:41 +02:00
Pierre Tachoire
4d5f6d42fa dom: use the css matcher for DOM 2024-03-26 10:25:50 +01:00
Pierre Tachoire
886c9daa47 window: inject DocumentHTML instead of Document 2024-03-08 12:24:24 +01:00
Pierre Tachoire
fec212ab94 window: use window as global object 2024-03-08 12:24:23 +01:00
Pierre Tachoire
25a971c440 window: remove useless import 2024-02-15 14:06:49 +01:00
Pierre Tachoire
9050f2586b events: add EventTargetBase
EventTargetBase implements event target vtable for pure zig struct
2024-02-05 16:41:11 +01:00
Pierre Tachoire
9a050fe069 html: add missing applet, basefont and keygen tags 2024-01-22 11:08:46 +01:00
Pierre Tachoire
45504a50e7 html: add menu and menuitem 2024-01-19 17:44:28 +01:00
Pierre Tachoire
f7752675bc html: add strong tag 2024-01-19 17:42:43 +01:00
Pierre Tachoire
c2106b4b77 html: add em tag 2024-01-19 17:42:22 +01:00
Pierre Tachoire
a2e266514f dom: extract walker from html_collection to its own file 2024-01-17 18:25:05 +01:00
Pierre Tachoire
40dac207f9 window: add event target prototype 2024-01-17 18:22:01 +01:00
Pierre Tachoire
2bbaa77891 window: document is null by default 2024-01-17 18:22:00 +01:00
Pierre Tachoire
c2ade9061b move window from nav to html 2024-01-17 18:21:52 +01:00
Pierre Tachoire
c1b4026fa3 Merge pull request #144 from lightpanda-io/html-doc
dom: DocumentHTML getters
2024-01-10 17:33:43 +01:00
Francis Bouvier
a5dfa6cb44 Adopt global Types changes in jsruntime
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
2024-01-10 11:56:53 +01:00
Pierre Tachoire
be1e55272a DocumentHTML: cast directly document to node 2024-01-09 14:13:52 +01:00
Pierre Tachoire
a25169c9e8 documentHTML: replace NotSupported with NotImplemented 2024-01-09 14:13:52 +01:00
Pierre Tachoire
c73ecb5e0d HTMLDocument: implement all getter 2024-01-09 14:13:51 +01:00
Pierre Tachoire
fce9e44407 HTMLDocument: add noop legacy functions 2024-01-09 14:13:51 +01:00
Pierre Tachoire
91d1f539d4 HTMLDocument: implements anchors 2024-01-09 14:13:51 +01:00