Commit graph

28713 commits

Author SHA1 Message Date
Ben Wiederhake
9df8c31cdc Documentation: Fix broken empty links
The intention seems to be to enable links like:
https://github.com/SerenityOS/serenity/blob/master/Documentation/CodingStyle.md#east-const
However, this has never worked, and is also not how the syntax works.
Because there seems to be no demand for the intended feature (nobody
since 2019 fixed it), this patch removes it.

Found by markdown-checker.
2021-10-10 15:18:55 -07:00
Ben Wiederhake
3f88d65b78 markdown-checker: New tool that checks document links 2021-10-10 15:18:55 -07:00
Ben Wiederhake
50ad294527 AK: Implement a way to resolve relative paths lexically 2021-10-10 15:18:55 -07:00
Ben Wiederhake
24e7196158 LibMarkdown: Implement introspection of the document tree 2021-10-10 15:18:55 -07:00
Ben Wiederhake
aca01932bd LibMarkdown: Make href always a String
This already was the case in some sense, but made it very inconvenient
to access it.
2021-10-10 15:18:55 -07:00
Timothy Flynn
597379e864 LibUnicode: Generate and use unique locale-related alias strings
Almost all of these are already in the unique string list.
2021-10-10 22:21:48 +02:00
Timothy Flynn
acb7bd917f LibUnicode: Generate and use unique subtag and complex alias strings 2021-10-10 22:21:48 +02:00
Timothy Flynn
3d67f6bd29 LibUnicode: Generate and use unique list-format strings
The list-format strings used for Intl.ListFormat are small, but quite
heavily duplicated. For example, the string "{0}, {1}" appears 6,519
times. Generate unique strings for this data to avoid duplication.
2021-10-10 22:21:48 +02:00
Timothy Flynn
f9e605397c LibUnicode: Generate and use a set of unique locale-related strings
In the generated UnicodeLocale.cpp file, there are 296,408 strings for
localizations of languages, territories, scripts, currencies & keywords.
Of these, only 43,848 (14.8%) are actually unique, so there are quite a
large number of duplicated strings.

This generates a single compile-time array to store these strings. The
arrays for the localizations now store an index into this single array
rather than duplicating any strings.
2021-10-10 22:21:48 +02:00
Timothy Flynn
3f0095b57a LibUnicode: Skip unknown languages and territories
Some CLDR languages.json / territories.json files contain localizations
for some lanuages/territories that are otherwise not present in the CLDR
database. We already don't generate anything in UnicodeLocale.cpp for
these anomalies, but this will stop us from even storing that data in
the generator's memory.

This doesn't affect the output of the generator, but will have an effect
after an upcoming commit to unique-ify all of the strings in the CLDR.
2021-10-10 22:21:48 +02:00
Ben Wiederhake
6d99b7b72e Meta: Re-enable warnings for deprecated copies also for Lagom 2021-10-10 21:21:35 +01:00
Ben Wiederhake
0321034c87 Meta: Re-enable warnings for deprecated copies
This used to supress two true-positives, and zero false-positives.

That's good enough in my book to warrant re-activation.
2021-10-10 21:03:27 +01:00
Ben Wiederhake
ee18912373 LibGfx: Implement copy-assign for Matrix
This used to generate a warning about using a deprecated copy-assign,
default-generated by the compiler, and deprecated because we hand-
implement the copy-constructor. This warning is correct, since the
default-generated copy-assign may or may not be as efficient as memcpy.

This patch gets rid of the warning, and has either no performance impact
or a slightly positive one. If this turns out to be wrong, we should
probably also fix the copy-constructor.
2021-10-10 21:03:27 +01:00
Ben Wiederhake
fd8300e52d Kernel: Declare copy-ability of IOAddressGroup 2021-10-10 21:03:27 +01:00
Timothy Flynn
79707d83d3 LibUnicode: Stop generating large UnicodeData hash map
The data in this hash map is now available by way of much smaller arrays
and is now unused.
2021-10-10 13:49:37 +02:00
Timothy Flynn
d83b262e64 LibUnicode: Generate standalone compile-time array for combining class 2021-10-10 13:49:37 +02:00
Timothy Flynn
9f83774913 LibUnicode: Generate standalone compile-time array for special casing
There are only 112 code points with special casing rules, so this array
is quite small (compared to the size 34,626 UnicodeData hash map that is
also storing this data). Removing all casing rules from UnicodeData will
happen in a subsequent commit.
2021-10-10 13:49:37 +02:00
Timothy Flynn
da4b8897a7 LibUnicode: Generate standalone compile-time arrays for simple casing
Currently, all casing information (simple and special) are stored in a
compile-time array of size 34,626, then statically copied to a hash map
at runtime. In an effort to reduce the resulting memory usage, store the
simple casing rules in standalone compile-time arrays. The uppercase map
is size 1,450 and the lowercase map is size 1,433. Any code point not in
a map will implicitly have an identity mapping.
2021-10-10 13:49:37 +02:00
Brian Gianforcaro
7defb893a9 LibWeb: Remove dead "outer loop" code in adoption agency algorithm 2021-10-10 13:48:04 +02:00
Brian Gianforcaro
6781d60e3a LibWeb: Use "= default" to declare empty constructors and descructors
A types which have special functions declared with "= default can be
trivially copied. Besides being good practice, the compiler might be
able generate copy and initialize code in a more optimized way.

