| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
gets rid of a todo.
(not sure why I thought this was important, but it sure looks nicer)
|
|
|
|
|
|
|
|
|
|
|
|
| |
std/selectors uses OS-specific selector APIs, which sounds good in
theory (faster than poll!), but sucks for portability in practice.
Sure, you can fix portability bugs, but who knows how many there are
on untested platforms... poll is standard, so if it works on one
computer it should work on all other ones. (I hope.)
As a bonus, I rewrote the timeout API for poll, which incidentally
fixes setTimeout across forks. Also, SIGWINCH should now work on all
platforms (as we self-pipe instead of signalfd/kqueue magic).
|
|
|
|
|
|
|
|
|
|
| |
* add responseText, response
* add net tests
-> currently sync XHR only; should find a way to do async
tests...
* update monoucha
-> simplified & updated some related code that no longer worked
properly
|
| |
|
|
|
|
|
|
|
| |
* cssvalues, twtstr: unify enum parsing code paths, parse enums by
bisearch instead of hash tables
* mediaquery: refactor (long overdue), fix range comparison syntax
parsing, make ident comparisons case-insensitive (as they should be)
|
|
|
|
| |
use JSValue varargs instead
|
|
|
|
|
|
|
|
|
| |
* buffer, pager, config: add meta-refresh value, which makes it possible
to follow http-equiv=refresh META tags.
* config: clean up redundant format mode parser
* timeout: accept varargs for params to pass on to functions
* pager: add "options" dict to JS gotoURL
* twtstr: remove redundant startsWithNoCase
|
|
|
|
|
|
| |
Merge timeout & interval code paths.
This fixes clearTimeout not clearing intervals.
|
|
|
|
| |
use the new API instead of the convoluted decodercore + growbuf thing
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
* preserve alpha in kitty + simplify encoder
* pass unknown image types to stbi (as image/x-unknown) and let it
detect the type
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* multi-processed and sandboxed PNG decoding & encoding (through local
CGI)
* improved request body passing (including support for output id as
response body)
* simplified & faster blob()/text() - now every request starts
suspended, and OngoingData.buf has been replaced with loader's
buffering capability
* image caching: we no longer pull bitmaps from the container after
every single getLines call
Next steps: replace our bespoke PNG decoder with something more usable,
add other decoders, and make them stream.
|
| |
|
|
|
|
| |
Operation "modularize Chawan somewhat" part 3
|
|
|
|
|
|
|
| |
It's easier to just use nested seqs here.
(This also fixes reverse-search highlighting the last capture group
instead of the whole match.)
|
|
|
|
|
|
| |
Interface:function -> Interface.function
for consistency with regular JS syntax
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a minefield.
Intuitively, you would think that just clearing the opaque and manually
freeing registered object should be enough. Unfortunately, this is
not true; we do not store whether we are actually holding a reference to
registered JS objects, so this approach leads to double frees.
Instead, we add a QJS callback that is called right after the final
GC cleanup, but before the list_free assertion. This way, we can be sure
that any object still in our registry is referenced by us, and can
therefore unreference them safely.
|
|
|
|
| |
just sync'ing
|
|
|
|
|
|
|
|
| |
TODO: find the exact flags we need instead of -fpermissive.
See also:
https://todo.sr.ht/~bptato/chawan/12
https://forum.nim-lang.org/t/11587
|
|
|
|
|
|
|
| |
* make Client an instance of Window (for less special casing)
* misc work on Request & fetch
* improve origin comparison (opaque origins of same URLs are now
considered the same)
|
| |
|
|
|
|
| |
It would silently truncate the upper 32 bits... not a very bright idea.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
* prefix to-be-separated modules with js
* remove dynstreams dependency
* untangle from EmptyPromise
* move typeptr into tojs
|
|
|
|
|
|
|
|
|
| |
* resolve empty promises without params, not a single undefined param
(we can't just unsafeAddr constants on 1.6.14, and I don't see why we
need to pass undefined?)
* same in client with InternalError
* explicitly convert static `asglobal' to bool (1.6.14 turns unquoted
enums into ints...)
|
|
|
|
|
| |
ansi2html depends on color, but we definitely do not want to link it
to QJS, so the converters must be moved into a separate module.
|
|
|
|
| |
no point in having identical overloads
|
| |
|
|
|
|
|
|
|
| |
* unwind the QJS stack with an uncatchable exception when quit is called
* clean up JS references in JSRuntime free even when the Nim
counterparts are still alive
* simplify some tests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously we didn't actually free the main JS runtime, probably because
you can't do this without first waiting for JS to unwind the stack.
(This has the unfortunate effect that code now *can* run after quit().
TODO: find a fix for this.)
This isn't a huge problem per se, we only have one of these and the OS
can clean it up. However, it also disabled the JS_FreeRuntime leak
check, which resulted in sieve-like behavior (manual refcounting is
a pain).
So now we choose the other tradeoff: quit no longer runs exitnow, but
it waits for the event loop to run to the end and only then exits the
browser. Then, before exit we free the JS context & runtime, and also
all JS values allocated by config.
Fixes:
* fix `ad' flag not being set for just one siteconf/omnirule
* fix various leaks (since leak check is enabled now)
* use ptr UncheckedArray[JSValue] for QJS bindings that take an array
* allow JSAtom in jsgetprop etc., also disallow int types other than
uint32
* do not set a destructor for globals
|
|
|
|
|
|
|
|
|
| |
* factor out skipWhitespace
* remove streams dependency
(cssparser could never stream without blocking the event loop, so we
were just passing a StringStream in all cases, which made the whole
streaming pointless.)
|
|
|
|
|
| |
Unsigned operations and conversions to unsigned types always wrap/narrow
without checks, so no need to manually mask/cast/etc. them.
|
|
|
|
|
|
|
|
|
|
| |
std's version is known to be broken on versions we still support, and it
makes no sense to use different decoders anyway.
(This does introduce a bit of a dependency hell, because js/base64
depends on js/javascript which tries to bring in the entire QuickJS
runtime. So we move that out into twtstr, and manually convert a
Result[string, string] to DOMException in js/base64.)
|
|
|
|
| |
It consumes a value, so we must dup those that we pass.
|
|
|
|
| |
Some JS modules use this to check if they are running in a browser.
|
|
|
|
| |
why not
|
|
|
|
|
|
|
|
|
| |
Turns out std/base64's `decode' is broken: atob(" ") would panic. So we
no longer use that.
Basic testing indicates that the new version is closer to the standard-
mandated behavior than the old one was. OTOH I assume it's somewhat
slower, but that can be improved later if it proves to be a bottleneck.
|
|
|
|
|
|
| |
* separate params with ; (semicolon) instead of , (colon)
* reduce screaming snake case use
* wrap long lines
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's a bad idea for several reasons:
* it's inefficient; must allocate an environment for a closure in Nim,
even though we already have one in JS
* writing macros for automatically creating functions with variadic
arguments is suprisingly difficult (see the entire `js/javascript'
module)
* it never really worked properly, because we never freed the associated
function pointer.
We hardly used it anyway, so the easiest fix is to get rid of it
completely.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
until now, this had very strange (and inconsistent) semantics:
* err() was used for exception propagation, but also as a null value
* Option accepted undefined as a none value, but not null
* Opt and Option were used interchangeably (and mostly randomly)
Now, Result is always used for error reporting, and err(nil) means
JS_EXCEPTION. (Opt is a special case of Result where we don't care about
the error type, and is not used in JS.)
Option on the other hand means "nullable variation of normally
non-nullable type", and translates to JS_NULL. In JS we mainly use
it for turning strings nullable.
|
|
|
|
|
|
|
|
| |
This way they are no longer compatible, but we no longer need them to
be compatible anyway.
(This also forces us to throw out the old serialize module, and use
packet writers everywhere.)
|
|
|
|
|
|
|
|
|
| |
* Parse the default config at runtime. There's no significant
performance difference, but this makes it much less painful to write
config code.
* Add better error reporting
* Make fromJS2 easier to use
* Unquote ChaPaths while parsing config
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|