Commit graph

27241 commits

Author SHA1 Message Date
Ben Wiederhake
e118ad3273 wasm: Avoid making StringView of temporary ByteBuffer 2021-09-11 13:22:51 +03:00
Ben Wiederhake
d9c1162a20 nproc: Avoid making StringView of temporary ByteBuffer 2021-09-11 13:22:51 +03:00
Ben Wiederhake
6c8eea6f5e LibWasm: Avoid making StringView of temporary ByteBuffer 2021-09-11 13:22:51 +03:00
Ben Wiederhake
2223f22590 SystemMonitor: Avoid making StringView of temporary ByteBuffer 2021-09-11 13:22:51 +03:00
Ben Wiederhake
4ef9a1ba48 Spreadsheet: Avoid making StringView of temporary ByteBuffer 2021-09-11 13:22:51 +03:00
Andreas Kling
470c99a2a6 LibJS: Tweak the WeakContainer::remove_swept_cells() API a little bit
Make this API take a Span<Cell*> instead of a Vector<Cell*>&.
This is behavior neutral, but stops the API looking like it wants to
do mutable things to the Vector.
2021-09-11 12:09:55 +02:00
Timothy Flynn
9b5696fee7 LibJS: Implement Intl.NumberFormat.prototype.resolvedOptions 2021-09-11 11:05:50 +01:00
Timothy Flynn
071e193d92 LibJS: Implement Intl.NumberFormat.supportedLocalesOf 2021-09-11 11:05:50 +01:00
Timothy Flynn
e42ba7f748 LibJS: Implement the Intl.NumberFormat constructor 2021-09-11 11:05:50 +01:00
Timothy Flynn
cf1923edeb js: Implement pretty-printing of Intl.NumberFormat 2021-09-11 11:05:50 +01:00
Timothy Flynn
07f12b108b LibJS: Implement a nearly empty Intl.NumberFormat object
This adds plumbing for the Intl.NumberFormat object, constructor, and
prototype.
2021-09-11 11:05:50 +01:00
Timothy Flynn
a1954262f8 LibJS: Handle Unicode locale extensions in the ResolveLocale operation
Currently, all callers of ResolveLocale invoke the operation with an
empty [[RelevantExtensionKeys]] slot, so the block of the method that
deals with those keys was unimplemented. This implements that block now
to prepare for Intl.NumberFormat which has a [[RelevantExtensionKeys]].

Note that the find_key_in_value() method is a simple VERIFY_NOT_REACHED
in just this commit until the Intl.NumberFormat's keys are handled in
its implementation.
2021-09-11 11:05:50 +01:00
Timothy Flynn
e6334cb856 LibUnicode: Add some data related to currency codes
This data is published under ISO-4217 as an XML file. Since we can't
parse XML files yet, and the data isn't very large, it was translated to
C++ manually here.
2021-09-11 11:05:50 +01:00
Timothy Flynn
3ae4ff109f LibUnicode: Extract canonicalization of Unicode extension values
LibJS will need to canonicalize Unicode extension values, so extract the
lambda that was doing this work to its own function. This also changes
the helpers it invokes to take the provided key as a StringView because
we don't need (and won't always have) full String objects here.
2021-09-11 11:05:50 +01:00
Timothy Flynn
b1d4bcf364 LibUnicode: Generate numeric keyword values for each locale
This is needed for Intl.NumberFormat's usage of the ResolveLocale AO,
where the [[RelevantExtensionKeys]] internal slot will be "nu".
2021-09-11 11:05:50 +01:00
Liav A
f5de4f24b2 Kernel/Devices: Defer creation of SysFS component after the constructor
Instead of doing so in the constructor, let's do immediately after the
constructor, so we can safely pass a reference of a Device, so the
SysFSDeviceComponent constructor can use that object to identify whether
it's a block device or a character device.
This allows to us to not hold a device in SysFSDeviceComponent with a
RefPtr.
Also, we also call the before_removing method in both SlavePTY::unref
and File::unref, so because Device has that method being overrided, it
can ensure the device is removed always cleanly.
2021-09-11 11:41:14 +02:00
Mustafa Quraish
c545d4ffcb WidgetGallery: Add GUI::ValueSlider widget
This was a cool slider and was missing from the gallery completely.
Vertical mode for this isn't enabled, and it looked awfully crammed
in the bottom along with the other horizontal sliders, so for now
I've just added this to the top, and it controls the opacity of the
image along with the opacity slider.
2021-09-11 11:37:39 +02:00
Brian Gianforcaro
a4efaa7b47 Tests/Kernel: Fix test after off-by-one fix in Memory::is_user_range()
Commit 890c647e0f fixed an off-by-one bug, so the mapping of the page
at the very end of the user address space now works correctly.

