Commit Graph

32229 Commits

Author SHA1 Message Date
Linus Groh
81492b3cee LibJS: Remove the now unused custom VM unwind mechanism
Goodbye VM::m_unwind_until, you served us well :^)
2022-01-06 12:36:23 +01:00
Linus Groh
9d0d3affd4 LibJS: Replace the custom unwind mechanism with completions :^)
This includes:

- Parsing proper LabelledStatements with try_parse_labelled_statement()
- Removing LabelableStatement
- Implementing the LoopEvaluation semantics via loop_evaluation() in
  each IterationStatement subclass; and IterationStatement evaluation
  via {For,ForIn,ForOf,ForAwaitOf,While,DoWhile}Statement::execute()
- Updating ReturnStatement, BreakStatement and ContinueStatement to
  return the appropriate completion types
- Basically reimplementing TryStatement and SwitchStatement according to
  the spec, using completions
- Honoring result completion types in AsyncBlockStart and
  OrdinaryCallEvaluateBody
- Removing any uses of the VM unwind mechanism - most importantly,
  VM::throw_exception() now exclusively sets an exception and no longer
  triggers any unwinding mechanism.
  However, we already did a good job updating all of LibWeb and userland
  applications to not use it, and the few remaining uses elsewhere don't
  rely on unwinding AFAICT.
2022-01-06 12:36:23 +01:00
Linus Groh
eed764e1dd LibJS: Implement the LoopContinues AO 2022-01-06 12:36:23 +01:00
Linus Groh
fc474966bc LibJS: Implement LabelledStatement & LabelledEvaluation semantics
Instead of slapping 0..N labels on a statement like the current
LabelableStatement does, we need the spec's LabelledStatement for a
proper implementation of control flow using only completions - it always
has one label and one labelled statement - what appears to be 'multiple
labels' on the same statement is actually nested LabelledStatements.

Note that this is unused yet and will fully replace LabelableStatement
in the next commit.
2022-01-06 12:36:23 +01:00
Jelle Raaijmakers
558fd5b166 LibCore: Make EventLoop::pump() return event count
Sometimes, pumping the event loop will cause new events to be
generated. For example, an IPC message could be delivered which then
dispatches a new event to be handled by the GUI. To the invoker of
`EventLoop::pump()`, it is not obvious if any events were processed at
all.

Libraries like SDL2 might not have the opportunity to run the event
loop often enough that events can be processed swiftly, since it might
spend time doing other things. This can result in stuttering GUI
interactions.

This changes `EventLoop::pump()` to return the number of processed
events. This functionality will be used by our SDL2 port in another PR.
2022-01-06 11:30:04 +01:00
Tim Schumacher
fa902cd5d5 Ports: Fix the sha256sum for libjpeg
While the modification time still points back to 2020, it looks like the
tarball got updated secretly.
2022-01-05 22:53:53 -08:00
Sam Atkins
93ef8c8080 LibMarkdown: Output alignment when rendering HTML tables
Previously, only terminal output aligned table column contents
correctly. Now, we apply a `text-align` to each cell. This does not
actually *work* however, since LibWeb's table layout code is not yet
fully functional.
2022-01-06 08:22:46 +03:30
Rafał Babiarz
fee43e3544 Ports: Updated libogg to version 1.3.5 2022-01-05 16:35:49 -08:00
Lucas CHOLLET
75d1840cfc FileManager: Show Dotfiles when passing a Dotfile as an argument
Before this patch, FileManager was failing to open the directory and
open `/` instead.
2022-01-05 15:20:54 -08:00
Lucas CHOLLET
693ae73606 FileManager: Use String const& instead of String
Change ErrorOr<int> run_in_windowed_mode(String, String)
to ErrorOr<int> run_in_windowed_mode(String const&, String const&)
2022-01-05 15:20:54 -08:00
Luke Wilde
3e0c19d6ea LibJS: Add tests for all the unscopable Array prototype properties
When I was writing for tests for groupBy and groupByToMap, I noticed
there were no tests for these.
2022-01-05 20:31:25 +01:00
Timothy Flynn
260d2099da LibJS: Implement Date.UTC according to the spec
This fixes all failing Date.UTC test262 tests, which failed due to not
handling invalid input and evaluating inputs out of order. But this also
avoids using timegm(), which doesn't work on macOS for years before 1900
(they simply return -1 for those years).

