Commit Graph

26017 Commits

Author SHA1 Message Date
TheFightingCatfish
9721b7b2dd LibCore: Show version and help before parsing positional arguments
This allows `--version` and `--help` to work properly even if we do not
supply the required positional arguments to a command.
2021-08-20 20:13:12 +02:00
Timothy Flynn
6337eb52d8 LibJS: Implement RegExp.prototype.compile
This is an Annex B extension to RegExp.prototype.
2021-08-20 19:16:33 +02:00
Timothy Flynn
562d4e497b LibRegex: Treat pattern string characters as unsigned
For example, consider the following pattern:

    new RegExp('\ud834\udf06', 'u')

With this pattern, the regex parser should insert the UTF-8 encoded
bytes 0xf0, 0x9d, 0x8c, and 0x86. However, because these characters are
currently treated as normal char types, they have a negative value since
they are all > 0x7f. Then, due to sign extension, when these characters
are cast to u64, the sign bit is preserved. The result is that these
bytes are inserted as 0xfffffffffffffff0, 0xffffffffffffff9d, etc.

Fortunately, there are only a few places where we insert bytecode with
the raw characters. In these places, be sure to treat the bytes as u8
before they are cast to u64.
2021-08-20 19:16:33 +02:00
Timothy Flynn
7c54b6bd45 LibJS: Separate RegExpCreate into RegExpAlloc and RegExpInitialize
RegExp.prototype.compile will require invoking RegExpInitialize on an
already-existing RegExpObject. Break up RegExpCreate into RegExpAlloc
and RegExpInitialize to support this.
2021-08-20 19:16:33 +02:00
Sam Atkins
8f2ab524fa LibWeb: Fix inverted-if typo in flex_shrink_factor()
I messed this up when I changed it before, which was causing a crash.
2021-08-20 19:15:32 +02:00
Linus Groh
5d116372a8 LibJS: Implement Temporal.PlainMonthDay.prototype.toJSON() 2021-08-20 18:12:15 +01:00
Linus Groh
5904c6bf18 LibJS: Implement Temporal.PlainMonthDay.prototype.toLocaleString() 2021-08-20 18:12:15 +01:00
Linus Groh
ea44f33d5b LibJS: Implement Temporal.PlainMonthDay.prototype.toString() 2021-08-20 18:12:15 +01:00
Linus Groh
c1c8d7861c LibJS: Implement Temporal.PlainYearMonth.prototype.toJSON() 2021-08-20 18:12:15 +01:00
Linus Groh
70fb7bf57e LibJS: Implement Temporal.PlainYearMonth.prototype.toLocaleString() 2021-08-20 18:12:15 +01:00
Linus Groh
421ad73b4f LibJS: Implement Temporal.PlainYearMonth.prototype.toString() 2021-08-20 18:12:15 +01:00
Jesse Buhagiar
89eddb5bff LibGL: Implement glPolygonMode
Currently just sets the renderer option for what polygon mode we
want the rasterizer to draw in. GLQuake only uses `GL_FRONT_AND_BACK`
with `GL_FILL` )which implies both back and front facing triangles
are to be filled completely by the rasterizer), so keeping this as
a small stub is perfectly fine for now.
2021-08-20 20:04:06 +04:30
Andreas Kling
f58e2350dc LibWeb: Parse the CSS opacity property with strtof() for now
With the new parser, we started interpreting the `opacity` property as a
string value, which made it turn into `auto` and so anything with
opacity ended up not visible (e.g the header on google.com)

This patch restores our old behavior for `opacity` by interpreting it
as a numeric value with optional decimals.
2021-08-20 15:43:01 +02:00
Andreas Kling
ed7a2f21ff LibTextCodec: Remove unused is_standardized_encoding() 2021-08-20 15:31:46 +02:00
Andreas Kling
13f4890c38 LibCore: Make Core::File::open() return OSError in case of failure 2021-08-20 15:31:46 +02:00
Andrew January
1474a537b6 DisplaySettings: Lazily load wallpapers
Load the wallpaper in a background action instead of on the main thread.

This reduces the time to first paint, and makes the UI feel more
responsive when clicking on wallpaper thumbnails.

The behavior of the method is changed slightly to return true if it
succesfully "loads" the empty path. This makes the API a little more
consistent, where "true" means "I made changes" and "false" means "I did
not make changes". No call sites currently use the return value, so no
changes are needed to those.
2021-08-20 15:31:22 +02:00
Andrew January
ac055554f6 LibGUI: Reduce amount we init for FileIconProvider::filetype_image_icon
Instead of loading every icon, only load the filetype image icon if it
hasn't been already. This icon is used by IconViews that need to lazily
load thumbnails, which don't need any of the other icon types.