Found By PVS-Studio: https://pvs-studio.com/en/docs/warnings/v832/
2021-10-10 13:48:04 +02:00
Brian Gianforcaro
027cbe6b89 LibWeb: Optimize CSS::StyleDeclaration for size
We can reduce the amount of padding the compiler adds in order to
ensure data alignment of member variables by ordering the types in
a struct by size in decending order.

Found By PVS-Studio: https://pvs-studio.com/en/docs/warnings/v802/
2021-10-10 13:48:04 +02:00
Brian Gianforcaro
1b00ddf07e LibJS: Optimize PropertyName and StringPrototype for size
We can reduce the amount of padding the compiler adds in order to
ensure data alignment of member variables by ordering the types in
a struct by size in decending order.

Found By PVS-Studio: https://pvs-studio.com/en/docs/warnings/v802/
2021-10-10 13:48:04 +02:00
Brian Gianforcaro
d347432a9e LibELF: Use member initialization for AuxiliaryVector::optional_string
When the member is initialized in the constructor body, but also has a
default constructor, you pay for default construction to just throw it
away. In this case a StringView is light weight to initialize, but we
might as well fix all cases we find.

Found by PVS-Studio: https://pvs-studio.com/en/docs/warnings/v818/
2021-10-10 13:48:04 +02:00
Brian Gianforcaro
7b2506c054 Utilities: Fix null deref in groupdel when given a nonexistent group
Found By PVS-Studio
2021-10-10 03:10:05 -07:00
Mustafa Quraish
fdfc0d1bac FileManager: Listen for changes to Desktop wallpaper in config
Since there's no global API for being able to just assign a callback
function to config changes, I've made an inline struct in desktop
mode with the sole purpose of checking to see if the Wallpaper
entry has changed, and then updates GUI::Desktop.

It's pretty neat seeing the wallpaper change as soon as you edit the
config file :^)
2021-10-10 01:15:34 -07:00
Andreas Kling
4bf88436cb LibWeb: Handle JS exceptions slightly sooner in CSS.escape() 2021-10-10 02:55:19 +02:00
Ali Mohammad Pur
82da36f129 LibHTTP: Quit the read loop when an incomplete chunk size line is seen
If we don't quit, the underlying socket won't get a chance to do much
other than nothing while we spin in read_while_data_available().
Fixes some possible RS spin (especially seen in Google's cookie consent
page).
2021-10-10 00:27:44 +02:00
Ali Mohammad Pur
e8891e6d56 LibTLS: Remove useless ByteBuffer allocation in TLSv12::read_line() 2021-10-10 00:27:44 +02:00
Karol Kosek
c8d825e1b3 SpaceAnalyzer: Make files removable depending on directory permissions
Prior this patch, you couldn't remove any files from the context menu
if you didn't have write access to them.

