summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-11-17LibJS + js: Rethrow exception on the vm after bytecode interpreter rundavidot
When the bytecode interpreter was converted to ThrowCompletionOr<Value> it then also cleared the vm.exception() making it seem like no exception was thrown. Also removed the TRY_OR_DISCARD as that would skip the error handling parts.
2021-11-17LibJS: Remove fallback value for get_offset_nanoseconds_forLuke Wilde
This is a normative change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/664f02d Note that the tests are not comprehensive.
2021-11-17LibJS/Tests: Fix failing Array.prototype.toLocaleString() testLinus Groh
2021-11-17LibJS: Implement ECMA-402 Array.prototype.toLocaleStringTimothy Flynn
Turns out the only difference between our existing implementation and the ECMA-402 implementation is we weren't passing the locales and options list to each element.toLocaleString invocation. This also adds spec comments to the definition.
2021-11-17LibJS: Implement ECMA-402 Number.prototype.toLocaleStringTimothy Flynn
2021-11-17AK: Add missing return in Formatter<unsigned char[Size]>::format()Andreas Kling
Caught by ENABLE_ALL_THE_DEBUG_MACROS.
2021-11-17AK: Convert AK::Format formatting helpers to returning ErrorOr<void>Andreas Kling
This isn't a complete conversion to ErrorOr<void>, but a good chunk. The end goal here is to propagate buffer allocation failures to the caller, and allow the use of TRY() with formatting functions.
2021-11-17AK: Add failable try_* functions to StringBuilderAndreas Kling
These will allow us to start using TRY() with StringBuilder operations.
2021-11-17AK: Forward declare Error and ErrorOr in AK/Forward.hAndreas Kling
2021-11-17AK: Make JSON parser return ErrorOr<JsonValue> (instead of Optional)Andreas Kling
Also add slightly richer parse errors now that we can include a string literal with returned errors. This will allow us to use TRY() when working with JSON data.
2021-11-17Kernel: Reject writable shared file mappingsDaniel Bertalan
We have no way of writing changes to memory-mapped files back to disk, and software relying on this functionality for output would fail miserably. Let's just return ENOTSUP instead to allow callers to fall back to standard file IO instead of silently discarding writes. This makes the LLD port work, which uses memory-mapped files to write its output by default.
2021-11-16LibJS: Implement unit number formattingTimothy Flynn
2021-11-16LibUnicode: Parse and generate CLDR unit data for Intl.NumberFormatTimothy Flynn
The units data is in another CLDR package, cldr-units.
2021-11-16LibUnicode: Tweak the definition of the plurality "many"Timothy Flynn
As noted at the top of this method, this is a naive implementation of the Unicode plurality specification. But for now, we should tweak the defintion of "many" to be "more than 2" (which is what I had in mind when I wrote this, but forgot about fractions).
2021-11-16LibUnicode: Ignore U+200F when parsing format identifiersTimothy Flynn
Noticed this while implementing multiple identifier support. We were errantly parsing U+200F as a lone identifier in some Hebrew formats.
2021-11-16LibJS+LibUnicode: Support multiple identifiers within format patternTimothy Flynn
This wasn't the case for compact patterns, but unit patterns can contain multiple (up to 2, really) identifiers that must each be recognized by LibJS. Each generated NumberFormat object now stores an array of identifiers parsed. The format pattern itself is encoded with the index into this array for that identifier, e.g. the compact format string "0K" will become "{number}{compactIdentifier:0}".
2021-11-16LibJS+LibUnicode: Rename the generated compact_identifier to identifierTimothy Flynn
This field is currently used to store the StringView into the compact name/symbol in the format string. Units will need to store a similar field, so rename the field to be more generic, and extract the parser for it.
2021-11-16LibJS+LibUnicode: Rename method to select a NumberFormat pluralityTimothy Flynn
Instead of currency pattern lookups within select_currency_unit_pattern, rename the method to select_pattern_with_plurality and accept any list of patterns. This method will be needed for units.
2021-11-16Base: Add/adjust glyphs in font Tiny RegularLady Gegga
Maintenance to stabilize the font. - Added glyph FFFD - Adjusted multiple glyphs for improved consistency - Added a few glyphs to current ranges - Added range Mende Kikakui 1E800-1E8DF (incomplete, I continued my work in Katica)
2021-11-16LibJS: Fix incorrect use of "modulo" in {hour,min,sec,ms}_from_time()Linus Groh
These all would return incorrect results for negative time values. Also adds a missing floor() in sec_from_time().
2021-11-16LibCore: Don't include crypt.h in Account.cpp on FreeBSDBenjamin S Osenbach
Fixes #10803.
2021-11-16LibCrypto: Fix subtracting two negative `SignedBigInteger`sLinus Groh
Currently, we get the following results -1 - -2 = -1 -2 - -1 = 1 Correct would be: -1 - -2 = 1 -2 - -1 = -1 This was already attempted to be fixed in 7ed8970, but that change was incorrect. This directly translates to LibJS BigInts having the same incorrect behavior - it even was tested.
2021-11-16LibJS: Use else-if's in Temporal.Duration.prototype.untilLuke Wilde
This is an editorial change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/3dd2397
2021-11-16LibGfx: Remove scale factor option from try_load_from_fd_and_close()Karol Kosek
... and bring it back to try_load_from_file(). Prior to this change, changing the scaling option to x2 in the Display Settings resulted in the following crash: WindowServer(15:15): ASSERTION FAILED: bitmap->width() % scale_factor == 0 ./Userland/Libraries/LibGfx/Bitmap.cpp:126 That was caused by two minor overlooked yaks: - First, Bitmap::try_load_from_fd_and_close() tried to respect your scale factor. While requesting a bitmap from file can make a switcheroo to give you a higher resolution bitmap, doing the same when you already have an fd might violate the unveil agreement. ... but, it didn't do that. It read bitmaps from requested fds, but also pretended all system bitmaps in /res/ are the HiDPI ones when you enabled that mode. - d85d741c59 used this function to deduplicate try_load_from_file(). It actually made this bug a lot easier to replicate! Closes #10920
2021-11-16DisplaySettings: Handle errors when loading wallpaper bitmapKarol Kosek
Prior this change, the app crashed if the first file in alphabetical order in /res/wallpapers couldn't be decoded.
2021-11-16LibJS: Implement Temporal.PlainDate.prototype.sinceLuke Wilde
2021-11-16LibJS: Implement Temporal.PlainDate.prototype.untilLuke Wilde
2021-11-16LibJS: Conditionally ignore [[UseGrouping]] in compact notationTimothy Flynn
2021-11-16LibJS: Remove FIXME comment from PartitionNotationSubPattern AOTimothy Flynn
All possible patterns generated by LibUnicode are now handled. We have a similar VERIFY_NOT_REACHED in PartitionNumberPattern.
2021-11-16LibJS: Implement compact formatting for Intl.NumberFormatTimothy Flynn
2021-11-16LibJS: Cache the number format used for compact notationTimothy Flynn
Finding the best number format to use for compact notation involves creating a Vector of all compact formats for the locale and looking for the one that best matches the number's magnitude. ECMA-402 wants this number format to be found multiple times, so cache the result for future use.
2021-11-16LibJS+LibUnicode: Fix computation of compact pattern exponentsTimothy Flynn
The compact scale of each formatting rule was precomputed in commit: be69eae651abf0cc3e9cd0906f9586fdfbfb68ef Using the formula: compact scale = magnitude - pattern scale This computation was off-by-one. For example, consider the format key "10000-count-one", which maps to "00 thousand" in en-US. What we are really after is the exponent that best represents the string "thousand" for values greater than 10000 and less than 100000 (the next format key). We were previously doing: log10(10000) - "00 thousand".count("0") = 2 Which clearly isn't what we want. Instead, if we do: log10(10000) + 1 - "00 thousand".count("0") = 3 We get the correct exponent for each format key for each locale. This commit also renames the generated variable from "compact_scale" to "exponent" to match the terminology used in ECMA-402.
2021-11-16LibUnicode: Parse compact identifiers and replace them with a format keyTimothy Flynn
For example, in en-US, the decimal, long compact pattern for numbers between 10,000 and 100,000 is "00 thousand". In that pattern, "thousand" is the compact identifier, and the generated format pattern is now "{number} {compactIdentifier}". This also generates that identifier as its own field in the NumberFormat structure.
2021-11-16Profiler: Stop disassembly on invalid instructionsHendiadyoin1
2021-11-16Profiler: Don't try to disassemble empty buffersHendiadyoin1
2021-11-16AK: Verify that we are not overreaching in StringView's substring_view()Hendiadyoin1
2021-11-16LibJS: Unbreak to_iso_day_of_weekNico Weber
481f7d6afa89d tried to use `modulo()` here, but missed that the code used `<=` instead of `<`. Keep using `modulo()` and add an explicit conditional, which is arguably clearer.
2021-11-16Piano: Create controller widgets for processor parameterskleines Filmröllchen
These widgets attach to a processor parameter and keep the two sides in sync. They will become very useful for smart processor interfaces.
2021-11-15LibJS: Use modulo() function in to_iso_day_of_weekNico Weber
No behavior change.
2021-11-16LibPDF: Check if there is data left before consumingSimon Woertz
Add a check to `Parser::consume_eol` to ensure that there is more data to read before actually consuming any data. Not checking if there is data left leads to failing an assertion in case of e.g., a truncated pdf file.
2021-11-16AK+Kernel: Remove implicit conversion from Userspace<T*> to FlatPtrAndrew Kaster
This feels like it was a refactor transition kind of conversion. The places that were relying on it can easily be changed to explicitly ask for the ptr() or a new vaddr() method on Userspace<T*>. FlatPtr can still implicitly convert to Userspace<T> because the constructor is not explicit, but there's quite a few more places that are relying on that conversion.
2021-11-16Kernel: Use static_ptr_cast to convert between Userspace<T*> typesAndrew Kaster
Some calls of copy_to_user were converting Userspace<T*> to Userspace<U*> via the implicit conversion to FlatPtr. Change them to use the static_ptr_cast overload that is designed to express this conversion
2021-11-16Kernel: Remove unnecessary StringBuilder from sys$create_thread()Andrew Kaster
A series of refactors changed Threads to always have a name, and to store their name as a KString. Before the refactors a StringBuilder was used to format the default thread name for a non-main thread, but it is since unused. Remove it and the AK/String related header includes from the thread syscall implementation file.
2021-11-15Piano: Always show Processor parameter valueskleines Filmröllchen
The processor parameter values are displayed with two decimal places by default. However, when these values become very large and exceed about 7 text symbols, the text is too long to fit the label and it'll simply not show up. This commit fixes that by disabling the decimal place for such large values, which allows us to show values up to 9,999,999, be it only at integer precision.
2021-11-15LibAudio: Add explanatory comments to the FlacLoaderkleines Filmröllchen
Some nuances in the FLAC loading code can do well with an explanation, as these non-obvious insights are often the result of long and painful debugging and nobody should touch the affected code without careful deliberation. (Of course, secretly I just want people to maintain my loader code.) :^)
2021-11-15Audio: Fix code smells and issues found by static analysiskleines Filmröllchen
This fixes all current code smells, bugs and issues reported by SonarCloud static analysis. Other issues are almost exclusively false positives. This makes much code clearer, and some minor benefits in performance or bug evasion may be gained.
2021-11-15LibJS: Fix leap year check in to_iso_week_of_year() for week < 1Linus Groh
When the resulting week is in the previous year, we need to check if the previous year is a leap year and can potentially have 53 weeks, instead of the given year. Also added a comment to briefly explain what's going on, as it took me a while to figure out.
2021-11-15Minesweeper: Decrease min for Columns and Rows on Custom GamePedro Pereira
Since the Beginner difficulty has a 9x9 playing field, it is expected that a Custom Game should allow to create a field with that size.
2021-11-15Minesweeper: Create field from Difficulty enumPedro Pereira
This change makes it easier to generate a new field. Instead of using hard-coded values everywhere, we now just need to keep track of the Difficulty enum value.
2021-11-15Minesweeper: Turn difficulty menu into checkable actionsPedro Pereira
This change makes use of checkable actions to specify the current selected difficulty for the game.