about summary refs log tree commit diff stats
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix Map hash bugCharlie Gordon2024-03-021-2/+2
| | | | | | - `map_hash_key` must generate the same key for JS_INT and JS_FLOAT64 with the same value - add test cases in tests/test_builtin.js
* Rewrite `set_date_fields` to match the ECMA specificationCharlie Gordon2024-03-021-28/+52
| | | | | | | | | | | | - use `double` arithmetic where necessary to match the spec - use `volatile` to ensure correct order of evaluation and prevent FMA code generation - reject some border cases. - avoid undefined behavior in `double` -> `int64_t` conversions - improved tests/test_builtin.js `assert` function to compare values more reliably. - added some tests in `test_date()` - disable some of these tests on win32 and cygwin targets
* Add C API function JS_GetClassID()Tyler Rockwood2024-03-022-0/+12
| | | | | | | | | If you want to extend a built-in class you need it's class ID and there is no robust way to get that without this accessor. * add JS_INVALID_CLASS_ID constant for invalid class ID. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* Improve surrogate handling readabilityCharlie Gordon2024-03-023-124/+150
| | | | | | | | | - add inline function to test and convert surrogates is_surrogate(c), is_hi_surrogate(c), is_lo_surrogate(c), get_hi_surrogate(c), get_lo_surrogate(c), from_surrogate(hi, lo) - use names for BC header offsets and lengths in libregexp.c - remove strict aliasing violations in `lre_exec_backtrack()` - pass all context variables to XXX_CHAR macros in `lre_exec_backtrack()`
* Rename regex flag and field utf16 -> unicodeCharlie Gordon2024-03-023-61/+62
| | | | | - rename is_utf16 structure member to is_unicode - rename flag LRE_FLAG_UTF16 as LRE_FLAG_UNICODE
* Fix big endian serializationCharlie Gordon2024-03-022-61/+58
| | | | | | | | | | | | | | | | Big endian serialization was broken because: - it partially relied on `WORDS_ENDIAN` (unconditionally undef'd in cutils.h) - endianness was not handled at all in the bc reader. Modifications: - remove `WORDS_ENDIAN` - use `bc_put_u32()` / `bc_put_u64()` in `JS_WriteBigInt()` - use `bc_get_u32()` / `bc_get_u64()` in `JS_ReadBigInt()` - handle host endianness in `bc_get_u16()`, `bc_get_u32()`, `bc_get_u64()` and `JS_ReadFunctionBytecode()` - handle optional littleEndian argument as specified in `js_dataview_getValue()` and `js_dataview_setValue()`
* Fix UB signed integer overflow in js_math_imulCharlie Gordon2024-03-021-5/+7
| | | | | | | - Use uint32_t arithmetics and Standard conformant conversion to avoid UB in js_math_imul. - add builtin tests - use specific object directories for SAN targets
* Fix UB left shift of negative numberBen Noordhuis2024-03-021-1/+1
|
* Remove unnecessary ssize_t posix-ismBen Noordhuis2024-03-021-1/+1
| | | | | | | | ssize_t is not always available and the cast it was used in wasn't necessary in the first place, the value already has the right type. Note that the field malloc_limit is an int64_t in JSMemoryUsage whereas it is a size_t in JSMallocState.
* Improve string concatenation hackCharlie Gordon2024-03-022-78/+96
| | | | | | - add more cases of in place string concatenation this temporary hack improves the microbench timing by 30% but has little impact on the test262 timings.
* Reverse e140122202cc24728b394f8f90fa2f4a2d7c397eCharlie Gordon2024-03-021-2/+0
| | | | | | | - remove temporary fix for MemorySanitizer: setting p->u.array.count to 0 silenced a warning in JS_GetPropertyValue on a hacky test agains the length of fast_array object. This hack was removed by commit c3635861f63931255c7a953bccbb0e2e90cc75aa.
* Fix test262 errorCharlie Gordon2024-03-021-2/+8
| | | | | | - force evaluation order in `set_date_fields` - fix evaluation error in test262/test/built-ins/Date/UTC/fp-evaluation-order.js:19: unexpected error: Test262Error: precision in MakeDate Expected SameValue(«34448384», «34447360») to be true
* Fix sloppy mode arguments uninitialized value useBen Noordhuis2024-03-021-0/+2
| | | | | | MemorySanitizer complained about uninitialized reads in the indexed property code path in JS_GetPropertyValue() with JS_CLASS_MAPPED_ARGUMENTS objects.
* Remove unsafe sprintf() and strcat() callsBen Noordhuis2024-03-021-22/+24
| | | | | Prep work for enabling the sanitizers on macos CI since they are marked as deprecated and cause the build to fail when -Werror is enabled.
* Fix undefined behavior (UBSAN)Charlie Gordon2024-03-021-2/+4
|
* Fix UB in js_dtoa1Saúl Ibarra Corretgé2024-03-021-1/+3
|
* Fix runtime bugsCharlie Gordon2024-03-021-13/+9
| | | | | - fix string leak in `js_printf_internal` on errors - read `errno` before potential side effects in `js_os_stat`
* Strip trailing spacesCharlie Gordon2024-03-0214-760/+760
|
* avoid using INT64_MAX in double comparisons because it cannot be exactly ↵Fabrice Bellard2024-03-021-2/+3
| | | | represented as a double (bnoordhuis)
* fixed Promise return in the REPL by using a wrapper object in async ↵Fabrice Bellard2024-03-021-2/+14
| | | | std.evalScript() (github issue #231)
* export JS_GetModuleNamespace (github issue #34)Fabrice Bellard2024-03-022-7/+6
|
* simplified and fixed arrow function parsing (github issue #226)Fabrice Bellard2024-03-021-46/+57
|
* new releaseFabrice Bellard2024-03-021-1/+1
|
* fixed JS_GetScriptOrModuleName() in direct or indirect eval codeFabrice Bellard2024-03-021-11/+24
|
* quickjs: reduce diff with upstreambptato2024-03-027-81/+36
| | | | | | * 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 :/)
* cssparser: fix another anb parsing bugbptato2024-03-021-2/+2
| | | | obviously for ident tokens we must check value, not unit
* container: fix off-by-one error in scrollDownbptato2024-03-021-1/+1
|
* env: add window.screenbptato2024-03-022-1/+25
|
* cssparser: fix anb parser whitespace handling bugsbptato2024-03-021-4/+7
| | | | | * skip whitespace in some places where we didn't but should * fix crash in get_tok when eof comes after whitespace
* layout: add whitespace width to end offset's x positionbptato2024-03-021-0/+4
| | | | | | | | so that e.g. a<span style="background-color: red"> </span>b makes the span width exactly one space.
* layout: fix float exclusion of other floatsbptato2024-03-021-2/+2
| | | | | | | | | | | | | | | > The right outer edge of a left-floating box may not be to the right > of the left outer edge of any right-floating box that is next to > it. Analogous rules hold for right-floating elements. says the standard therefore it does not really matter where the beginning of the float is; if it's float: left, then `left' must be set to the right edge, and if it's float: right, then `right' must be set to the left edge. (this was breaking some negative margin float abominations such that floats were suddenly overlapping and that's certainly not what we want)
* cgi: fix regression in header handlingbptato2024-03-021-5/+8
| | | | it's a good idea to use the return value, but it must substitute atEnd.
* http: do not use buffered stdiobptato2024-03-021-6/+9
| | | | | | | buffering output kind of defeats the purpose of the entire loader select machinery (we don't buffer streams either for the same reason)
* posixstream: add readLine implementationbptato2024-03-022-7/+22
| | | | | slightly more efficient, but more importantly does not choke on NUL and weird \r\n
* buffer: do not incrementally display in headless modebptato2024-03-022-3/+6
|
* bonus/w3m.toml: emacs-style page-up/downbptato2024-03-011-4/+6
| | | | this is more or less how it works in w3m
* container: fix cursorLineBegin/cursorLineTextStart with vertical scrollbptato2024-03-011-1/+3
| | | | | | setCursorX only moves the screen backwards if the intended X position is lower than the actual X position. Pass it -1 so that this is true even with zero-width lines.
* css: remove caption-side: left, right, fix caption-side: bottombptato2024-03-013-31/+3
| | | | | | | | left/right never really worked correctly, is non-standard, and the only browser that supported it (Firefox) removed it years ago. bottom was adding the table width to its offset instead of the height, that is now fixed.
* dom: fix canvas element crashbptato2024-03-011-2/+3
|
* css/values: assign to the correct variablebptato2024-03-011-6/+6
|
* buffer, client: fix deadlock with send() callsbptato2024-02-296-24/+104
| | | | | | | | | | This is an ancient bug, but it got much easier to trigger with mouse scrolling support so it's time to fix it. (The bug itself was that since both the client and buffer ends of the controlling stream are blocking, they could get stuck when both were trying to send() data to the other end but the buffer was full. So now we set the client end to non-blocking.)
* css: fix shorthands not overriding all valuesbptato2024-02-291-29/+32
| | | | background & list-style did not override unspecified values
* Add mouse supportbptato2024-02-298-31/+202
|
* pager: fix gotoURL crashingbptato2024-02-291-0/+1
| | | | | should finally convert the code to strictDefs, implicit result is a horrible footgun
* layout: reduce useless empty lines in inline boxesbptato2024-02-291-10/+17
| | | | | | | | | | | | | | If we are going to round things in layout, let's do it properly. Adding fake height has negative utility (things get more annoying to read), so now we don't. TODO: finding the correct positioning of the baseline after adding padding is an open question. Probably have to revise the algorithm somewhat to get it right. (This should also fix the bug where error correction would make inline box backgrounds shift into unrelated text, causing much confusion for the reader.)
* pager: improve URL loading procsbptato2024-02-283-11/+36
| | | | | | | Split up load into loadSubmit, gotoURL: loadSubmit is a replacement for load(s + '\n'), and gotoURL is a load that does no URL expansion. Also, fix a bug where load("\n") would crash the browser.
* layout: round atom offsets toobptato2024-02-282-10/+13
| | | | | it is useful to round them so that they don't get positioned somewhere in the middle of a line (which is rounded to the same precision as well)
* layout: improve/simplify line box error correctionbptato2024-02-283-39/+17
| | | | | | | | | | | | The previous retrofitting of the old renderdocument error correction usually worked, but it still had a horrible flaw in that it assumed that all line boxes are of equal height. So if error was lower for some line than another, it would move *all* lines by a somewhat lower error, and that resulted in overlapping lines. Now we do something much simpler: in flushLine, round each line's height downwards before moving on to the next line. This gets rid of any blanks inbetween lines, and also works much better with cleared floats.
* container: fix cursor positioning bugsbptato2024-02-281-6/+24
| | | | | | | | | * fix cursor jumping back to the start of the line (instead of the end of the line) when it is outside the viewport and a leftwards update is requested * save setxsave too when line is not loaded yet * always set needslines in onMatch when hlon (this was causing a blank screen when incremental search was jumping around in large documents)
* Fix tab size bug on double tabsbptato2024-02-271-4/+4
| | | | | | | | | | It is in fact quite simple to calculate: charwidth is the width of printing characters until now, and whitespacenum the number of (non-flushed) spaces. So we just have to subtract this from the target width to get the number of spaces missing from the next tab stop. (Of course, it gets much harder to understand when the whole thing is formatted as a convoluted multi-line equation...)