Partially addresses #4651. Date.parse.js still fails.
2022-01-05 20:05:12 +01:00
Timothy Flynn
7a0830bb24 LibJS: Use AK::Time to implement the MakeDay AO
We currently use Core::DateTime create, which internally uses mktime().
This has the issues pointed out by the (now removed) FIXME, but also has
an issue on macOS where years before 1900 are not supported.
2022-01-05 20:05:12 +01:00
Timothy Flynn
e8f860048e LibJS: Set the length of Date.UTC to 7
This is a bit unusual because there is only 1 required argument, but the
spec dictates that the length is 7.
2022-01-05 20:05:12 +01:00
Timothy Flynn
bb9db5937a AK: Add Time.h helper to compute the number of days since epoch 2022-01-05 20:05:12 +01:00
Timothy Flynn
0c75a14b4f AK: Move TimeSpecType concept inside the AK namespace
This is just to allow removing the 'clang-format off' directive. This
concept is only used within this header, so it doesn't need to be in the
global namespace.
2022-01-05 20:05:12 +01:00
Andreas Kling
8f5c1ef29c AK: Improve HashTable::remove_all_matching() test slightly
After removing some entries, we now also verify that the correct
entries remain in the table. :^)
2022-01-05 18:57:14 +01:00
Andreas Kling
bcc0186bbc Kernel/Ext2FS: Use HashMap::remove_all_matching() in Ext2FS
This makes the inode cache eviction mechanism quite a bit easier
to understand, thanks to the new expressive API. :^)
2022-01-05 18:57:14 +01:00
Andreas Kling
2375e1bcda LibGUI: Rename ModelSelection::remove_matching => remove_all_matching
Let's be consistent with how Vector, HashTable and HashMap names these.
2022-01-05 18:57:14 +01:00
Andreas Kling
c6bcd0dfe4 LibGUI: Use HashTable::remove_all_matching() in GUI::ModelSelection 2022-01-05 18:57:14 +01:00
Andreas Kling
558fb0a04a AK: Make Vector::remove_all_matching() return removal success
This matches the behavior of other remove_*_matching() functions.
2022-01-05 18:57:14 +01:00
Andreas Kling
5279a04c78 AK: Make Hash{Map,Table}::remove_all_matching() return removal success
These functions now return whether one or more entries were removed.
2022-01-05 18:57:14 +01:00
Andreas Kling
c7ac0c2c80 LibJS: Use HashMap::remove_all_matching() in WeakMap 2022-01-05 18:57:14 +01:00
Andreas Kling
376e5ef912 AK: Add HashMap::remove_all_matching(predicate)
This removes all matching entries from a hash map in a single pass.
2022-01-05 18:57:14 +01:00
Andreas Kling
e08d325124 LibJS: Use HashTable::remove_all_matching() in WeakSet :^) 2022-01-05 18:57:14 +01:00
Andreas Kling
54cf42fac1 AK: Add HashTable::remove_all_matching(predicate)
This removes all matching entries from a table in a single pass.
2022-01-05 18:57:14 +01:00
Lady Gegga
365bd8a0c3 Base: Add Unified Canadian Aboriginal Syllabics Ext-A Katica Reg. 10
11AB0-11ABF https://www.unicode.org/charts/PDF/U11AB0.pdf
2022-01-05 18:42:18 +01:00
Lady Gegga
0305304c91 Base: Adjust 1F41A in font Katica Regular 10
Move 1F41A up 1px to align it with other glyphs
2022-01-05 18:42:18 +01:00
Lady Gegga
765d675d27 Base: Add symbols to font Katica Regular 10
1F990, 1F42C, 1FAB8, 1FAA8, 1FAB7
https://www.unicode.org/charts/PDF/U1F300.pdf
https://www.unicode.org/charts/PDF/U1FA70.pdf
https://www.unicode.org/charts/PDF/U1F900.pdf
2022-01-05 18:42:18 +01:00
Timothy Flynn
ec7d5351ed LibJS+LibUnicode: Handle flexible day periods that roll over midnight
When searching for the locale-specific flexible day period for a given
hour, we were neglecting to handle cases where the period crosses 00:00.
For example, the en locale defines a day period range of [21:00, 06:00).
When given the hour of 05:00, we were checking if (21 <= 5 && 5 < 6),
thus not recognizing that the hour falls in that period.
2022-01-05 16:22:55 +01:00
Mathieu PATUREL
c8addf1a5e LibGUI: Consume initial spaces when going to next/prev word break
This impacts text editors' ctrl+left, ctrl+shift+right, ctrl+backspace,
etc..

For example, consider the text "Hello world   |", pressing
ctrl+backspace each time.

Before: "hello world   |"
        "hello world|"
        "hello |"
        "hello|"
        "|"
 After: "hello world   |"
        "hello|"
        "|"

Note that this breaks a nice symmetry. Doing ctrl+left and then
ctrl+right doesn't necessarily get you to the same place like it use to.

Before: " hello |"
        " hello| "
        " hello |" // same as initial
 After: " hello |"
        "|hello "
        " hello| " // different from initial
