about summary refs log tree commit diff stats
Commit message (Collapse)AuthorAgeFilesLines
* twtstr: simplify control char procsbptato2024-03-131-24/+7
|
* layout: remove word-spacingbptato2024-03-131-4/+1
| | | | this was a bad idea
* Prevent UB on memcpy and floating point conversionsCharlie Gordon2024-03-135-18/+26
| | | | | | | - add `memcpy_no_ub` that accepts null pointers for 0 count - prevent 0 length allocation in `js_worker_postMessage` - use safer test for `int` value in `JS_NewFloat64`, `JS_ToArrayLengthFree` and `js_typed_array_indexOf`
* Improve Date.parseCharlie Gordon2024-03-131-31/+106
| | | | | | | | | | - accept many more alternative date/time formats - add test cases in tests/test_builtin.js - match month and timezone names case insensitively - accept AM and PM markers - recognize US timezone names - skip parenthesized stuff - fix almost all v8 test cases
* rudimentary support for <video>, <audio>bptato2024-03-137-10/+66
| | | | | we just treat them as img tags. lazy, but works suprisingly well -- so long as the server sends us a Content-Type, anyway.
* man: rewrite in Nimbptato2024-03-1310-312/+349
| | | | | | | | | | | | Depending on Perl just for this is silly. Now we use libregexp for filtering basically the same things as w3mman2html did. This required another patch to QuickJS to avoid pulling in the entire JS engine, but in return, we can now run regexes without a dummy JS context global variable. Also, man.nim now tries to find a man command on the system even if it's not in /usr/bin/man.
* loader: fix nil deref in parseHeadersbptato2024-03-131-1/+1
|
* client: fix blocking reads on container connectionbptato2024-03-125-72/+123
| | | | | | | | | | | | | | | | Sometimes, headers take a while to reach us even after the result has been sent. e.g. echo 'Cha-Control: Connected' sleep 5 echo 'Cha-Control: ControlDone' ^ this froze the UI for 5 seconds, that's certainly not what we want. Since we don't have a proper buffered reader yet, and I don't want to write another disgusting hack like BufStream, we just use a state machine to figure out how much we can read. Sounds bad, but in practice it works just fine since loader's response patterns are very simple.
* mancha: only set man as section without other parametersbptato2024-03-121-1/+2
| | | | e.g. `man 2 -k blah' should not override the section
* loader: remove applyHeadersbptato2024-03-1210-134/+112
| | | | | | | Better compute the values we need on-demand at the call sites; this way, we can pass through content type attributes to mailcap too. (Also, remove a bug where applyResponse was called twice.)
* md2html: convert <https://example.org> to anchorbptato2024-03-121-1/+32
|
* update readmebptato2024-03-121-29/+67
|
* posixstream: do not ignore lseek resultbptato2024-03-122-3/+8
|
* pager: fix replacement logicbptato2024-03-122-27/+32
| | | | | | | | | This is what the original replacement logic was supposed to do, except it was broken. The previous fix might have been worse than the original bug. Now we do it like this: * if needed, replace buffer in gotoURL * deleteContainer swaps back the buffer it replaced, if it still exists * on connection success, kill the buffer we replaced
* pager: decrement numload on redirectbptato2024-03-121-0/+1
| | | | because gotoURL will increment it
* io: add dynstreambptato2024-03-126-57/+95
| | | | | a new abstraction that we derive posixstream from; hopefully with time we can get rid of std/streams
* loader: unregister input streams on EOFbptato2024-03-121-2/+2
| | | | if recvData returns 0, it must be treated the same as a broken pipe.
* mailcap: better error messages, accept \ as newline escapebptato2024-03-111-6/+18
| | | | the backslash thing is in the RFC, I just forgot to add it
* pager: do not eat error alerts on startupbptato2024-03-112-2/+1
| | | | | cetStatus is only called for soft status updates, not alerts (we have cetAlert for that)
* loader: rework process modelbptato2024-03-1129-1443/+1648
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally we had several loader processes so that the loader did not need asynchronity for loading several buffers at once. Since then, the scope of what loader does has been reduced significantly, and with that loader has become mostly asynchronous. This patch finishes the above work as follows: * We only fork a single loader process for the browser. It is a waste of resources to do otherwise, and would have made future work on a download manager very difficult. * loader becomes (almost) fully async. Now the only sync part is a) processing commands and b) waiting for clients to consume responses. b) is a bit more problematic than a), but should not cause problems unless some other horrible bug exists in a client. (TODO: make it fully async.) This gives us a noticable improvement in CSS loading speed, since all resources can now be queried at once (even before the previous ones are connected). * Buffers now only get processes when the *connection* is finished. So headers, status code, etc. are handled by the client, and the buffer is forked when the loader starts streaming the response body. As a result, mailcap entries can simply dup2 the first UNIX domain socket connection as their stdin. This allows us to remove the ugly (and slow) `canredir' hack, which required us to send file handles on a tour accross the entire codebase. * The "cache" has been reworked somewhat: - Since canredir is gone, buffer-level requests usually start in a suspended state, and are explicitly resumed only after the client could decide whether it wants to cache the response. - Instead of a flag on Request and the URL as the cache key, we now use a global counter and the special `cache:' scheme. * misc fixes: referer_from is now actually respected by buffers (not just the pager), load info display should work slightly better, etc.
* client: fix thumb button confusionbptato2024-03-111-18/+18
| | | | | | | | the 0x40 bitmask implies one more state than the 0 bitmask, since state 3 with 0 is unused[0]. so we must add 7, not 6 [0] it's reserved for "move", but movement is indicated differently in the protocol we use so unused
* mancha: fix query for 7zbptato2024-03-111-1/+7
|
* css: fix {} macros on older Nim versionsbptato2024-03-111-6/+9
| | | | | old Nim chokes on unquoting enums without explicitly casting them to the target enum type.
* client: bind middle button to discardBuffer, use button5/6 as scrollbptato2024-03-112-5/+14
| | | | | | middle button to close is from w3m btn5/6 is normally a horizontal scroll wheel, so scrollLeft/Right makes more sense than prev/next
* client: only accept "press" input type for scroll wheelbptato2024-03-111-2/+6
|
* term: fix alt-screen = true without ti/tebptato2024-03-081-10/+11
| | | | | | in this case just write smcup/rmcup also move down +1 line and reset formatting if alt screen is off
* cgi: do not eat first word of the error messagebptato2024-03-071-1/+1
| | | | whoops
* cgi: pass system error message after execl failurebptato2024-03-071-1/+2
|
* man: use /usr/bin/env perl shebangbptato2024-03-071-1/+1
| | | | or it breaks on BSD
* buffer: fix bug of eating chars before invalid UTF-8bptato2024-03-051-2/+2
| | | | | | | using this API is suffering (`n' is the last *valid* character ever since the validator API got fixed, so it must be included in the slice.)
* Fix typobptato2024-03-041-1/+1
|
* Update todobptato2024-03-041-10/+2
|
* pager: clear status message when opening external viewersbptato2024-03-041-0/+2
| | | | it used to leave "Connecting..." on the screen
* css: simplify property & value definitionsbptato2024-03-041-266/+272
| | | | having to manually add them to a million places is annoying
* catom: merge TagType with AttrTypebptato2024-03-046-112/+133
| | | | | it's inefficient and pointless to treat them differently, so just derive a new enum from TagType with a macro
* dom: use relList for stylesheet checksbptato2024-03-042-10/+17
|
* Update doc/protocolsbptato2024-03-041-10/+29
|
* dom: misc fixesbptato2024-03-042-6/+41
| | | | | | | | * parse XHR URL with document base URL * allow setting XHR responseType * add tagName, nodeName * make hasChildNodes a function * fix horribly broken insertNode
* loader: fix crash on cha </dev/nullbptato2024-03-031-1/+3
| | | | | | | | | not a very useful operation, but crashing on it is definitely not the correct reaction (hyperfine does this for example. though in that case it's still better to turn it off, otherwise Chawan will pointlessly open a new buffer for it...)
* strwidth, renderdocument: small refactoringbptato2024-03-037-256/+545
| | | | | | * put attrs pointer in state * simplify width() * use unsigned int as ptint to avoid UB
* Update chamebptato2024-03-032-1/+1
|
* buffer: improve/fix onload return valuesbptato2024-03-033-20/+30
| | | | | | | | | Only report when bytesRead has changed, otherwise we get unnecessary load requests. (This means -2 return value no longer exists; it did not work correctly anyway.) Also, fix the race condition that broke onload returns when onload happened before client requested load.
* quickjs: fix build without CONFIG_BIGNUMbptato2024-03-021-0/+8
| | | | broken in upstream :(
* Improve Number.prototype.toString for radix other than 10Charlie Gordon2024-03-021-9/+98
| | | | | | | - fix the conversions for integers and exact fractions - approximate approach for other cases. - bypass floating point conversions for JS_TAG_INT values - avoid divisions for base 10 integer conversions
* Improve Date.parseCharlie Gordon2024-03-021-224/+305
| | | | | | | | - rewrite Date.parse() with separate parsers - return `NaN` for out of bounds field values as specified - accept up to 9 decimals for millisecond fraction but truncate at 3 - accept many more alternative date/time formats - add test cases in tests/test_builtin.js
* Fix Map hash bugCharlie Gordon2024-03-021-2/+2
| | | | | | - `map_hash_key` must generate the same key for JS_INT and JS_FLOAT64 with the same value - add test cases in tests/test_builtin.js
* Rewrite `set_date_fields` to match the ECMA specificationCharlie Gordon2024-03-021-28/+52
| | | | | | | | | | | | - use `double` arithmetic where necessary to match the spec - use `volatile` to ensure correct order of evaluation and prevent FMA code generation - reject some border cases. - avoid undefined behavior in `double` -> `int64_t` conversions - improved tests/test_builtin.js `assert` function to compare values more reliably. - added some tests in `test_date()` - disable some of these tests on win32 and cygwin targets
* Add C API function JS_GetClassID()Tyler Rockwood2024-03-022-0/+12
| | | | | | | | | If you want to extend a built-in class you need it's class ID and there is no robust way to get that without this accessor. * add JS_INVALID_CLASS_ID constant for invalid class ID. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* Improve surrogate handling readabilityCharlie Gordon2024-03-023-124/+150
| | | | | | | | | - add inline function to test and convert surrogates is_surrogate(c), is_hi_surrogate(c), is_lo_surrogate(c), get_hi_surrogate(c), get_lo_surrogate(c), from_surrogate(hi, lo) - use names for BC header offsets and lengths in libregexp.c - remove strict aliasing violations in `lre_exec_backtrack()` - pass all context variables to XXX_CHAR macros in `lre_exec_backtrack()`
* Rename regex flag and field utf16 -> unicodeCharlie Gordon2024-03-023-61/+62
| | | | | - rename is_utf16 structure member to is_unicode - rename flag LRE_FLAG_UTF16 as LRE_FLAG_UNICODE