Spending the time to load the unneeded images was causing delays to
first paint in BackgroundSettings.
2021-08-20 15:31:22 +02:00
Karol Kosek
947b61c1de HackStudio: Update the window title after changing a file name
This is a very similar fix as the previous commit, but here it's
due to my oversight when I was adding an 'Save as..' feature.
2021-08-20 11:47:00 +02:00
Karol Kosek
6e64988396 HackStudio: Update the window title after changing an active editor
Prior this change, the window title was updated only when a new file
has been opened, which means that it wasn't updated when user selected
an already opened file in the split view.

This change updates the title whenever the active editor changes.
In addition, this title update logic has now its own function
as it'll also be used in the next commit. :)
2021-08-20 11:47:00 +02:00
Timothy Flynn
ddfd4cced7 CI: Set on-target test timeout to 60 minutes
The on-target pipelines have a timeout of 6 hours to allow time for a
clean toolchain + Serenity build. Tests should time out much sooner than
that though.
2021-08-20 10:34:52 +02:00
Timothy Flynn
25ae1f7f72 CI: Include a timestamp in the Azure ccache key
Caches on Azure are immutable - so if a cache changes, but its key does
not, then the cache is not updated. Include a timestamp in the ccache
key so that we always push an updated cache from the master branch. Then
use a subkey without the timestamp to pull the cache.

We use a similar trick on GitHub Actions.
2021-08-20 10:34:52 +02:00
Andreas Kling
8fce5caa49 LibGUI: Pass context menu events through normal event dispatch
Previously we'd synthesize an event and invoke context_menu_event()
directly. This prevented the event from bubbling even if ignored.
2021-08-20 01:27:39 +02:00
Andreas Kling
20b104dead WidgetGallery: Remove menubar 2021-08-20 01:27:39 +02:00
Idan Horowitz
cf271183b4 Kernel: Make Process::current() return a Process& instead of Process*
This has several benefits:
1) We no longer just blindly derefence a null pointer in various places
2) We will get nicer runtime error messages if the current process does
turn out to be null in the call location
3) GCC no longer complains about possible nullptr dereferences when
compiling without KUBSAN
2021-08-19 23:49:53 +02:00
Timothy Flynn
1259dc3623 LibJS: Allow Unicode escape sequences in identifiers
For example, "property.br\u{64}wn" should resolve to "property.brown".

To support this behavior, this commit changes the Token class to hold
both the evaluated identifier name and a view into the original source
for the unevaluated name. There are some contexts in which identifiers
are not allowed to contain Unicode escape sequences; for example, export
statements of the form "export {} from foo.js" forbid escapes in the
identifier "from".

The test file is added to .prettierignore because prettier will replace
all escaped Unicode sequences with their unescaped value.
2021-08-19 23:49:25 +02:00
Timothy Flynn
c5b5c779ff LibRegex+LibJS: Change capture group names from a String to a FlyString
The parser now stores this as a FlyString everywhere, so consumers can
also use it as a FlyString.
2021-08-19 23:49:25 +02:00
Timothy Flynn
4f2cbe119b LibRegex: Allow Unicode escape sequences in capture group names
Unfortunately, this requires a slight divergence in the way the capture
group names are stored. Previously, the generated byte code would simply
store a view into the regex pattern string, so no string copying was
required.

Now, the escape sequences are decoded into a new string, and a vector
of all parsed capture group names are stored in a vector in the parser
result structure. The byte code then stores a view into the
corresponding string in that vector.
2021-08-19 23:49:25 +02:00
Timothy Flynn
6131c0485e LibRegex: Use GenericLexer to consume escaped code points 2021-08-19 23:49:25 +02:00
Timothy Flynn
5ff9596678 LibRegex: Convert regex::Lexer to inherit from GenericLexer
This will allow regex::Lexer users to invoke GenericLexer consumption
methods, such as GenericLexer::consume_escaped_codepoint().

This also allows for de-duplicating common methods between the lexers.
2021-08-19 23:49:25 +02:00
Timothy Flynn
dd44a5e948 LibJS: Use GenericLexer to consume escaped code points 2021-08-19 23:49:25 +02:00
Timothy Flynn
fd8ccedf2b AK: Add GenericLexer API to consume an escaped Unicode code point
This parsing is already duplicated between LibJS and LibRegex, and will
shortly be needed in more places in those libraries. Move it to AK to
prevent further duplication.

This API will consume escaped Unicode code points of the form:
    \\u{code point}
    \\unnnn (where each n is a hexadecimal digit)
    \\unnnn\\unnnn (where the two escaped values are a surrogate pair)
2021-08-19 23:49:25 +02:00
Timothy Flynn
02e3633b7f AK: Move FormatParser definition from header to implementation file
This is primarily to be able to remove the GenericLexer include out of
Format.h as well. A subsequent commit will add AK::Result to
GenericLexer, which will cause naming conflicts with other structures
named Result. This can be avoided (for now) by preventing nearly every
file in the system from implicitly including GenericLexer.