2022-01-05 14:18:44 +01:00
Brian Gianforcaro
4b4cf06069 Kernel: Remove temporary Vector from Ext2FS::flush_writes()
Previously we were using this vector to store the inodes as we iterated.
However, we don't need to store all of them, just the previous inode, as
we know it will be safe to remove it once we've iterated past that
element.
2022-01-05 14:04:18 +01:00
Brian Gianforcaro
aa77c2ca58 Kernel: Use unchecked_append in PerformanceEventBuffer raw_backtrace()
We always validate the size before we append, so there is
no reason to use the checked append.
2022-01-05 14:04:18 +01:00
Brian Gianforcaro
1a2aad287f AK: Disable Vector insert/empend/prepend + a append overload in Kernel
We have whittled away at the usages of these AK::Vector APIs in the
Kernel. This change disables them from being visible when building
the Kernel to make sure no new usages get added.
2022-01-05 14:04:18 +01:00
Brian Gianforcaro
538986c991 Kernel+LibVT: Use MUST + try_prepend / try_append
In preparation for making Vector::append + Vector::prepend
unavailable during compilation of the Kernel.

This specific file is compiled into the Kernel as well as LibVT.
2022-01-05 14:04:18 +01:00
Brian Gianforcaro
6c66311ade Kernel: Use MUST + Vector::try_empend instead of Vector::empend
In preparation for making Vector::empend unavailable during
compilation of the Kernel.
2022-01-05 14:04:18 +01:00
Brian Gianforcaro
24066ba5ef Kernel: Use MUST + Vector::try_append instead of Vector::append
In preparation for making Vector::append unavailable during
compilation of the Kernel.
2022-01-05 14:04:18 +01:00
Brian Gianforcaro
8bcce82887 Kernel: Use MUST+ Vector::try_prepend instead of Vector::prepend
In preparation for disabling Vector::prepend from being available
during the compilation of the Kernel.
2022-01-05 14:04:18 +01:00
Brian Gianforcaro
48206be121 AK: Use MUST + try_empend so AK::Trie continues to compile in the kernel 2022-01-05 14:04:18 +01:00
Brian Gianforcaro
7d27798c8d AK: Use unchecked_append in AK::Stack, as we always validate the size
This removes one additional usage of Vector::append that stops us from
disabling it when compiling the Kernel.
2022-01-05 14:04:18 +01:00
Jesse Buhagiar
48c9350036 LibELF: Add LD_LIBRARY_PATH envvar support :^)
The dynamic linker now supports having custom library paths
as specified by the user.
2022-01-05 15:01:14 +02:00
Lady Gegga
360cdabcdc Base: Add Unified Canadian Aboriginal Syllabics to Katica Regular 10
1489-167F https://www.unicode.org/charts/PDF/U1400.pdf

Our implementation of 150C does not correspond with the Unicode chart,
it uses an alternative glyph found in many fonts for clarity!
2022-01-05 14:00:00 +01:00
Lady Gegga
ccad35bc75 Base: Align 1428-142A in font Katica Regular 10
Move these glyphs 1px up
2022-01-05 14:00:00 +01:00
Lady Gegga
3f928a158f Base: Add Miscellaneous Technical glyphs to font Katica Regular 10
2317, 2318, 231A, 231B, 2326-2328, 232B, 2380-238C, 2396-239A,
23CD-23CF, 23E9-23FE

https://www.unicode.org/charts/PDF/U2300.pdf
2022-01-05 14:00:00 +01:00
Lady Gegga
1c2728ca0c Base: Add Miscellaneous Symbols and Arrows to font Katica Regular 10
2B1B, 2B1C, 2B55, 2B57, 2B58, 2B59

https://www.unicode.org/charts/PDF/U2B00.pdf
2022-01-05 14:00:00 +01:00
Lady Gegga
60f943c495 Base: Add Mathematical Operators to font Katica Regular 10
2206, 2207, 220F, 2227-222C, 2250-225C, 2261, 2263,
228F-22A1, 22A9-22AB, 22B0, 22B1, 22B9, 22BA, 22BF,
22D5, 22FF

https://www.unicode.org/charts/PDF/U2200.pdf
2022-01-05 14:00:00 +01:00
Lady Gegga
988bd6ed03 Base: Add Miscellaneous Symbols and Pictographs to Katica Regular 10
1F41B, 1F419, 1F420, 1F421, 1F433, 1F43E, 1F43D, 1F41A, 1F442, 1F41E

https://www.unicode.org/charts/PDF/U1F300.pdf
2022-01-05 14:00:00 +01:00
Lady Gegga
c1b8f7c9c7 Base: Add Supplemental Symbols and Pictographs to Katica Regular 10
1F916, 1F988, 1F955, 1F968, 1F980, 1F940, 1F94C, 1F991, 1F969

https://www.unicode.org/charts/PDF/U1F900.pdf
2022-01-05 14:00:00 +01:00
Lady Gegga
f8bd3120a1 Base: Change some glyphs in font Katica Regular 10
1F50C, 1F5B2, 1F964, 1F941
2022-01-05 14:00:00 +01:00
Lady Gegga
a407511ebd Base: Add Box Drawing glyphs to font Katica Regular 10
2518, 2510, 250C, 2514, 253C, 2500, 251C, 2524, 2534, 252C,
2502

The following glyphs are ported directly from
2329c52ad9:
2550, 2551, 2554, 2557, 255A, 255D

https://www.unicode.org/charts/PDF/U2500.pdf
2022-01-05 14:00:00 +01:00