Commit graph

34226 commits

Author SHA1 Message Date
Linus Groh
8b27917603 LibJS/Tests: Rename snake_case identifiers in string-basic.js 2022-02-13 14:33:46 +00:00
Linus Groh
b126a8b697 LibJS: Correct receiver value in GetValue's [[Get]] call 2022-02-13 14:30:26 +00:00
Linus Groh
5e2d059508 LibJS: Add spec comments to more Reference AOs 2022-02-13 14:30:03 +00:00
Andreas Kling
88e7d44cc4 LibJS+LibLine: Run clang-format 2022-02-13 14:55:23 +01:00
Andreas Kling
92e0378dbd LibJS: Always inline Lexer::current_code_point()
This gives a ~1% speedup when parsing the largest Discord JS file.
2022-02-13 14:44:36 +01:00
Andreas Kling
50a446a5d1 LibJS: Make more use of Token::flystring_value()
This patch makes check_identifier_name_for_assignment_validity()
take a FlyString instead of a StringView. We then exploit this by
passing FlyString in more places via flystring_value().

This gives a ~1% speedup when parsing the largest Discord JS file.
2022-02-13 14:44:36 +01:00
Andreas Kling
0cb0979990 LibJS: Add Token::flystring_value() to produce FlyString directly
When parsing identifiers, we ultimately want to sink the token string
into a FlyString anyway, and since Token may have a FlyString already
inside it, this allows us to bypass the costly FlyString(StringView).

This gives a ~3% speedup when parsing the largest Discord JS file.
2022-02-13 14:44:36 +01:00
Andreas Kling
515594c667 LibJS: Add fast_is<T>() for things that were hot in RTTI
This gives a ~4% speedup when parsing the largest Discord JS file.
2022-02-13 14:44:36 +01:00
Andreas Kling
1a3fa2d88b LibJS: Make Parser::ScopePusher::has_declaration() take FlyString
Everyone who calls this already has a FlyString, so we were doing *way*
more work by pessimizing it to a StringView.

This gives a ~2% speedup when parsing the largest Discord JS file.
2022-02-13 14:44:36 +01:00
Andreas Kling
3d9f2e2f94 LibJS: Add ASCII fast path to Lexer::current_code_point()
If the current character under the lexer cursor is ASCII, we don't need
to create a Utf8View to consume a full code point.

This gives a ~3% speedup when parsing the largest Discord JS file.
2022-02-13 14:44:36 +01:00
Andreas Kling
c74b6c06a5 AK: Use ByteBuffer::append(u8) in StringBuilder single-char append 2022-02-13 14:44:36 +01:00
Andreas Kling
22f6f0fc9e AK: Don't call memcpy() in ByteBuffer::append(u8)
We can emit way nicer code for the just-append-a-single-byte case.
2022-02-13 14:44:36 +01:00
Anonymous
34a4ce7955 LibJS: Stop eagerly creating the backing store for IndexedProperties
The vast majority of objects do not, and are unlikely to ever need
indexed property storage. By delaying the creation of the backing
store of IndexedProperties we reduce the memory used by each object
and reduce allocation and deallocation by somewhere between 20 and
30%
2022-02-13 14:44:36 +01:00
Anonymous
d1cc67bbe1 LibJS: Avoid unnecessary ToObject conversion when resolving references
When performing GetValue on a primitive type we do not need to perform
the ToObject conversion as it will resolve to a property on the
prototype object.

To avoid this we skip the initial ToObject conversion on the base value
as it only serves to get the primitive's boxed prototype. We further
specialize on PrimitiveString in order to get efficient behaviour
behaviour for the direct properties.

Depending on the tests anywhere from 20 to 60%, with significant loop
overhead.
2022-02-13 14:44:36 +01:00
Anonymous
3a184f7841 LibJS: Get rid of unnecessary work from canonical_numeric_index_string
The spec version of canonical_numeric_index_string is absurdly complex,
and ends up converting from a string to a number, and then back again
which is both slow and also requires a few allocations and a string
compare.

Instead lets use the logic we already have as that is much more
efficient.