This change adjusts the test so cover the corner cases the original
version was designed too.validate.
2021-09-11 04:15:16 +00:00
Andreas Kling
890c647e0f Kernel: Fix off-by-one in Memory::is_user_range() check
This function was checking 1 byte after the provided range, which caused
it to reject valid userspace ranges that happened to end exactly at the
top of the user address space.

This fixes a long-standing issue with mysterious Optional errors in
Coredump::write_regions(). (It happened when trying to add a memory
region at the very top of the address space to a coredump.)
2021-09-11 02:34:55 +02:00
Andreas Kling
2116fb5be9 UserspaceEmulator: Ignore perf_event and perf_register_string syscalls
We can just fail these with ENOSYS pending a full implementation.
2021-09-11 02:13:52 +02:00
Andreas Kling
5514f41f25 LibWeb: Ignore keydown events when there is no layout tree 2021-09-11 02:13:06 +02:00
Andreas Kling
d69133e4ac LibWeb: Stub out a dummy window.getComputedStyle()
This just returns an empty CSSStyleDeclaration for now. The real thing
needs to be a live object that provides a view onto the computed style
of a given element. This is far from that, but it's something. :^)
2021-09-11 00:36:37 +02:00
Andreas Kling
1484980f8f LibWeb+LibJS: Remember source filenames when using HTML::Script
It's a lot easier to debug JavaScript problems if you can see which file
the errors are in. :^)
2021-09-11 00:36:37 +02:00
Linus Groh
6595db9ecf Ports: Build Python with --enable-optimizations
This no longer results in linker errors as the FIXME states, so let's
get some perf for free :^)
2021-09-11 00:28:39 +02:00
Linus Groh
6b15faed30 Ports: Build Python with libuuid
This makes the _uuid module work :^)
2021-09-11 00:28:39 +02:00
Linus Groh
8b3e1c0016 Ports: Add libuuid 2021-09-11 00:28:39 +02:00
Linus Groh
f646d49ac1 Kernel: Add _SC_HOST_NAME_MAX 2021-09-11 00:28:39 +02:00
Tobias Christiansen
6f2a016565 PixelPaint: Add "Clear Guides" to remove all Guides
This patch adds a "Clear Guides" option to the "View"-menu.
2021-09-11 00:28:27 +02:00
Luke Wilde
3548b08de2 LibJS: Implement Temporal.PlainMonthDay.prototype.equals 2021-09-10 23:10:18 +01:00
Luke Wilde
2d5b15295a LibJS: Implement Temporal.PlainMonthDay.from 2021-09-10 23:10:18 +01:00
Luke Wilde
d9d1e25db3 LibJS: Implement ToTemporalMonthDay AO 2021-09-10 23:10:18 +01:00
Tobias Christiansen
de0791b0a1 LibGfx: Increase bit-width of variables used in do_draw_scaled_bitmap
To avoid expensive floating point operations the values are put in the
upper half of an integer which is then used for calculations.
When the src_rect is sufficiently large (when, say, PixelPaint is zoomed
in x100), the precision provided by this strategy with regular
32-bit-long ints  is no longer enough.
This patch changes the used types to i64, which are 64 bits wide and the
shifting is increased to 32 bits.
On the 32-bit-arch a i64 doesn't fit in a single register anymore but
it's probably okay to trust the compiler to do clever stuff around this
issue.
2021-09-11 00:09:33 +02:00
Andreas Kling
d7578ddebb LibJS: Share "parsed identifiers" between copied JS::Lexer instances
When we save/load state in the parser, we preserve the lexer state by
simply making a copy of it. This was made extremely heavy by the lexer
keeping a cache of all parsed identifiers.

It keeps the cache to ensure that StringViews into parsed Unicode escape
sequences don't become dangling views when the Token goes out of scope.

This patch solves the problem by replacing the Vector<FlyString> which
was used to cache the identifiers with a ref-counted
HashTable<FlyString> instead.

Since the purpose of the cache is just to keep FlyStrings alive, it's
fine for all Lexer instances to share the cache. And as a bonus, using a
HashTable instead of a Vector replaces the O(n) accesses with O(1) ones.