It was incorrect, as the write permission for files means that you can
modify the contents of the file, where for directories it means that
you can create, rename, and remove the files there.
2021-10-09 23:31:01 +02:00
Karol Kosek
2a461704c4 LibCore: Display the correct allocation size in the debug line
Someone named Karol forgot to update this line in #10205..
2021-10-09 23:30:12 +02:00
Linus Groh
01370136ee LibJS: Convert delete_binding() to ThrowCompletionOr
Also add spec step comments to it while we're here.
2021-10-09 21:53:47 +01:00
Linus Groh
f35e268024 LibJS: Convert get_binding_value() to ThrowCompletionOr
Also add spec step comments to it while we're here.
2021-10-09 21:53:47 +01:00
Linus Groh
7652138ce0 LibJS: Convert set_mutable_binding() to ThrowCompletionOr
Also add spec step comments to it while we're here.
2021-10-09 21:53:47 +01:00
Linus Groh
ae397541fb LibJS: Convert initialize_binding() to ThrowCompletionOr
Also add spec step comments to it while we're here.
2021-10-09 21:53:47 +01:00
Linus Groh
2691c65639 LibJS: Convert create_immutable_binding() to ThrowCompletionOr
Also add spec step comments to it while we're here.
2021-10-09 21:53:47 +01:00
Linus Groh
4baf3a91e8 LibJS: Convert create_mutable_binding() to ThrowCompletionOr
Also add spec step comments to it while we're here.
2021-10-09 21:53:47 +01:00
Linus Groh
fbb176c926 LibJS: Convert has_binding() to ThrowCompletionOr
Also add spec step comments to it while we're here.
2021-10-09 21:53:47 +01:00
Linus Groh
617d3cd3d3 LibJS: Convert bind_this_value() to ThrowCompletionOr
Also add spec step comments to it while we're here.
2021-10-09 21:53:47 +01:00
Linus Groh
0aa24f4ce5 LibJS: Convert get_this_binding() to ThrowCompletionOr
Also add spec step comments to it while we're here.
2021-10-09 21:53:47 +01:00
Linus Groh
4f03138971 LibJS: Convert get_super_base() to ThrowCompletionOr
Also add spec step comments to it while we're here.
2021-10-09 21:53:47 +01:00
Linus Groh
a456eae4b1 LibJS: Remove unused FunctionEnvironment::replace_this_binding() 2021-10-09 21:53:47 +01:00
Andreas Kling
3b0da8b28c LibWeb: Add a missing null check in StyleComputer::compute_font() 2021-10-09 16:35:25 +02:00
Linus Groh
9d352c602c LibJS: Add callee realm fallback to ordinary_call_bind_this()
This makes ECMAScriptFunctionObject calls in the bytecode interpreter
work again (regressed in #10402).
2021-10-09 15:18:29 +01:00
Ali Mohammad Pur
b9ffa0ad2e LibRegex: Transform 0,1 min/unbounded max repetitions to * or +
The implementation of transform_bytecode_repetition_min_max expects at
least min=1, so let's also optimise on our way out of a bug where
'x{0,}' would cause a crash.
2021-10-09 15:57:05 +02:00
huwdp
ec43f7a2b0 LibWeb: Add initial version of pointer-events CSS property 2021-10-09 14:48:30 +01:00
Linus Groh
fe5c2b7bb9 LibJS: Decouple new_function_environment() from FunctionObject
Now that only ECMAScriptFunctionObject uses this, we can remove the
FunctionObject::new_function_environment() pure virtual method and just
implement it as a standalone AO with an ECMAScriptFunctionObject
parameter, next to the other NewFooEnvironment AOs.
2021-10-09 14:29:20 +01:00
Linus Groh
53af66d57d LibJS: Move ordinary_call_bind_this() to ECMAScriptFunctionObject
Now that it only needs to deal with ECMAScriptFunctionObject via
internal_call() / internal_construct(), we can:

- Remove the generic FunctionObject parameter
- Move it from the VM to ECMAScriptFunctionObject
- Make it private
2021-10-09 14:29:20 +01:00
Linus Groh
25bcd36116 LibJS: Move prepare_for_ordinary_call() to ECMAScriptFunctionObject
Now that it only needs to deal with ECMAScriptFunctionObject via
internal_call() / internal_construct(), we can:

- Remove the generic FunctionObject parameter
- Move it from the VM to ECMAScriptFunctionObject
- Make it private
2021-10-09 14:29:20 +01:00
Linus Groh
cf168fac50 LibJS: Implement [[Call]] and [[Construct]] internal slots properly
This patch implements:

- Spec compliant [[Call]] and [[Construct]] internal slots, as virtual
  FunctionObject::internal_{call,construct}(). These effectively replace
  the old virtual FunctionObject::{call,construct}(), but with several
  advantages:
  - Clear and consistent naming, following the object internal methods
  - Use of completions
  - internal_construct() returns an Object, and not Value! This has been
    a source of confusion for a long time, since in the spec there's
    always an Object returned but the Value return type in LibJS meant
    that this could not be fully trusted and something could screw you
    over.
  - Arguments are passed explicitly in form of a MarkedValueList,
    allowing manipulation (BoundFunction). We still put them on the
    execution context as a lot of code depends on it (VM::arguments()),
    but not from the Call() / Construct() AOs anymore, which now allows
    for bypassing them and invoking [[Call]] / [[Construct]] directly.
    Nothing but Call() / Construct() themselves do that at the moment,
    but future additions to ECMA262 or already existing web specs might.
- Spec compliant, standalone Call() and Construct() AOs: currently the
  closest we have is VM::{call,construct}(), but those try to cater to
  all the different function object subclasses at once, resulting in a
  horrible mess and calling AOs with functions they should never be
  called with; most prominently PrepareForOrdinaryCall and
  OrdinaryCallBindThis, which are only for ECMAScriptFunctionObject.

As a result this also contains an implicit optimization: we no longer
need to create a new function environment for NativeFunctions - which,
worth mentioning, is what started this whole crusade in the first place
:^)
2021-10-09 14:29:20 +01:00
Linus Groh
58c34012dd LibJS: Pop execution context after running queued jobs in run()
These would crash starting with the next commit otherwise, calling a
function always requires the running execution context to exist.
2021-10-09 14:29:20 +01:00