This improves performance of all non-numeric property names.
2022-02-13 14:44:36 +01:00
Anonymous
44a2ebea00 LibJS: Correct the handling of accessors on strings 2022-02-13 14:44:36 +01:00
Anonymous
77511627e9 LibLine: Fix loading of terminal dimensions when running under lldb 2022-02-13 14:44:36 +01:00
rvictorr
434925bbd8 profile: Port to LibMain 2022-02-13 12:40:36 +01:00
rvictorr
73303f0dc1 LibCore: Add syscall wrapper for profiling_free_buffer() 2022-02-13 12:40:36 +01:00
rvictorr
014c0d68c0 LibCore: Add syscall wrapper for profiling_disable() 2022-02-13 12:40:36 +01:00
rvictorr
c6a743f22c LibCore: Add syscall wrapper for profiling_enable() 2022-02-13 12:40:36 +01:00
networkException
4dc23c9b24 LibGUI: Allow breadcrumbbar segment activation using the keyboard
We now interpret a breadcrumbbar segment gaining focus just as clicking
on the segment, allowing keyboard navigation using the arrow keys.
2022-02-13 12:39:44 +01:00
networkException
daf2ebca3b LibGUI: Allow activation of CommandPalette without a focused widget
Previously we required there to be a focused widget so it would have
been able to opt out. In case the isn't a focused widget there is no way
for it to opt out anyways, so let's allow CommandPalette to work in this
case :^)
2022-02-13 12:38:26 +01:00
electrikmilk
6858066e20 Base: Add PHP filetype icon
Add 16x16 and 32x32 file icons for PHP files.
2022-02-13 10:18:52 +01:00
electrikmilk
8c32b42bdf Base+PixelPaint: Add more icons 2022-02-13 10:18:37 +01:00
electrikmilk
dc5675ef22 Base: Improve git commit icon 2022-02-13 10:18:05 +01:00
electrikmilk
1a90249518 Base: Improve Space Analyzer icon
Improve Space Analyzer 16x16 icon by adding some tinting.
2022-02-13 10:17:55 +01:00
Sahan Fernando
4587e50b52 Kernel: Fix deadlock when setting VirtIOGPU resolution 2022-02-13 10:17:40 +01:00
Lady Gegga
f6f277debd Base: Add Unicode 15 characters to font Katica Regular 10
Nag Mundari (1E4D0-1E4F9)
https://www.unicode.org/charts/PDF/Unicode-15.0/U150-1E4D0.pdf

Geometric Shapes Extended (1F7D9)
https://www.unicode.org/charts/PDF/Unicode-15.0/U150-1F780.pdf

Transport and Map Symbols (1F6DC)
https://www.unicode.org/charts/PDF/Unicode-15.0/U150-1F680.pdf

CJK Unified Ideographs Extension H (3136B)
https://www.unicode.org/charts/PDF/Unicode-15.0/U150-31350.pdf

Symbols and Pictographs Extended-A (1FAAE, 1FABC, 1FA87)
https://www.unicode.org/charts/PDF/Unicode-15.0/U150-1FA70.pdf

Alchemical Symbols (1F774-1F776, 1F77B-1F77F)
https://www.unicode.org/charts/PDF/Unicode-15.0/U150-1F700.pdf

Latin Extended-G (1DF25-1DF2A)
https://www.unicode.org/charts/PDF/Unicode-15.0/U150-1DF00.pdf

Lao (0ECE)
https://www.unicode.org/charts/PDF/Unicode-15.0/U150-0E80.pdf

Kannada (0CF3)
https://www.unicode.org/charts/PDF/Unicode-15.0/U150-0C80.pdf

Khojki (1123F-11241)
https://www.unicode.org/charts/PDF/Unicode-15.0/U150-11200.pdf

Small Kana Extension (1B132, 1B155)
https://www.unicode.org/charts/PDF/Unicode-15.0/U150-1B130.pdf

Devanagari Extended-A (11B00-11B09)
https://www.unicode.org/charts/PDF/Unicode-15.0/U150-11B00.pdf
2022-02-13 10:17:16 +01:00
Idan Horowitz
9839a1699f gml-format: Skip writing formatted GML to file if no changes were made
This stops all GML files from appeared under the "Changes not staged
for commit" section of the commit message comment due to the changed
last-modified timestamp of the file.
2022-02-13 02:36:35 +02:00
Idan Horowitz
0a93bf5e7b Meta: Actually run gml-format in CI
Since gml-format is part of Lagom, it must be added to the post-lagom
linters section, or else it won't ever actually run.
2022-02-13 02:36:35 +02:00
Idan Horowitz
c8ab45e79f Userland: Run gml-format
This brings the existing GML files up to spec with the new requirements
2022-02-13 02:36:35 +02:00
Idan Horowitz
4c451422c3 gml-format+Playground: Print GML parsing error on formatting failure 2022-02-13 02:36:35 +02:00
Idan Horowitz
d4f08b3096 LibGUI: Enforce new GML newline and ordering guidelines
Specifically:
 * Properties must precede sub-object declarations.
 * There shouldn't be any newlines in-between properties.
 * There should be a newline in-between each sub-object.
 * Object declarations must include the curly braces.
 * There should be a newline between the properties of an object and
   it's sub-objects.
