MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

add error handling for string coercion in env_setter

+15 -3
+10
src/ant.c
··· 21812 21812 op_off(c, &c->js->for_let_stack[i].prop_off); 21813 21813 } 21814 21814 21815 + op_val(c, &c->js->object); 21816 + op_val(c, &c->js->tval); 21817 + op_val(c, &c->js->scope); 21818 + op_val(c, &c->js->this_val); 21819 + op_val(c, &c->js->super_val); 21820 + op_val(c, &c->js->new_target); 21821 + op_val(c, &c->js->module_ns); 21822 + op_val(c, &c->js->current_func); 21823 + op_val(c, &c->js->thrown_value); 21824 + 21815 21825 for (jshdl_t i = 0; i < c->js->gc_roots_len; i++) op_val(c, &c->js->gc_roots[i]); 21816 21826 if (c->js->ascii_cache_init) for (int i = 0; i < 128; i++) op_val(c, &c->js->ascii_char_cache[i]); 21817 21827 }
+4 -2
src/modules/process.c
··· 1279 1279 1280 1280 static bool env_setter(ant_t *js, jsval_t obj, const char *key, size_t key_len, jsval_t value) { 1281 1281 jsval_t str_val = coerce_to_str(js, value); 1282 + if (is_err(str_val)) return false; 1282 1283 setprop_cstr(js, obj, key, key_len, str_val); 1283 1284 1284 1285 CSTR_BUF(buf, 256); ··· 1425 1426 size_t entry_len = key_len + 1 + val_len; 1426 1427 1427 1428 if (c->pos + entry_len + 2 >= c->cap) { 1428 - c->cap = c->cap * 2 + entry_len; 1429 - char *new_buf = realloc(c->buf, c->cap); 1429 + size_t new_cap = c->cap * 2 + entry_len; 1430 + char *new_buf = realloc(c->buf, new_cap); 1430 1431 if (!new_buf) return; 1431 1432 c->buf = new_buf; 1433 + c->cap = new_cap; 1432 1434 } 1433 1435 1434 1436 if (c->pos > 0) c->buf[c->pos++] = '\n';
+1 -1
tests/loop.async.js
··· 13 13 await server(); 14 14 } 15 15 16 - for (let i = 0; i < 100000; i++) { 16 + for (let i = 0; i < 10000; i++) { 17 17 void main(); 18 18 } 19 19