about summary refs log tree commit diff stats
path: root/src/js
Commit message (Collapse)AuthorAgeFilesLines
* remove dead code, fix openArray casingbptato2024-04-081-2/+2
|
* js: proper distinction between Opt/Optionbptato2024-03-243-38/+19
| | | | | | | | | | | | | | | | 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.
* io: derive DynStream from RootObj (not Stream)bptato2024-03-243-17/+16
| | | | | | | | 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.)
* 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.
> 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279