Commit Graph

10 Commits

Author SHA1 Message Date
Shannon Booth
62040ff7ae LibURL: Remove not particuarly useful NOTE
This doesn't seem like something we will neccessarily do in the URL
class anyway due to performance reasons - unless strictly needed (like
for the DOMURL implementation).

(cherry picked from commit 670ce3ebb17173a2f529cd0ce7cbe8b194c1573a)
2024-10-15 12:08:50 -04:00
Shannon Booth
e1417b2da1 LibURL: Also remove carriage returns from URL input
The definition of an "ASCII tab or newline" also includes U+000D CR.

This fixes 3 subtests in:

https://wpt.live/url/url-constructor.any.html
(cherry picked from commit 41cf9f6fe3f6a36094a8db3ace0733e1e3666092)
2024-10-15 12:08:50 -04:00
Shannon Booth
b4d3a6016e LibURL: Validate for invalid _domain_ code points for non-opaque domains
We were previously not checking for C0 control, U+0025 (%), or U+007F
DELETE.

This makes another good set of URL tests in WPT pass :^)

(cherry picked from commit fdf4f1e887df18bfb51d2c4d8cc469bc75cc016f)
2024-10-15 12:08:50 -04:00
Shannon Booth
2cf67c664d LibURL: Don't consider file:// URL hosts as always opaque
Which was resulting in file URL hosts not being correctly percent
decoded.

(cherry picked from commit a661daea71be0151e4a155db817ff13be9926582)
2024-10-15 12:08:50 -04:00
Shannon Booth
edbf199e5f LibURL: Remove note about bare-boned URL host parsing
It's not so bare-boned any longer :^)

(cherry picked from commit dd7c720657ed6d99328bb785bc65fd5959393e2a)
2024-10-15 12:08:50 -04:00
Andreas Kling
055f4ec64f LibURL: Make URL a copy-on-write type
This patch moves the data members of URL to an internal URL::Data struct
that is also reference-counted. URL then uses a CopyOnWrite<T> template
to give itself copy-on-write behavior.

This means that URL itself is now 8 bytes per instance, and copying is
cheap as long as you don't mutate.

This shrinks many data structures over in LibWeb land. As an example,
CSS::ComputedValues goes from 3024 bytes to 2288 bytes per instance.

(cherry picked from commit 936b76f36e87a6d4cf267c15c95786ef677515fc)
2024-08-13 15:42:19 -04:00
Tim Ledbetter
2519dadbb3 LibURL: Convert ASCII only URLs to lowercase during parsing
This fixes an issue where entering EXAMPLE.COM into the URL bar in the
browser would fail to load as expected.

(cherry picked from commit 1a4b042664f8fddbfa70f009c5873b1f8575bf0b)
2024-06-27 14:00:51 +02:00
Andreas Kling
d568b15acf LibURL: Avoid expensive IDNA::to_ascii() for all-ASCII domain strings
20% of CPU usage when loading https://utah.edu/ was spent doing these
ASCII conversions in URL parsing.
2024-04-05 16:01:10 -06:00
Timothy Flynn
576c2f4f4d LibURL+LibUnicode+LibWebView: Handle punycode directly in LibURL
We had defined punycode handling in LibUnicode when LibURL (AK at the
time) was unable to depend on LibUnicode. This is no longer the case.
2024-03-26 12:25:21 -04:00
Shannon Booth
e800605ad3 AK+LibURL: Move AK::URL into a new URL library
This URL library ends up being a relatively fundamental base library of
the system, as LibCore depends on LibURL.

This change has two main benefits:
 * Moving AK back more towards being an agnostic library that can
   be used between the kernel and userspace. URL has never really fit
   that description - and is not used in the kernel.
 * URL _should_ depend on LibUnicode, as it needs punnycode support.
   However, it's not really possible to do this inside of AK as it can't
   depend on any external library. This change brings us a little closer
   to being able to do that, but unfortunately we aren't there quite
   yet, as the code generators depend on LibCore.
2024-03-18 14:06:28 -04:00