This makes a 1.9 MiB JavaScript file parse in 0.6s instead of 24s. :^)
2021-09-10 23:18:00 +02:00
Ben Wiederhake
7684e4f726 WindowServer: Fix 'sticky' mouse after resize
This fixes #9933 and some dead code I accidentally left over.
Thanks, @Maato!
2021-09-10 22:09:23 +02:00
Damien Firmenich
61f573fa67 Breakout: Improve collision response between ball and paddle
When the ball hits the side of the paddle, it would get stuck because
the paddle moves faster than the ball. This commit forces the post-
collision vertical velocity of the ball to be going up and makes sure
that new ball's y-position is higher than in the previous frame.
2021-09-10 22:08:22 +02:00
Liav A
d0245b5e6b Kernel/CommandLine: Verify ACPI feature level cannot have invalid string
The allowed options are "on", "limited" and "off". Anything else is now
not allowed and will result in kernel panic.
2021-09-10 22:01:23 +02:00
Liav A
026f80a95b Kernel/ACPI: Simplify parser initialization
Let's remove the DynamicParser class, as it really did nothing yet in
the Kernel. Instead, when we add support for AML parsing, we can figure
out how to do it properly without the need of a derived class that just
complicates everything for no good reason.
2021-09-10 22:01:23 +02:00
Idan Horowitz
6348b63476 Kernel: Add kernelearlyputstr and use it in dbgln in very-early boot
This variant of dbgputstr does not lock the global log lock, as it is
called before the current or any other processor was initialized,
meaning that:
A) The $gs base was not setup yet, so we cannot enter into critical
   sections, and as a result we cannot use SpinLocks
B) No other processors may try to print at the same time anyway
2021-09-10 22:58:08 +03:00
Idan Horowitz
18d2a74e62 AK: Only try and get the Processor::current_id when it was initialized
This caused a null pointer dereference on early boot, since the gs_base
was not set yet.
2021-09-10 22:58:08 +03:00
Idan Horowitz
bc7b0a8986 Kernel: Replace inline assembly for turning on IA32_EFER.NXE with MSR
This fixes a triple fault that occurs when compiling serenity with
the i686 clang toolchain. (The underlying issue is that the old inline
assembly did not specify that it clobbered the eax/ecx/edx registers
and as such the compiler assumed they were not changed and used their
values across it)

Co-authored-by: Brian Gianforcaro <bgianf@serenityos.org>
2021-09-10 22:58:08 +03:00
Mustafa Quraish
a9e9bd8d84 HexEditor: Remove unveil() for CLI file, use FileSystemAccessServer
Previously we unveiled the file specified through the command-line
interface. Now, we just make the request through the
FileSystemAccessServer instead.
2021-09-10 20:46:50 +04:30
Mustafa Quraish
3a7e42ba73 TextEditor: Remove unveil() for CLI file, use FileSystemAccessServer
Previously we unveiled the file specified through the command-line
interface. Now, we just make the request through the
FileSystemAccessServer instead.
2021-09-10 20:46:50 +04:30
Mustafa Quraish
8378ecc67b TextEditor/FileArgument: Remove file existance check for early exit
This check was fine earlier when we had access to the full filesystem,
but now that we are moving away from applications having unveiled
access to the filesystem, this check would just get rejected from
the kernel. This is rare / fast enough that performance should not
really matter in any case.
2021-09-10 20:46:50 +04:30
Mustafa Quraish
63ff5873d8 PDFViewer: Open CLI files through FileSystemAccessServer without prompt
Use `request_file_read_only_approved()` for the file (if any) is
specified through a command line argument.
2021-09-10 20:46:50 +04:30
Mustafa Quraish
ecb3f882a3 LibFileSystemAccessClient: Convert request paths to absolute if needed
FileSystemAccessServer requires all paths to be absolute, and will
just crash if this is not the case. Instead of expecting the user to
always provide an absolute path, the client just checks to see if
the path provided was absolute, and if not makes a request with the
absolute path instead.
2021-09-10 20:46:50 +04:30
Mustafa Quraish
2a968e92f0 FileSystemAccessServer: Allow read-only access without prompting
This commit adds a new request to the FileSystemAccessServer
endpoint, allowing the clients to get read-only access to a file
without getting a Dialog-box prompting the user for access.

This is only meant to be used in cases where the user has asked
specifically to open a file through the command-line arguments.
In those cases, I believe it makes sense for the read-only access
to be implicit. Always prompting the user gets a bit annoying,
especially if you just quickly want to open a file through the CLI.

The new request name has been made extremely specific to make sure
that it's only used when appropriate.
2021-09-10 20:46:50 +04:30
Ali Mohammad Pur
b37211a615 Documentation: Tweak IntrusiveList example to reflect new API 2021-09-10 18:05:46 +03:00
Ali Mohammad Pur
14c8373eb0 AK+Kernel: Reduce the number of template parameters of IntrusiveRBTree
This makes the user-facing type only take the node member pointer, and
lets the compiler figure out the other needed types from that.
2021-09-10 18:05:46 +03:00
Ali Mohammad Pur
5a0cdb15b0 AK+Everywhere: Reduce the number of template parameters of IntrusiveList
This makes the user-facing type only take the node member pointer, and
lets the compiler figure out the other needed types from that.
2021-09-10 18:05:46 +03:00
Hendiadyoin1
93cf01ad7d AK: Mark HashTable::size_in_bytes() as constexpr 2021-09-10 14:33:53 +00:00