about summary refs log tree commit diff stats
path: root/src/bindings/quickjs.nim
Commit message (Collapse)AuthorAgeFilesLines
* Fix GCC 14 compilationbptato2024-05-301-2/+4
| | | | | | | | 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
* client: make quit() actually quit, misc fixesbptato2024-05-041-0/+2
| | | | | | | * 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
* js: fix various leaks etc.bptato2024-05-031-12/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* adapter: update code stylebptato2024-04-261-2/+1
|
* Update code stylebptato2024-04-171-162/+199
| | | | | | * separate params with ; (semicolon) instead of , (colon) * reduce screaming snake case use * wrap long lines
* quickjs: reduce diff with upstreambptato2024-03-021-10/+4
| | | | | | * 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 :/)
* js: define toStringTag properlybptato2024-01-241-0/+1
|
* js: small improvementsbptato2024-01-171-1/+1
| | | | | * turn JSFuncGenerator into a ref object (it's faster this way) * remove strformat dependency
* js: use Nim allocatorbptato2024-01-081-16/+30
|
* Fix some casing issuesbptato2024-01-061-1/+1
|
* Compile with styleCheck:usagesbptato2023-12-281-6/+6
| | | | much better
* dom: use JS_EvalFunction; add module fetching stubsbptato2023-12-251-0/+1
| | | | (still no module support in buffer...)
* bindings/quickjs: cint -> csize_tbptato2023-12-231-1/+2
| | | | | | cint was incorrect :/ Makes me wonder if maybe we should just use futhark after all...
* pager, container: add text selection/copyingbptato2023-12-031-0/+2
| | | | | | | | | | * 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-5/+14
| | | | | * bindings/quickjs: importc and use correct pointer types * add constcharp module for when it is unavoidable
* js: get rid of getJSValuebptato2023-12-021-1/+2
| | | | just use an UncheckedArray in the binding
* js: simplify toJSP0bptato2023-11-301-2/+6
| | | | | | | * 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)
* Add jspropnames, CSSStyleDeclaration stubbptato2023-10-251-1/+5
|
* base64: reduce pointless re-coding using JSStringbptato2023-10-211-0/+11
| | | | | We now expose some functions from QuickJS to interact with JavaScript strings without re-encoding them into UTF-8.
* javascript: add TextEncoder, TextDecoderbptato2023-10-211-0/+11
|
* dom: add document.all, misc fixesbptato2023-09-191-0/+1
| | | | | | | | * Fix an issue with Collection cache invalidation (we must invalidate collections of the parent node on insertion, so that it triggers a refresh). * Remove circular reference of document.document, now we use a function instead.
* bindings: fix JSInterruptHandler signaturebptato2023-09-151-1/+1
|
* javascript: misc. refactoringsbptato2023-08-241-1/+3
| | | | | | | | | | | | * Remove some unused properties from objects * Un-extern JSFunctionList * Remove js/javascript dependency from regex (the wrapper functions were rather pointless) * Remove setProperty (only toJS(Table) used it, but there we have to use defineProperty instead.) * Accordingly, use definePropertyCWE in toJS(Table) * Simplify fromJSTable (replace pointer arithmetic with UncheckedArray) * Reduce implicit `result' usage
* javascript: finish LegacyUnforgeable + misc fixesbptato2023-08-201-0/+11
| | | | | | | | Add jsuffget, jsuffunc for setting LegacyUnforgeable on functions. Misc fixes: * define LegacyUnforgeable properties for native object shims * replace some macros with templates
* javascript: update Events, misc fixes & additionsbptato2023-08-201-3/+15
| | | | | | | | | | | | | | Events: just implement the interfaces, no events are triggered yet. JS changes: * add LegacyUnforgeable * make consts enumerable * fix crash in isInstanceOf * fix destructor warnings * refactor registerType As a result, peakmem is now 1G+ on 1.6.14. It stays ~750M on 2.0.0. Hmm. Well, better upgrade to 2.0.0 I guess.
* Fixes & workarounds to compile on Nim 2.0.0bptato2023-08-011-1/+2
| | | | | | | | | | | | | | * Import punycode, as it has been removed from stdlib. * Fix some syntax errors * Apparently you can no longer compare distinct pointers with nil. Add explicit comparisons with typeof(nil) instead. * htmlparser: rename _ to other, as semantics of _ have changed. (Quite a shame, it looked better with _. Oh well.) * Explicitly specify mm:refc, as the browser OOMs with orc for some reason. Confirmed to compile & run on 2.0.0, 1.6.14, 1.6.12, 1.6.10 and 1.6.8. (<1.6.8 it's broken & wontfix.)
* Add libregexp header to libregexp bindingbptato2023-07-041-9/+4
|
* Fix CastSize warningsbptato2023-07-031-2/+2
| | | | Introduced by 1.6.14. Warns of undefined behavior.
* Remove getClassID hackbptato2023-06-271-0/+1
| | | | Add a JS_GetClassID function to QJS instead.
* Working Nim-QuickJS GC integrationbptato2023-06-241-0/+2
| | | | I believe this works correctly. Hopefully I'm not wrong.
* Fix module loading bugsbptato2023-06-221-0/+2
|
* Include QuickJS sources in the repositorybptato2023-06-221-17/+2
| | | | Taken from txiki.js, so it includes zamofex's top-level await patch.
* Rework JS exception systembptato2023-06-191-0/+11
| | | | | Now we use Result for passing exceptions to JS. As a result, we can finally get rid of the .jserr pragma.
* Simplify request.json, remove unused bindingsbptato2023-06-091-2/+3
|
* Add module loading to clientbptato2023-06-011-0/+3
| | | | Files only, for now.
* Some bindingsbptato2023-05-241-1/+10
|
* WIP fetchbptato2023-04-301-0/+5
|
* quickjs: make JSValue distinct on 32-bitbptato2023-02-051-2/+4
|
* Remove non-existing JS type uint64bptato2022-12-311-1/+0
| | | | Oops.
* Add promise support to JSbptato2022-12-311-0/+6
|
* dom: fix collection cachingbptato2022-12-271-0/+1
| | | | Use ids instead of pure pointers, so we can utilize the JS finalizer.
* Remove todobptato2022-12-211-1/+0
|
* pager: proxy values in container; js: bugfixesbptato2022-12-201-1/+3
| | | | Also, a little bonus: w3m keybindings
* Fix JS_GetPropertyNames bindingsbptato2022-12-201-1/+1
|
* More work on DOM (incl. bugfixes)bptato2022-12-191-0/+1
|
* Add JS support to documentsbptato2022-12-181-4/+31
|
* Rewrite buffer/pager for multi-processingbptato2022-11-191-1/+1
|
* Binding & macro refactoringsbptato2022-10-011-6/+22
|
* Rename jsget/jsset to jsfget/jsfset for functionsbptato2022-09-161-1/+1
| | | | | The original idea was to use the same pragmas as object members, but unfortunately this doesn't seem to work consistently after all.
* Tweaks/bugfixes for armbptato2022-09-141-1/+1
|