about summary refs log tree commit diff stats
path: root/src/html/env.nim
Commit message (Collapse)AuthorAgeFilesLines
* timeout: accept err stream as parambptato2024-09-301-1/+1
| | | | | gets rid of a todo. (not sure why I thought this was important, but it sure looks nicer)
* Replace std/selectors with pollbptato2024-09-231-19/+14
| | | | | | | | | | | | 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).
* loader: refactor/move around some procsbptato2024-09-151-1/+1
| | | | | | | | | | | | | | Module boundaries didn't make much sense here either. Specifically: * loader/cgi was originally just one of the many "real" protocols supported by loader, so it was in a separate module (like the other ones). Now it's mostly an "internal" protocol, and it was getting cumbersome to pass all required loader state to loadCGI. * The loader interface has grown quite large, but there is no need for (or advantage in) putting it in the same module as the implementation. Now CGI is handled by loader, and the interface is in the new module "loaderiface".
* xhr: more progressbptato2024-08-151-7/+5
| | | | | | | | | | * 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
* Update monouchabptato2024-08-091-2/+3
|
* env, dom: add History stub, basic LocalStoragebptato2024-07-301-0/+68
| | | | | | | * History: doesn't really do anything, just adding it to fix some pages * LocalStorage: kind of works, but does lookups with linear search, and the quota limitation is on the number of entries not their size. plus it doesn't actually store anything on disk yet (like cookies).
* Fixes for Nim 2.2bptato2024-07-291-1/+1
| | | | | | | | | * xmlhttprequest: fix missing import * painter: generic tuple workaround * dynstream: merge module with implementations (so it will work with vtables) Not enabling vtables yet since it doesn't work with refc.
* buffer, pager, config: add meta-refresh + misc fixesbptato2024-07-281-6/+6
| | | | | | | | | * 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
* headers, request: bring it closer to the standardbptato2024-07-271-3/+3
| | | | | | * add standard interfaces to headers * use window base URL for newRequest * remove pointless generic in newRequest
* env: add alert shimbptato2024-07-271-0/+3
| | | | just call console.error for now
* html: event cleanup, XHR progressbptato2024-07-181-4/+6
|
* timeout: simplify, misc fixesbptato2024-07-161-7/+7
| | | | | | Merge timeout & interval code paths. This fixes clearTimeout not clearing intervals.
* config: add various missing optionsbptato2024-06-291-1/+2
| | | | | | | Mainly things you could already set with [[siteconf]] but not normally. Also, a `styling' option to disable author styles. Also, `images' is now documented as an "experimental" option, since it's halfway usable now.
* env: fix nil deref in clientbptato2024-06-221-1/+3
|
* dom: simplify window.loaderbptato2024-06-091-11/+9
| | | | the Option setup hasn't made much sense for a long time now
* Move JS wrapper into Monouchabptato2024-06-031-5/+6
| | | | Operation "modularize Chawan somewhat" part 3
* html: improve Request, derive Client from Windowbptato2024-05-201-15/+33
| | | | | | | * 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)
* js: allow var instead of ptrbptato2024-05-121-33/+33
|
* js: refactorbptato2024-05-081-2/+7
| | | | | | | * prefix to-be-separated modules with js * remove dynstreams dependency * untangle from EmptyPromise * move typeptr into tojs
* Use isSome instead of isOkbptato2024-05-051-1/+1
| | | | no point in having identical overloads
* js: fix various leaks etc.bptato2024-05-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* dom: fix property event handler settersbptato2024-04-211-0/+10
|
* Update code stylebptato2024-04-171-14/+19
| | | | | | * separate params with ; (semicolon) instead of , (colon) * reduce screaming snake case use * wrap long lines
* js: remove automatic function -> closure conversionbptato2024-04-151-1/+1
| | | | | | | | | | | | | | | 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.
* io: derive DynStream from RootObj (not Stream)bptato2024-03-241-8/+9
| | | | | | | | 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.)
* Move around some modulesbptato2024-03-141-3/+3
| | | | | | | | * extern -> gone, runproc absorbed by pager, others moved into io/ * display -> local/ (where else would we display?) * xhr -> html/ * move out WindowAttributes from term, so we don't depend on local from server
* quickjs: reduce diff with upstreambptato2024-03-021-2/+3
| | | | | | * 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 :/)
* env: add window.screenbptato2024-03-021-1/+21
|
* term: improve pixels-per-column/line detectionbptato2024-02-251-1/+1
| | | | | | | | | Some terminal emulators (AKA vte) refuse to set ws_xpixel and ws_ypixel in the TIOCGWINSZ ioctl, so we now query for CSI 14 t as well. (Also CSI 18 t for good measure, just in case we can't ioctl for some reason.) Also added some fallback (optionally forced) config values for width, height, ppc, and ppl. (This is especially useful in dump mode.)
* buffer: load external resources when they are attachedbptato2024-02-081-1/+2
| | | | | We no longer have to wait for the entire document to be loaded to start loading CSS.
* Update chamebptato2024-02-071-3/+5
| | | | | | | | * Update chame to the latest version * Get rid of nodeType usage * Add atoms * Re-implement DOM attributes * document.write
* js: merge some type modules into jstypesbptato2024-01-111-1/+1
| | | | They only had type definitions, no need to put them in separate modules.
* dom: use JS_EvalFunction; add module fetching stubsbptato2023-12-251-2/+4
| | | | (still no module support in buffer...)
* env: add window.top, window.parentbptato2023-11-291-3/+12
| | | | | Also, func-ize some similar identity functions, and add TODOs about [Replaceable].
* env: stub out window.getComputedStyle()bptato2023-11-211-0/+5
| | | | not a real implementation, just to reduce exceptions
* env: add window.frames, window.selfbptato2023-11-151-0/+6
| | | | both just return identity
* window: inherit from EventTargetbptato2023-10-251-2/+3
|
* base64: reduce pointless re-coding using JSStringbptato2023-10-211-2/+4
| | | | | 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/+2
|
* WindowAttributes: refactorbptato2023-10-191-1/+1
| | | | | | * rename module (window -> winattrs, to avoid conflict with env/window) * do not use result * remove unused cell_ratio
* Refactor Consolebptato2023-10-131-2/+4
| | | | | * merge dom.console & client.Console * move client-specific stuff out of Console (into callbacks when necessary)
* move around more modulesbptato2023-09-141-5/+5
| | | | | | | | | | * ips -> io/ * loader related stuff -> loader/ * tempfile -> extern/ * buffer, forkserver -> server/ * lineedit, window -> display/ * cell -> types/ * opt -> types/
* fetch: use JSDictbptato2023-09-091-1/+1
|
* dom: align some return values with their webidlbptato2023-09-081-2/+2
| | | | | Certain functions were returning types that do not align with the WebIDL defined in the dom standard.
* fetch: allow string input, allow init dictionarybptato2023-09-081-2/+4
|
* Add btoa, atobbptato2023-09-071-0/+7
|
* javascript: refactorbptato2023-08-281-1/+2
| | | | | | | Split out parts of the JS module, because it was starting to confuse the compiler a little. (Peakmem is back at 750M. Interesting.)
* javascript: de-ref some interfacesbptato2023-08-281-25/+25
| | | | | | | Also, make ActionMap use getters/hasprop instead of a table copy. peakmem remains up +200M at 950M after commit 9991bd3393483158ab0d1b9d995f695dee3c65dc. :(
* dom: add some null checks for windowbptato2023-08-231-1/+1
| | | | | | | Now that we have established that window *can* be nil. (Though the document.location window null check is probably unnecessary, because it is only called from scripts... but better safe than sorry.)
* javascript: finish LegacyUnforgeable + misc fixesbptato2023-08-201-1/+3
| | | | | | | | Add jsuffget, jsuffunc for setting LegacyUnforgeable on functions. Misc fixes: * define LegacyUnforgeable properties for native object shims * replace some macros with templates