Other changes in this commit are to add the GenericLexer include to
files where it is missing.
2021-08-19 23:49:25 +02:00
Timothy Flynn
e331656bb9 AK: Add GenericLexer to forwarding header 2021-08-19 23:49:25 +02:00
Andreas Kling
961f727448 Kernel: Consolidate a bunch of i386/x86_64 code paths
Add some arch-specific getters and setters that allow us to merge blocks
that were previously specific to either ARCH(I386) or ARCH(X86_64).
2021-08-19 23:22:02 +02:00
Kenneth Myhra
3f5a42b3dd LibC: Add FNM_NOMATCH to fnmatch.h
Adding FNM_NOMATCH fixes the currently broken curl port.
2021-08-19 22:27:26 +02:00
fladd
1de104c6c4 LibCore: Fix build error in File.cpp on macOS
struct stat on macOS doesn't have st_atim.tv_sec and therefore broke the
Lagom build. Replacing it with st_atime fixes that.
2021-08-19 19:47:34 +01:00
Idan Horowitz
ee608f58ee LibJS: Add type range checks to the Date make_day AO
As the specification says "but if this is not possible (because some
argument is out of range), return NaN."
2021-08-19 19:15:00 +01:00
Idan Horowitz
95bc8e4641 LibCore: Make DateTime's members signed
Core::DateTime is essentially a C++ wrapper of the tm struct, so we
should support the same signed range as the underlying tm.
2021-08-19 19:15:00 +01:00
Andrew Kaster
332b29c741 LibTest+Utilities: Print a start message before each test in run-tests
It can sometimes be difficult to tell from the debug.log and test stdout
which test was the last to run before the test runner hangs or exits the
QEMU instance unexpectedly.

Print out a start message before each test is executed, along with a
progress message indicating which test out of how many tests we're about
to run.
2021-08-19 18:42:34 +02:00
Jesse Buhagiar
6666230d3e Kernel/USB: Remove unused free function from QueueHead
This function is no longer required as the freeing is done
inside of the controller class through the pool interface.
2021-08-19 18:42:07 +02:00
Jesse Buhagiar
3f94857e7c Kernel/USB: Harden Descriptor memory allocation
The previous version of this was pretty bad and caused a lot of
odd behevaiour to occur. We now abstract a lot of the allocation
behind a `template`d pool class that handles all of the memory
allocation.
2021-08-19 18:42:07 +02:00
Jesse Buhagiar
ebb0d3e0eb Kernel/USB: Remove unused include from UHCIController.cpp 2021-08-19 18:42:07 +02:00
Jesse Buhagiar
4abf399a74 Kernel/USB: Move UHCI related structures to subdirectory
The number of UHCI related files is starting to expand to the point
where it's best if we move this into their own subdirectory. It'll
also make it easier to manage when we decide to add some more
controller types (whenever that may be)
2021-08-19 18:42:07 +02:00
Itamar
43392c567e HackStudio: Fix "navigate to include"
This fixes an off-by-one error in the "navigate to include" feature
of HackStudio.
2021-08-19 17:20:37 +02:00
Itamar
9ae98bc81b LibCpp: Handle circular imports gracefully
This patch prevents CppComprehensionEngine from endlessly looping when
there's a circular #include in the code.

We now keep track of the set of currently processed files, and will not
re-process a file if it already exists in this set.
When we're done with processing a file it is removed from this set.

The pragma once directive is not yet implemented, but regardless a
mechanism that prevents #include loops even in the absence of
pragma once is desired.
2021-08-19 17:20:37 +02:00
Jesse Buhagiar
68d895eb7c LibGL: Don't crash on invalid pname value in glGetFloatv
This brings `glGetFloatv` more inline with the other `glGet`
functions. We should prevent crashing in the driver as much as
possible and instead let the application deal with the generated
GL error.
2021-08-19 17:08:04 +02:00
Brian Gianforcaro
ca9619c750 Meta: Explicitly configure source directory in debug-kernel.sh
Previously debug-kernel.sh wouldn't detect source if you launched the
script from the wrong path. By explicitly setting the name, source will
be loaded by gdb in all situations.
2021-08-19 11:42:20 +02:00
Edward Palmer
abccb45060 Kernel: Move set_metadata_dirty calls to notify_watchers 2021-08-19 10:41:54 +02:00
Brian Gianforcaro
8e41d96618 AK: Enable IntrusiveList self reference to be optimized out when empty
If a member is an empty class, the standard normally stats that it needs
to have a size of at least 1 byte in order to guarantee that the
addresses of distinct objects of the same type are always distinct.

However as of c++20, we can use [[no_unique_address]] to instruct the
compiler that if the member has an empty type, it may optimize it to
occupy no space.
2021-08-19 08:07:45 +04:30
Linus Groh
0e201fbb42 LibJS: Implement Temporal.PlainDate.prototype.toJSON() 2021-08-19 00:26:09 +01:00