2022-02-13 02:36:35 +02:00
Andreas Kling
c52dc87a42 LibWeb: Don't crash on unknown CSS display types, fall back to inline
This patch also adds CSS::Display::to_string() so we can log the
unimplemented CSS display value (if you have LIBWEB_CSS_DEBUG enabled).
2022-02-13 01:03:49 +01:00
DerpyCrabs
58ce2dd088 LibWeb: Add stub implementation for Element's getClientRects
getClientRects supposed to return a list of bounding DOMRect
for each box fragment of Element's layout, but most elements have
only one box fragment, so implementing it with getBoundingClientRect
is useful.
2022-02-12 22:43:10 +01:00
DerpyCrabs
2f828231c4 LibWeb: Implement Geometry::DOMRectList
Implement DOMRectList that is used as a return type of
getClientRects functions on Element and Range.
2022-02-12 22:43:10 +01:00
Andreas Kling
0532d7d255 LibWeb: Stop sizing the context root box in formatting contexts
Until now, some formatting contexts (BFC in particular) have been
assigning size to the root box. This is really the responsibility of the
parent formatting context, so let's stop doing it.

To keep position:absolute working, parent formatting contexts now notify
child contexts when the child's root box has been sized. (Note that the
important thing here is for the child root to have its final used height
before it's able to place bottom-relative boxes.)

This breaks flexbox layout in some ways, but we'll have to address those
by improving the spec compliance of FFC.)
2022-02-12 22:30:50 +01:00
Andreas Kling
2f3af71261 LibWeb: Always rebuild stacking context tree during layout
We sometimes had a stale stacking context tree sitting around, causing
incorrect paints until the next full layout invalidation.

Fix this by simply rebuilding the stacking context tree when asked to.
2022-02-12 22:30:50 +01:00
Andreas Kling
40bd2cb611 LibWeb: Move initial containing block setup out of BFC
BFC currently has a number of architectural issues due to it being
responsible for setting the dimensions of the BFC root.

This patch moves the logic for setting up the ICB from BFC to Document.
2022-02-12 22:30:50 +01:00
Andreas Kling
8b8a1449c4 RequestServer: Make value copy of the URL in ensure_connection()
I saw what looked like a UAF of this URL in a RequestServer crash,
and it seems reasonable to make a copy here since we end up passing
them to Core::deferred_invoke().
2022-02-12 22:30:50 +01:00
Andreas Kling
3c108e20a7 PixelPaint: Run gml-format on FilterGallery.gml 2022-02-12 22:30:50 +01:00
Brian Gianforcaro
01cd838a4c Meta: Suppress rule V1076 in PVS-Studio Static Analysis
This rule attempts to flag invisible Unicode characters which would
potentially be used by an attacker to hide code that humans can't see.
https://pvs-studio.com/en/docs/warnings/v1076/

AKA the "Trojan Source" attack: https://arxiv.org/abs/2111.00169

Unfortunately our `LibUnicode` source code contains these hidden
characters as they are part of the Unicode character set that the
library exposes. So we have, and will always have 100s of false
positives.
2022-02-12 19:32:47 +02:00
Luke Wilde
d1c4a94659 LibWeb: Fix comparing current position to quote in Mime Type quote parse
Had a look over this with a fresh head and noticed I was comparing the
current lexer position to the quote character, oops!
2022-02-12 17:13:14 +00:00
Idan Horowitz
497dd5b354 LibWeb: Set response header cookies on redirects
Since we were previously relying on Document::set_cookie in order to
set cookies received as a 'Set-Cookie' response header, we would ignore
any response header cookies in redirect (status code 3xx) responses.

While this behaviour is not strictly enforced in the specification,
most major browsers do set cookies in redirect responses, and some
sites (e.g. Cookie Clicker) rely on this behaviour.

Since cookies are stored per-site and not per-document, this behaviour
is achieved by simply decoupling the cookie set mechanism from it.
2022-02-12 16:15:56 +00:00
Idan Horowitz
5e5b94a7ec LibWeb: Pass cookie string by reference in Document::set_cookie
This string is only taken by const reference internally, so there's no
point in forcing the callers to copy the string.
2022-02-12 16:15:56 +00:00
Idan Horowitz
721a4a0a67 LibWeb: Ignore Location headers unless the response status code is 3xx
As per RFC7231 the Location header field has different meanings for
different response status codes:
For 201 (Created) responses, the Location value refers to the primary
resource created by the request.
For 3xx (Redirection) responses, the Location value refers to the
preferred target resource for automatically redirecting the request.
2022-02-12 16:15:56 +00:00
Sam Atkins
a99d02e14d LibWeb: Add an enum for !important 2022-02-12 16:13:27 +00:00
Linus Groh
c08a52dd97 LibJS: Remove the name prefix for wrapped functions
This is a normative change in the ShadowRealm spec.

See: https://github.com/tc39/proposal-shadowrealm/commit/4ca634a
2022-02-12 16:06:37 +00:00
itskarudo
16aeb8b51d kill: Parse CLI arguments using Arguments.strings
The previous implementation used argv and LibC to parse arguments,
it now uses the Arguments.strings interface to do so.
2022-02-12 10:53:07 -05:00