A fresh worktree has no V8 cache, and the way to avoid a 10-minute
rebuild is to symlink `.lp-cache` at the main checkout's. `/.lp-cache/`
matches only a directory, so that symlink shows up as untracked and a
`git add -A` stages it -- an absolute path that dangles anywhere else,
and one `build.zig` picks up when present.
`navStatus` cast the frame's status straight into `std.http.Status`, which is an
enum(u10). `_http_status` is a u16 and `http.getResponseCode` clamps only to that
width, so a server answering `HTTP/1.1 9999 Foo` reached `@enumFromInt(9999)`:
illegal behaviour, and a `thread panic: invalid enum value` in debug. A remote
server picks the input, and the function exists to describe exactly the responses
most likely to be malformed.
Codes above 599 skip the cast and report their number, which is what `phrase()`
would have given them anyway. The test carries the 9999 case.
The same cast from the same source predates this branch in
cdp/domains/network.zig, which is where the pattern was copied from. Left alone
here: different code path, different owner.
`goto` answered "Navigated successfully." for a 403 and a 404 exactly as for a
200, so an agent had no way to tell it was reading an error page and would
happily treat it as content. The status was never missing, only unreachable:
`Frame.httpMetadata` has carried it all along and its one consumer is the
`fetch` CLI path, while `execGetUrl` returns the url alone.
`navStatus` formats it as `403 Forbidden` using `std.http.Status.phrase`, which
`cdp/domains/network.zig` already does for the same job, so there is no phrase
table here. A code std has no phrase for still reports its number.
Used in the three places a navigation outcome is reported: `goto`'s own result,
the suffix a read picks up when an action navigated, and the action result that
names the page url and title. All three named the url and the title and left out
the one fact that says whether either is worth anything.
Navigated successfully. HTTP 200 OK.
Navigated successfully. HTTP 404 Not Found.
Navigated successfully. HTTP 403 Forbidden.
The goto test pinned the old string; it pins the new one, and `navStatus` has
its own covering no-response, a phrased code and an unphrased one.
Depends on: https://github.com/lightpanda-io/zig-v8-fork/pull/214
WPT for /xhr/send-data-sharedarraybuffer.any.html
js.BufferSource (only used in this case), now gives TypeError when the
underlying source is a SharedBuffer.
`partial: ?u32 = null` is now the tristate to capture (1) load everything (null)
(2) load no body (0) and (3) load N body (N).
partial responses are NOT sent to CDP - the data can be garbage.
read orientation of jpeg and swap height/width as needed
Meant to be merged alongside https://github.com/lightpanda-io/browser/pull/3680
but split up to make it easier to review.
317 of the 554 warn/err are now debug. Many of these are events that might be
interesting to a lightpanda browser developer, but not so much an end-user (
end-users might still care about some of these, but more likely in the aggregate
via metrics).
The ultimate goal is to make --log-level warn a useful default.
(this also tweaks how the page meta data is displayed in the pretty logs)
Saw a site return "Content-Type: charset=UTF-8;charset=UTF-8" on scrape. Not a
valid header and it correctly fails to parse. Except...CDP fails to RI on these
since it tries to parse and bubbles. Safe to swallow this error here and
continue with the response serialization.
Ultimate goal is to improve the logging to be more useful by:
1 - identifying the page being navigating
2 - downgrading most page-loading errors to debug
3 - provide page statistics (in logs, via cdp).
So, the logs would look something like:
```
info page-navigate page=3392 url=https://.....
debug urlblocked page=3392
debug timeout page=3392 url=script.js
info page-done page=3392 url=https://....
```
The log level for page-done will be the @max() of any log level for that page
so that if you run --log-level warn, and you get:
```
info page-navigate page=3392 url=https://... <-- filtered out
debug timeout page=3392 url=script.js <--filtered out
warn unknown module lookup page=3392 identifier=blah.js
warn page-done page=3392 url=https://....
```
So that any page event can be linked to the top leveL URL, while still
respecting the --log-level.
This first parts adds the log-level page context, and the thread local
variable.
Resolving the cascade for every element on each mutation made an
append + scrollHeight read up to 12x slower. Virtualizers set their
spacer height inline.
If the server gives a status reason, report it as-is. Only default to the
zig code->reason map when one isn't given.
Also, don't force a 407 status code when auth_challenge is present.