Commit Graph

1356 Commits

Author SHA1 Message Date
Karl Seguin
9fec6ebc66 fix typo, improve comment, add 1 test case 2025-03-04 19:46:36 +08:00
Karl Seguin
a00d1d068a Cookie with SameSite=None is only valid when Secure 2025-02-27 16:47:39 +08:00
Karl Seguin
6f5028612a add cookie jar 2025-02-27 16:09:10 +08:00
Karl Seguin
c31c12d31a add test for Storage shed, use map.getOrPut 2025-02-27 11:57:46 +08:00
Karl Seguin
68fc87bc01 Add Set-Cookie parsing 2025-02-26 21:00:43 +08:00
Pierre Tachoire
488c7e6c27 Merge pull request #447 from lightpanda-io/mem-regression
Some checks are pending
e2e-test / zig build release (push) Waiting to run
e2e-test / puppeteer (push) Blocked by required conditions
wpt / web platform tests (push) Waiting to run
wpt / perf-fmt (push) Blocked by required conditions
zig-test / zig build dev (push) Waiting to run
zig-test / zig test (push) Waiting to run
zig-test / perf-fmt (push) Blocked by required conditions
ci: increase the max memory value to detect regression
2025-02-26 11:38:54 +01:00
Pierre Tachoire
155559c2c4 ci: increase the max memory value to detect regression 2025-02-26 10:55:19 +01:00
Pierre Tachoire
a22e1bc5e5 Merge pull request #442 from karlseguin/cli_commands
Some checks are pending
e2e-test / zig build release (push) Waiting to run
e2e-test / puppeteer (push) Blocked by required conditions
wpt / web platform tests (push) Waiting to run
wpt / perf-fmt (push) Blocked by required conditions
zig-test / zig build dev (push) Waiting to run
zig-test / zig test (push) Waiting to run
zig-test / perf-fmt (push) Blocked by required conditions
Add explicit commands to binary
2025-02-25 09:17:45 +01:00
Karl Seguin
9519d3f7ce use an arena for the args 2025-02-22 20:25:01 +08:00
Pierre Tachoire
3f23e07c02 Merge pull request #443 from karlseguin/logging
Some checks failed
e2e-test / zig build release (push) Has been cancelled
wpt / web platform tests (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
e2e-test / puppeteer (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
Add a structured logger
2025-02-22 12:28:12 +01:00
Pierre Tachoire
6c75177edc Merge pull request #444 from karlseguin/id
Add an id generator
2025-02-22 12:25:54 +01:00
Karl Seguin
85df280447 When explicit mode (serve/fetch/help) isn't given, infer it from the options 2025-02-22 13:54:05 +08:00
Karl Seguin
734cf243f6 update workflow to launch lightpanda in serve mode 2025-02-22 12:40:47 +08:00
Karl Seguin
d8f7817eeb Add explicit commands to binary
./lightpanda serve --host ...
./lightpanda fetch https://...

Makes it easier to communicate / document which command has which options.

Internally added a "usage" command for displaying the usage - removing the need
for error.NoError :|
2025-02-22 12:40:47 +08:00
Karl Seguin
94b6b2636a Add an id generator
Create UUID v4.

Create prefixed ids. To support more of the CDP protocol, we need to remove the
hard-coded IDs (session, browser context, frame, loader, ...) and be able to
dynamically create them, i.e. creating a new BrowserContextId when
Target.createBrowserContext is called.

var frame_id = id.Incremental(u16, "FRM"){};
frame_id.next() == "FRM-1"
frame_id.next() == "FRM-2"

Generation is allocation-free (the returned string is only valid until the
next call to next()). This is not thread safe, each CDP instance will have its
own generator (for each id it needs to generate).

The generated IDs are different than what Chrome uses, i.e.
BROWSERSESSIONID597D9875C664CAC0. I looked at various drivers and none have
any expectations beyond a string. Shorter IDs will be more efficient. Also, the
ID can cheeply be converted to and from an integer, allowing for lookups via
AutoHashMap(u16) instead of StringHashMap.
2025-02-22 09:11:40 +08:00
Karl Seguin
1036f7580f Add a structured logger
In debug mode, it has a more user-friendly output:

level | the log messge | ms since last message | key=value key=value

In release mode, it logs using logfmt, which is supported by most log
ingestion frameworks.

Not being used anywhere right now, keeping this PR small with no impact on
existing code.
2025-02-22 09:10:40 +08:00
Pierre Tachoire
908febb363 Merge pull request #441 from karlseguin/cdp_tests
Some checks are pending
e2e-test / zig build release (push) Waiting to run
e2e-test / puppeteer (push) Blocked by required conditions
wpt / web platform tests (push) Waiting to run
wpt / perf-fmt (push) Blocked by required conditions
zig-test / zig build dev (push) Waiting to run
zig-test / zig test (push) Waiting to run
zig-test / perf-fmt (push) Blocked by required conditions
Turn CDP into a generic so that mocks can be injected for testing
2025-02-21 17:49:47 +01:00
Pierre Tachoire
aefd091b44 Merge pull request #440 from karlseguin/managed_completions
Ensure completions are executed on the currently connected client
2025-02-21 17:39:22 +01:00
Karl Seguin
99fb82e244 Turn CDP into a generic so that mocks can be injected for testing
ADD CDP testing helpers (mock Browser, Session, Page and Client). These are
placeholders until tests are added which use them.

Added a couple CDP tests.
2025-02-21 13:17:35 +08:00
Karl Seguin
756d6620cc Ensure completions are executed on the currently connected client
For the time being, given that we only allow 1 client at a time, I took a
shortcut to implement this. The server has an incrementing "current_client_id"
which is part of every completion. On completion callback, we just check if
its client_id is still equal to the server's current_client_id.
2025-02-21 09:35:51 +08:00
Pierre Tachoire
09505dba09 Merge pull request #436 from lightpanda-io/ci-unittest
Some checks are pending
e2e-test / zig build release (push) Waiting to run
e2e-test / puppeteer (push) Blocked by required conditions
wpt / web platform tests (push) Waiting to run
wpt / perf-fmt (push) Blocked by required conditions
zig-test / zig build dev (push) Waiting to run
zig-test / zig test (push) Waiting to run
zig-test / perf-fmt (push) Blocked by required conditions
ci: add unittest execution
2025-02-20 17:45:41 +01:00
Pierre Tachoire
9401eff297 ci: add unittest execution 2025-02-20 17:10:10 +01:00
Pierre Tachoire
adbec3d272 Merge pull request #439 from karlseguin/dont_share_timeout_completion
Don't share or reuse timeout_completion
2025-02-20 17:09:44 +01:00
Karl Seguin
e301ba0cdb Don't share or reuse timeout_completion
Results in undefined behavior when a client disconnects and another reconnects
while the timeout is being monitored:

https://github.com/lightpanda-io/browser/pull/436#issuecomment-2670455216
2025-02-20 23:56:55 +08:00
Pierre Tachoire
b12eef218a Merge pull request #422 from karlseguin/cdp_struct
Refactor CDP
2025-02-20 15:26:37 +01:00
Karl Seguin
bc4560877a zig fmt 2025-02-20 22:08:56 +08:00
Karl Seguin
521a740d3a Merge branch 'main' into cdp_struct 2025-02-20 22:08:37 +08:00
Pierre Tachoire
be12b724cc Merge pull request #438 from karlseguin/xhr_state_as_enum
Use an enum for XHR's state.
2025-02-20 14:57:37 +01:00
Pierre Tachoire
073873a3e9 Merge pull request #437 from karlseguin/make_zig_path
Use $(ZIG) variable when building netsurf
2025-02-20 14:56:55 +01:00
Pierre Tachoire
fcdcb50b8b Merge pull request #426 from karlseguin/c_allocator
In release mode, switch from page_allocator to c_allocator
2025-02-20 14:37:54 +01:00
Karl Seguin
61a7848fd9 Use an enum for XHR's state. 2025-02-20 14:06:38 +08:00
Karl Seguin
6d6b840cf6 Use $(ZIG) variable when building netsurf 2025-02-20 08:42:45 +08:00
Karl Seguin
4dbba103d4 In release mode, switch from page_allocator to c_allocator 2025-02-20 08:09:53 +08:00
Pierre Tachoire
a2932f05f4 Merge pull request #435 from karlseguin/server_tests
Some checks are pending
e2e-test / zig build release (push) Waiting to run
e2e-test / puppeteer (push) Blocked by required conditions
wpt / web platform tests (push) Waiting to run
wpt / perf-fmt (push) Blocked by required conditions
zig-test / zig build dev (push) Waiting to run
zig-test / zig test (push) Waiting to run
zig-test / perf-fmt (push) Blocked by required conditions
Fix server hang on client disconnect
2025-02-19 17:45:42 +01:00
Pierre Tachoire
5d4efb7692 Merge pull request #434 from lightpanda-io/chore/readme
Chore: update readme images
2025-02-19 16:41:15 +01:00
Karl Seguin
39a9efb73b Fix server hang on client disconnect
https://github.com/lightpanda-io/browser/issues/425

Add a few integration tests for the TCP server which are fast enough to be run
as part of the unit tests (one of the new tests covers the above issue).
2025-02-19 15:01:12 +08:00
Nicolas Rigaudiere
5037bd07d5 chore: update readme images 2025-02-18 15:43:49 +01:00
Pierre Tachoire
73a2fa3f9c Merge pull request #428 from lightpanda-io/ci-rgression
Some checks are pending
e2e-test / zig build release (push) Waiting to run
e2e-test / puppeteer (push) Blocked by required conditions
wpt / web platform tests (push) Waiting to run
wpt / perf-fmt (push) Blocked by required conditions
zig-test / zig build dev (push) Waiting to run
zig-test / zig test (push) Waiting to run
zig-test / perf-fmt (push) Blocked by required conditions
ci: add puppeteer regression test
2025-02-18 15:07:17 +01:00
Pierre Tachoire
79387f469b Merge pull request #433 from lightpanda-io/adjust-readme
readme: adjust image width
2025-02-18 13:57:51 +01:00
Pierre Tachoire
f986cfecff readme: adjust image width 2025-02-18 13:51:10 +01:00
Pierre Tachoire
4d51a9123b Merge pull request #432 from lightpanda-io/adjust-readme
readme: move status up
2025-02-18 13:43:24 +01:00
Pierre Tachoire
7602f15544 readme: move status up 2025-02-18 13:41:45 +01:00
Pierre Tachoire
3180ba7de9 Merge pull request #431 from lightpanda-io/adjust-readme
readme: update benchmark image
2025-02-18 11:55:56 +01:00
Pierre Tachoire
3e01cf19b0 readme: add benchmark details 2025-02-18 11:55:21 +01:00
Pierre Tachoire
14eebfe39e readme: update benchmark image 2025-02-18 11:55:21 +01:00
Pierre Tachoire
9176599b29 Merge pull request #430 from lightpanda-io/adjust-readme
readme: fix badges
2025-02-18 11:37:52 +01:00
Pierre Tachoire
d6575faa9f readme: fix badges 2025-02-18 11:37:08 +01:00
Pierre Tachoire
24c5bf9ff4 Merge pull request #429 from lightpanda-io/adjust-readme
readme: update download instructions + improve CDP example
2025-02-18 11:35:22 +01:00
Pierre Tachoire
cdcc5e106f readme: use curl to download binary 2025-02-18 11:32:53 +01:00
Pierre Tachoire
1a8cc2d019 readme: adjust text 2025-02-18 11:32:30 +01:00