about summary refs log tree commit diff stats
path: root/src/html/script.nim
Commit message (Collapse)AuthorAgeFilesLines
* loader: respect credentials modebptato2025-03-281-0/+4
|
* Re-add JSValueConstbptato2025-03-121-4/+4
| | | | | | | | | This time, I've also ported over the consistency check to prevent some ownership bugs. Unfortunately, the check is very limited, and it is still possible to double-free or leak JSValues. I think it would be possible to make coverage 100%, but only with ARC...
* tojs: misc cleanupbptato2025-03-071-4/+5
| | | | | | | * optimize toJS set * change defineProperty wrappers to return an enum If we're going to wrap defineProperty, then let's do it properly.
* xhr, event, catom: fix some bugsbptato2025-02-151-0/+10
| | | | Event handler functions can be set twice now.
* javascript: derive ctor functions from parent ctor functionsbptato2025-02-021-3/+2
| | | | no idea why JS_NewCFunction3 is not public...
* dom: load inline module scripts toobptato2025-02-011-1/+1
|
* dom: basic module supportbptato2025-02-011-0/+24
| | | | probably breaks with TLA
* script, buffer: add <, > around URLbptato2025-01-031-1/+1
| | | | this way, markURL works on stack traces
* script: improve defineConstsbptato2024-12-301-0/+13
| | | | | | Well, I guess this works for now, but something is still wrong. In Gecko, document.__proto__ === Document.__proto__, but in Chawan, it isn't.
* buffer: add "app" scripting modebptato2024-12-261-1/+6
| | | | | | | | | | For APIs that cannot be implemented in a privacy-friendly manner. As a start, I've added accurate screen size queries; getComputedStyle, getBoundingClientRect, etc. should follow. (We have a harmless getComputedStyle already, but it's broken.) Probably, things like JS-based scroll belong in here too, but I'm not sure yet. (Perhaps autofocus should be reused instead?)
* twtstr: add mypairsbptato2024-11-281-1/+2
| | | | | This couldn't get into system.nim for technical reasons, but it's still pretty useful when iterating over non-mutable openArrays.
* Update monoucha, fix some JS testsbptato2024-11-181-0/+6
|
* Clean up forward declarations a bitbptato2024-10-271-2/+2
|
* dom, xhr: slight progress on modules, fix an XHR bugbptato2024-08-151-4/+43
| | | | | | * actually download & compile modules (but don't run them yet) * fix a bug in XHR (on some older Nim versions, move() doesn't actually move)
* buffer, dom, event: JS binding for dispatchEventbptato2024-07-221-7/+10
| | | | | | * move dispatchEvent to event, add a JS binding * only reshape if the document was actually invalidated after event dispatch/interval call/etc.
* Move JS wrapper into Monouchabptato2024-06-031-1/+1
| | | | Operation "modularize Chawan somewhat" part 3
* html: improve Request, derive Client from Windowbptato2024-05-201-3/+31
| | | | | | | * 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)
* Update code stylebptato2024-04-171-4/+4
| | | | | | * separate params with ; (semicolon) instead of , (colon) * reduce screaming snake case use * wrap long lines
* 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.
* dom: use JS_EvalFunction; add module fetching stubsbptato2023-12-251-0/+67
(still no module support in buffer...)