about summary refs log tree commit diff stats
path: root/src/js
Commit message (Collapse)AuthorAgeFilesLines
* config: clean up/simplifybptato2024-03-171-4/+6
| | | | | | | | | * 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
* man: rewrite in Nimbptato2024-03-131-21/+22
| | | | | | | | | | | | 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: rework process modelbptato2024-03-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* quickjs: reduce diff with upstreambptato2024-03-022-6/+8
| | | | | | * the uint8array thing is probably from txiki.js, but we never used it * upstream now has JS_GetClassID, importing that instead... (so this commit won't build :/)
* dom: add onload content attribute to bodybptato2024-02-243-3/+26
|
* dom: print parse errors to consolebptato2024-02-241-6/+8
| | | | instead of trying to evaluate exceptions...
* Replace Chakasu with Chagashibptato2024-02-222-53/+147
| | | | | | The API is horrid :( but at least it copies less. TODO: think of a better API.
* regex: compileSearchRegex improvementsbptato2024-02-181-9/+7
| | | | | * do not eat \\c, \\C * emulate vi-style word boundary matching (\<, \>) with \b
* regex: re-work compileSearchRegexbptato2024-02-175-65/+62
| | | | | | | I've gotten tired of not being able to search for forward slashes. Now it works like in vim, and you can also set default ignore case in the config.
* js: fix fromJSEnumbptato2024-02-082-6/+17
| | | | std enum parsing uses Nim ident matching rules, which is incorrect here.
* regex: fix 8-bit narrow strings in JSbptato2024-02-051-1/+1
| | | | | The previous approach to add UTF-8 support to libregexp was broken. This time, we use a separate flag (cbuf_len == 3) to indicate UTF-8 input.
* js: always use var destructorbptato2024-01-291-8/+2
| | | | See https://forum.nim-lang.org/t/10807
* js: update pragma docsbptato2024-01-241-3/+9
|
* js: define toStringTag properlybptato2024-01-242-3/+12
|
* js: allow specifying static function name, small refactoringbptato2024-01-241-58/+60
| | | | | | | | * static function names can now be defined using the syntax `Class:functionName' (or just use `Class' to take the default name * fix URL.canParse with 1 argument only * do not store JSFuncGenerator for constructors; just put the function node in BoundFunctions
* js: small improvementsbptato2024-01-172-21/+53
| | | | | * turn JSFuncGenerator into a ref object (it's faster this way) * remove strformat dependency
* Use errDOMException template everywherebptato2024-01-111-4/+4
|
* js: merge some type modules into jstypesbptato2024-01-119-44/+45
| | | | They only had type definitions, no need to put them in separate modules.
* js: use Nim allocatorbptato2024-01-081-1/+19
|
* Use std/* imports everywherebptato2024-01-076-19/+19
|
* tojs: document + remove unused JSCFunction converterbptato2024-01-071-7/+41
|
* Fix some casing issuesbptato2024-01-061-4/+4
|
* Compile with styleCheck:usagesbptato2023-12-283-3/+3
| | | | much better
* dom: use JS_EvalFunction; add module fetching stubsbptato2023-12-251-0/+7
| | | | (still no module support in buffer...)
* bindings/quickjs: cint -> csize_tbptato2023-12-231-2/+3
| | | | | | cint was incorrect :/ Makes me wonder if maybe we should just use futhark after all...
* js: fix nil deref in jsgetpropbptato2023-12-201-4/+9
| | | | Turns out desc can in fact be nil.
* pager: add marksbptato2023-12-091-0/+15
| | | | | Default is vi-style, but w3m-style marks work as well; see bonus/w3m.toml.
* event: remove ctx from CustomEventbptato2023-12-032-23/+38
| | | | | Instead, make finalizers optionally pass their runtime for resource deallocation.
* pager, container: add text selection/copyingbptato2023-12-032-0/+26
| | | | | | | | | | * Add select & copy selection functionality to container * Fix bug in generateSwapOutput where output could be misplaced because of zero-width cells * Add fromJSPromise, call runJSJobs in every iteration of the headed event loop * "await" pager actions that output a promise * Change default view source keybinding to `\'
* Get rid of clang 16 workaroundbptato2023-12-021-2/+3
| | | | | * bindings/quickjs: importc and use correct pointer types * add constcharp module for when it is unavoidable
* js: get rid of emitbptato2023-12-021-22/+15
| | | | now I know how to :P
* js: get rid of getJSValuebptato2023-12-021-10/+9
| | | | just use an UncheckedArray in the binding
* html: add HTMLElement.dataset (+ some twtstr cleanup)bptato2023-12-011-6/+14
|
* js: simplify toJSP0bptato2023-11-302-31/+11
| | | | | | | * Expose js_create_from_ctor from QuickJS and directly use that (instead of badly recreating it) * Do not call defineUnforgeable twice (it is inevitably called in toJSP0, so jsctor does not need it)
* js: allow subclassing platform objects in JSbptato2023-11-303-5/+50
|
* intl: stub out Intl.PluralRulesbptato2023-11-302-0/+26
|
* js: remove nonsensical comment linebptato2023-11-261-1/+0
|
* fromjs: fix fromJSOption with nilbptato2023-11-211-1/+1
| | | | Use option() instead of some()
* js: refine isInstanceOf check in functionsbptato2023-10-253-13/+30
| | | | Special case the global object, check for inheritance, etc.
* js: define global properties as CONFIGURABLE | WRITABLEbptato2023-10-252-2/+7
|
* reduce new() usagebptato2023-10-252-3/+2
|
* Add jspropnames, CSSStyleDeclaration stubbptato2023-10-252-3/+92
|
* dom: add outerHTML setterbptato2023-10-231-0/+3
| | | | Also, misc. refactorings
* fromjs: update FromJSAllowedTbptato2023-10-211-1/+2
|
* fromjs: remove IsNumber check from float, remove unused functionsbptato2023-10-211-21/+0
|
* fromJSInt: do not fail if not IsNumberbptato2023-10-211-2/+0
| | | | to match standard behavior (e.g. accept null as int, etc)
* base64: reduce pointless re-coding using JSStringbptato2023-10-214-35/+31
| | | | | We now expose some functions from QuickJS to interact with JavaScript strings without re-encoding them into UTF-8.
* javascript: add TextEncoder, TextDecoderbptato2023-10-216-0/+178
|
* XHR progressbptato2023-10-141-3/+4
| | | | still non-functional
* Refactor Consolebptato2023-10-131-0/+58
| | | | | * merge dom.console & client.Console * move client-specific stuff out of Console (into callbacks when necessary)