Karl Seguin
94be7a0e79
Make TCP server websocket-aware
...
Adding HTTP & websocket awareness to the TCP server.
HTTP server handles `GET /json/version` and websocket upgrade requests.
Conceptually, websocket handling is the same code as before, but receiving
data will parse the websocket frames and writing data will wrap it in
a websocket frame.
The previous `Ctx` was split into a `Server` and a `Client`. This was
largely done to make it easy to write unit tests, since the `Client` is
a generic, all its dependencies (i.e. the server) can be mocked out. This
also makes it a bit nicer to know if there is or isn't a client (via the
server's client optional).
Added a MemoryPool for the Send object (I thought that was a nice touch!)
Removed MacOS hack on accept/conn completion usage.
Known issues:
- When framing an outgoing message, the entire message has to be duped. This
is no worse than how it was before, but it should be possible to eliminate
this in the future. Probably not part of this PR.
- Websocket parsing will reject continuation frames. I don't know of a single
client that will send a fragmented message (websocket has its own
message fragmentation), but we should probably still support this just in
case.
- I don't think the receive, timeout and close completions can safely be
re-used like we're doing. I believe they need to be associated with a specific
client socket.
- A new connection creates a new browser session. I think this is right (??),
but for the very first, we're throwing out a perfectly usable session. I'm
thinking this might be a change to how Browser/Sessions work.
- zig build test won't compile. This branch reproduces the issue with none
of these changes:
https://github.com/karlseguin/browser/tree/broken_test_build
(or, as a diff to main):
https://github.com/lightpanda-io/browser/compare/main...karlseguin:broken_test_build
2025-02-13 08:51:19 +08:00
Pierre Tachoire
055530c8c6
cdp: send dom node children
2025-02-10 12:19:35 +01:00
Pierre Tachoire
fb3b38aec7
cdp: implement getSearchResults and discardSearchResults
2025-02-10 09:31:10 +01:00
Pierre Tachoire
4e4a8f1bab
cdp: implement DOM.performSearch
2025-02-10 09:31:09 +01:00
Pierre Tachoire
39b3786776
cdp: ctx state has init and deinit now
2025-02-10 09:31:09 +01:00
Pierre Tachoire
e7dcb8a605
cdp: introduce current page
...
avoid page struct copy
2025-02-10 09:31:08 +01:00
Pierre Tachoire
8f8a1fda85
cdp: implement DOM.getDocument
2025-02-10 09:31:08 +01:00
Pierre Tachoire
26be25c3d5
cdp: dispatch a DOM.documentUpdated event
2025-02-10 09:31:04 +01:00
Pierre Tachoire
6d530691f3
cdp: use an enum for SessionID
2025-01-29 18:38:05 +01:00
Pierre Tachoire
8aac26a331
cdp: check parameter's type on sendEvent
...
Disallow void type.
2025-01-28 16:01:47 +01:00
Pierre Tachoire
fc59a0f6ab
cdp: send empty param instead of void
...
Sending void parameters generated unmarshal errors with chromedp client.
Empty struct is required.
2025-01-28 15:46:13 +01:00
Pierre Tachoire
daf4236023
runtime: fix sessionid
2025-01-13 18:08:09 +01:00
Pierre Tachoire
4c9a24c64e
start inspector when the js env starts
2025-01-13 10:53:38 +01:00
Pierre Tachoire
c149f65158
cdp: remove event dispateched by inspector
2025-01-13 10:53:36 +01:00
Pierre Tachoire
b276a15786
cdp: add target.detachFromTarget noop
2025-01-13 10:53:33 +01:00
Pierre Tachoire
2fed239ece
browser: split page start from page navigate
2025-01-13 10:53:29 +01:00
Pierre Tachoire
8e2cb36597
cdp: fix some id inconsitency accross runtime messages
2025-01-13 10:49:48 +01:00
Pierre Tachoire
bcaace1c91
cdp: use identifiable hard coded ids
2025-01-13 10:47:51 +01:00
Pierre Tachoire
d664d07141
cdp: dispatch executionContextCreated on Runtime.enable
2025-01-13 10:47:42 +01:00
Pierre Tachoire
82bbe78e95
cdp: return correct result on Runtime
2025-01-08 16:46:05 +01:00
Pierre Tachoire
c761cd059b
cdp: log errors on sendMessageToTarget
2025-01-08 16:17:29 +01:00
Pierre Tachoire
03e87155ca
cdp: add security.enable
2025-01-08 16:17:20 +01:00
Pierre Tachoire
8377eb02a5
cdp: add CSS.enable
2025-01-08 12:01:18 +01:00
Pierre Tachoire
3738e8eb44
cdp: add DOM.enable
2025-01-08 12:01:18 +01:00
Pierre Tachoire
4b000e44b3
cdp: add Inspector.enable
2025-01-08 12:01:18 +01:00
Pierre Tachoire
d78e8a725d
cdp: remove useless parameter
2025-01-08 09:57:28 +01:00
Pierre Tachoire
90ba6deba2
cdp: add Target.sendMessageToTarget support
...
see https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-sendMessageToTarget
2025-01-07 16:00:44 +01:00
Pierre Tachoire
5fc763a738
cdp: add TargetCreated event on createTarget message
2025-01-07 10:34:47 +01:00
Francis Bouvier
3b018e2a6d
Merge pull request #325 from lightpanda-io/await_promise
...
wpt / web platform tests (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / zig build release (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
cdp: runtime, replace `"awaitPromise":true` only if present
2024-12-09 11:19:45 +01:00
Francis Bouvier
d4939c8260
Merge pull request #322 from lightpanda-io/cdp_msg_nullable_params
...
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 build release (push) Waiting to run
zig-test / zig test (push) Waiting to run
zig-test / perf-fmt (push) Blocked by required conditions
cdp: handle nullable Type for params
2024-12-08 19:08:27 +01:00
Francis Bouvier
0217e3fcae
cdp: runtime, replace "awaitPromise":true only if present
...
Signed-off-by: Francis Bouvier <francis@lightpanda.io >
2024-12-08 15:33:32 +01:00
Francis Bouvier
6e7d6421d5
cdp: do not throw error on json parse for unknown fields
...
Signed-off-by: Francis Bouvier <francis@lightpanda.io >
2024-12-08 15:27:12 +01:00
Francis Bouvier
53dd0a5e4c
cdp: handle nullable Type for params
...
Signed-off-by: Francis Bouvier <francis@lightpanda.io >
2024-12-04 22:39:54 +01:00
Francis Bouvier
325ecedf0b
websocket: first implementation
...
Signed-off-by: Francis Bouvier <francis@lightpanda.io >
2024-11-27 21:24:09 +01:00
Francis Bouvier
ed3a464843
cdp: fix memory leak in msg parsing of the JSON
...
Signed-off-by: Francis Bouvier <francis@lightpanda.io >
2024-11-09 03:25:42 +01:00
Francis Bouvier
f60fcbec04
Merge pull request #286 from lightpanda-io/cdp-refacto-input
...
cdp: refacto message JSON read
2024-11-15 01:03:53 +01:00
Francis Bouvier
4f99407462
Merge pull request #288 from lightpanda-io/cdp-create-target
...
cdp: browserContextId is optional in Target.createTarget
2024-11-15 00:53:22 +01:00
Pierre Tachoire
82c37fc71b
cdp: refacto message JSON read
2024-11-12 12:56:29 +01:00
Pierre Tachoire
8ba911c8dd
cdp: return provided browser context id if any
2024-11-12 10:56:06 +01:00
Francis Bouvier
1854074f64
Merge pull request #293 from lightpanda-io/cdp-contextid
...
cdp: use a u32 for context id
2024-11-07 15:49:40 +01:00
Francis Bouvier
ec5de2fce0
Merge pull request #287 from lightpanda-io/cdp-attach-to-target
...
cdp: add Target.attachToTarget noop
2024-11-07 15:49:15 +01:00
Pierre Tachoire
0d76f80223
cdp: use a u32 for context id
2024-11-04 10:08:36 +01:00
Francis Bouvier
64779acf32
Merge pull request #278 from lightpanda-io/cdp_full_async
...
Cdp full async
2024-11-01 18:14:21 +01:00
Pierre Tachoire
b3054d68bf
cdp: browserContextId is optional in Target.createTarget
...
https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-createTarget
2024-10-29 10:37:23 +01:00
Pierre Tachoire
60adf0a9c3
cdp: add Target.attachToTarget noop
2024-10-29 10:34:36 +01:00
Pierre Tachoire
5d7796b95d
cdp: close dir in dumpFile
...
and avoid error.ProcessFdQuotaExceeded error
2024-10-23 10:02:34 +02:00
Francis Bouvier
8508c21080
cdp: remove send sync
...
Signed-off-by: Francis Bouvier <francis@lightpanda.io >
2024-10-21 18:29:10 +02:00
Francis Bouvier
7bc7da5499
browser: back on createPage returning a Page (pointer)
...
Signed-off-by: Francis Bouvier <francis@lightpanda.io >
2024-10-16 14:53:11 +02:00
Francis Bouvier
8e05f09fc8
server, cdp: improve logging
...
Signed-off-by: Francis Bouvier <francis@lightpanda.io >
2024-10-15 22:57:56 +02:00
Francis Bouvier
84c49fbe34
cdp: ensure there is an ID on each request
...
Signed-off-by: Francis Bouvier <francis@lightpanda.io >
2024-10-15 17:28:18 +02:00