Commit Graph

27415 Commits

Author SHA1 Message Date
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
Hediadyoin1
1aa527f5b6 AK: Add OOM safe interface to HashTable/Map
This adds a new HashSetResult only returned by try_set, to signal
allocation failure during setting.
2021-09-10 14:33:53 +00:00
Sam Atkins
f36781a8bc Documentation: Clarify Windows build instructions
People seem to easily miss the "Setting up build tools" section, so I
have moved that step above the filesystem information and linked
directly to BuildInstructions.md to hopefully make it harder to skip.

Also, added mention of `\\wsl$` since that regularly comes up in
Discord.
2021-09-10 14:05:25 +00:00
Itamar
c78838c2d2 LibDebug: Use the first memory segment of a library as the ELF's base
When parsing the libraries of the debugee process, we previously
assumed that the region that's called `<library name>: .text` was also
the base of the ELF file.

However, since we started linking with `-z separate-code`, this is no
longer the case - our executables have a read-only segment before the
.text segment, and that segment is actually at the base of the ELF.

This broke inserting breakpoints with the debugger since they were
inserted at a wrong offset.

To fix that, we now use the address of the first segment in the memory
map for the ELF's base address (The memory map is sorted by address).
2021-09-10 13:57:34 +00:00
Idan Horowitz
679bde06ed AK: Remove a redundant double find-call in HashMap::ensure
If the value was found there's no reason to search for it again.
2021-09-10 15:26:41 +03:00
Rodolfo Olivieri
706323beb1 CI: Add statement to ensure workflow runs only on serenity
This statement ensures that the `Sonar Cloud Static Analysis` workflow
runs only for the official repository and not for the forks.
2021-09-10 01:20:39 +00:00
Andreas Kling
3164e22f9b Kernel: Fix null dereference in IPv4Socket::receive_packet_buffered()
This was a mistake in the move away from KBuffer-as-a-value type.
We need to check `packet` here, not `packet->data`.

Regressed in b300f9aa2f.

Fixes #9888.
2021-09-10 03:06:32 +02:00
Andreas Kling
8fabaaa2a8 LibWeb: Make "top-level browsing context" concept more spec-compliant
Any browsing context that doesn't have a parent browsing context is now
considered a top-level browsing context. This matches the HTML spec.

This means we no longer keep a pointer to the top-level context, since
we can simply walk the parent chain until we find the topmost ancestor.
2021-09-10 03:02:55 +02:00
Linus Groh
4e5becf36e LibJS: Make default_merge_fields() {additional_,}fields Object a const&
This only calls Object::{get,enumerable_own_property_names}() on the
fields and additional_fields Objects, both of which are const-qualified.
2021-09-09 23:46:45 +01:00
Linus Groh
4bba61fd59 LibJS: Make resolve_iso_month() fields Object a const&
This only calls Object::get() on the fields Object, which is
const-qualified.
2021-09-09 23:46:45 +01:00
Linus Groh
1f99538185 LibJS: Make Temporal foo_from_fields() AO field/options Object a const*
This is a bit of a lie as the Value(Object const*) ctor will const_cast
them in invoke(), but at least it ensures that nothing else in the
function relies on getting non-const Objects.
Perhaps we can have an actual Object const* Value in the future as well.
2021-09-09 23:46:45 +01:00
Linus Groh
4be2aeca00 LibJS: Make prepare_temporal_fields() fields Object a const&
This only calls Object::get() on the fields Object, which is
const-qualified.
2021-09-09 23:46:45 +01:00
Linus Groh
c9951ad26b LibJS: Make to_temporal_time_record() time like Object a const&
This only calls Object::get() on the temporal_time_like Object, which is
const-qualified.
2021-09-09 23:46:45 +01:00
Linus Groh
77a18392ff LibJS: Make to_temporal_duration_record() time like Object a const&
This only calls Object::get() or some Duration getters on the
temporal_duration_like Object, both of which are const-qualified.
2021-09-09 23:46:45 +01:00
Linus Groh
1d24699ca8 LibJS: Make Temporal to_foo() AO normalized_options Object a const&
These only pass the normalized_options Object directly or indirectly to
get_option(), which now takes a const reference.
2021-09-09 23:46:45 +01:00
Linus Groh
a422ea8792 LibJS: Make get_string_or_number_option() options Object a const&
This only passes the options Object to get_option(), which now takes a
const reference.
2021-09-09 23:46:45 +01:00
Linus Groh
c099b1b8a5 LibJS: Make get_option() options Object a const&
This only calls Object::get() on the options Object, which is
const-qualified.
2021-09-09 23:46:45 +01:00
Linus Groh
5ae6ad8557 LibJS: Store Instant's and ZonedDateTime's m_nanoseconds as a const&
There's no need for these to be non-const. Suggested by @IdanHo in
https://github.com/SerenityOS/serenity/pull/9904#discussion_r704960184.

Perhaps we can make more internal slots of these and other objects const
references as well, but that's a bit more involved as they are used by
various functions expecting non-const references.
2021-09-09 23:46:45 +01:00
Linus Groh
e4c07c5b8f LibJS: Make new_target parameter of all Temporal AOs a const*
These are passed to ordinary_create_from_constructor() in each case,
which takes the parameter as a const&, so these can also be const.
2021-09-09 23:46:45 +01:00
Karol Kosek
cf71805aa8 HackStudio: Reuse TextDocument::is_modified()
Previously, the modification tag in the editor file label was unset only
after a file was saved.

This commit will also unset the tag if you undo the stack (for example
by hitting Ctrl+Z) to the last saved state.
2021-09-10 00:00:53 +02:00
Rodrigo Tobar
2c22ff94b4 LibC: Define RLIM_NLIMITS constant
This is required by programs that want to either iterate over all
resources, or check that a resource identifier is valid before passing
it down.
2021-09-10 00:00:03 +02:00
Ken Herner
84f0d2aece Ports: Update libarchive to v3.5.2
Updated GPG fingerprint to Martin Matuska's latest public key
Fixes #9921
2021-09-09 22:57:09 +01:00
Ken Herner
f5071e7b2d Ports: Disable IPV6 in OpenSSL
Fixes #9902
2021-09-09 22:39:45 +01:00
Andreas Kling
c93687c15e LibC: Make remove() propagate non-EISDIR unlink() errors
Regressed in 16105091ba.
2021-09-09 21:49:49 +02:00
Andreas Kling
1864b2b828 LibWeb: Make HTMLScriptElement create and run ClassicScripts
Before this patch, HTMLScriptElement would cache the full script source
text in a String member, and parse that just-in-time via Document's
run_javascript() helpers.

We now follow the spec more closely and turn the incoming source text
into a ClassicScript object ("the script's script" in the spec.)
2021-09-09 21:25:10 +02:00
Andreas Kling
73be7e227b LibWeb: Implement the "create" and "run" methods of ClassicScript
These correspond to "create a classic script" and "run a classic script"
from the HTML specification. :^)
2021-09-09 21:25:10 +02:00
Andreas Kling
d823d7da54 LibJS: Implement the ParseScript AO (as JS::Script::parse()) 2021-09-09 21:25:10 +02:00