Commit graph

63749 commits

Author SHA1 Message Date
Timothy Flynn
999f7c5eb5 LibCore: Ensure shared memory file names on macOS are unique
At least on my mac, clock_gettime only provides millisecond resolution.
So if many WebContent processes are opened at once, it is not unlikely
that they will all create their backing stores within the same ms. When
that happens, all but the first will fail (and crash).

To prevent this, generate the shared memory file name based on the PID
and a static counter.

(cherry picked from commit 5056bda043984953685bb4284fc698ab42418045)
2024-11-10 20:06:23 -05:00
Andreas Kling
e715c973cc LibWebView: Update User-Agent spoofing strings with new versions
Also use an OrderedHashMap so they show up in the same order in UI.

(cherry picked from commit a2a9a11466aba1ab357922e8bd0338222e3f4179)
2024-11-10 20:06:23 -05:00
Andreas Kling
63f1877f4a LibTLS: Put debug spam about loaded certificates behind TLS_DEBUG
(cherry picked from commit fce4739d3eab2c88e432c74590a3cc200664a392)
2024-11-10 20:06:23 -05:00
Andreas Kling
3590a94fc4 LibJS: Don't leak class field initializers
We were storing these in Handle (strong GC roots) hanging off of
ECMAScriptFunctionObject which effectively turned into world leaks.

(cherry picked from commit 5aa1d7837fe37dd203763178df3325ff8b24abbd)
2024-11-10 19:39:05 -05:00
Andreas Kling
1b6c784b77 LibCore: Don't reserve 2 KiB of stack memory when processing event queue
The inline capacity on ThreadEventQueue::Private::queued_events caused
us to reserve (and importantly, not initialize!) 2 KiB of stack memory
when entering ThreadEventQueue::process().

This was causing any leftover pointers to GC-allocated objects within
that memory range to keep those objects alive, even when all other
references were gone.

(cherry picked from commit 8c809fa5ee52903921191db91dce432b8a62dd01)
2024-11-10 19:39:05 -05:00
Andreas Kling
f670b2ca32 AK: Use getrlimit() to find the correct main thread stack size on macOS
This is what JavaScriptCore does as well.

(cherry picked from commit 11458f0d91654feed9b4e225c4e6ac8528057355)
2024-11-10 19:39:05 -05:00
Andreas Kling
c00dda5a3a WebContent: Try to run manual GC with less stuff on the stack
This makes it more likely to succeed in collecting stuff that's actually
dead, by reducing the memory range scanned for possible pointers.

(cherry picked from commit 1510c1876c023de977bf5b028672e61336761176)
2024-11-10 19:39:05 -05:00
Andreas Kling
ad4abc1818 UI/AppKit: Make "Dump GC Graph" menu action actually work again
This was originally implemented as a debug request, but later changed.
The Qt UI already did the right thing, so just copy the logic over.

(cherry picked from commit 08ae305dc5a621233b2d329581969899efbb1195)
2024-11-10 19:39:05 -05:00
Shannon Booth
23ff912009 LibJS: Allow unpaired surrogates in String.prototype.replace
This was resulting in a crash for the WPT test case:

https://wpt.live/xhr/send-data-string-invalid-unicode.any.html
(cherry picked from commit e02ca0480f7d39ff79fde59df024df9b53fe945e)
2024-11-10 19:39:05 -05:00
Shannon Booth
fdeeac157c LibJS: Implement Error.isError
Implementing the stage 2.7 proposal:

https://github.com/tc39/proposal-is-error
(cherry picked from commit e4891af9709c7f604a5118c341f99bc9f19d72a9)
2024-11-10 19:39:05 -05:00
Jelle Raaijmakers
b471972353 UI/Qt: Enable basic IME keyboard input for WebContentView
This makes dead keys work (e.g. typing ' and e results in é).

(cherry picked from commit 7e57cc7b090455e93261c847064f12a61d686ff3)
2024-11-10 18:24:10 -05:00
Jamie Mansfield
603f66017a Ladybird/Qt: Don't change to new tab with 'Open in New Tab'
It now just opens a new tab, without changing the current tab.

(cherry picked from commit df34ee058b1285d31386ee973f056d56f13d7bf6)
2024-11-10 18:24:10 -05:00
Jamie Mansfield
088c42ab6e Ladybird/Qt: Display ampersands in tab titles
Qt reads ampersands as shortcut keys, so this escapes them (with &&) so
they display correctly :^)

(cherry picked from commit 6133707df88d0b6e2e9eb62797658c1a88380a07)
2024-11-10 18:24:10 -05:00
Gasim Gasimzada
696021e252 LibJS: Set configurable toStringTag property for console
(cherry picked from commit c5b8e75204cb1603e2470e6cfeee3f2161a49b91)
2024-11-10 18:24:10 -05:00
Diego Frias
ffddf008d9 LibWasm: Ensure correct section ordering when parsing binary modules
There are (currently) no spec-tests ensuring that section ordering is
enforced, but it _is_ a part of the spec. A pull request to add this to
the specification testsuite has been opened at WebAssembly/spec#1775.

(cherry picked from commit c58665332ed588926e029d97f79b78da9a28514a)
2024-11-10 18:24:10 -05:00
Tim Ledbetter
736255ae87 LibWeb: Avoid division by zero in SourceSet width descriptor calculation
(cherry picked from commit 087d4004721193c290b18515e90b047192880a70)
2024-11-10 18:24:10 -05:00
Andrew Kaster
b58fb57a2c LibGfx: Use more Span methods in BitmapSequence instead of memcpy
And a few assorted cleanups to use more moves() to avoid copying Vectors
and NonnullRefPtrs.

(cherry picked from commit 1322a7e91794893755ae5a3510241e74d45720c5)
2024-11-10 17:42:37 -05:00
Tim Ledbetter
362d3a4b3a WebContent: Return errors from unimplemented WebDriver endpoints
Previously, some otherwise unimplemented WebDriver endpoints were
indicating that they had executed successful, this was causing a large
number of Web Platform Tests to time out when they should have failed.

(cherry picked from commit 8939ae8522419c3b7214884dad0b14839d5fa3b3)
2024-11-10 17:42:37 -05:00
Timothy Flynn
26551f6700 LibWeb: Always call document.close after document.write
This ensures the HTML parser completes running if it previously stopped
at an insertion point during a call to `document.write`.

(cherry picked from commit 230314238655204b89dd0736da4537b475eb252a)
2024-11-10 17:42:37 -05:00
sideshowbarker
c11cf1f5aa LibWeb: Replace tabs with 4 spaces in ARIAMixin.idl
Also, remove blank lines. (https://w3c.github.io/aria/#ARIAMixin source
doesn’t have any blank lines, and it’s not clear that the blank lines in
ours follow any intended structure/logic.)

(cherry picked from commit 0601216ac450402435c0e49276cb9ee5b5a96b27)
2024-11-10 17:42:37 -05:00
rmg-x
743a0ed2e1 LibWeb: Add log_filtered_request() method in ResourceLoader
This will reduce log noise when visiting sites
that have a lot of filtered content.

Previously, red error text would be displayed in
the logs for each filtered URL.

(cherry picked from commit ae983a2ef7cfc28dce0c954b308c79ceb25deece)
2024-11-10 17:42:37 -05:00
Nathan E. Egge
12ce47ec71 LibTimeZone: Remove AK_OS_SERENITY ifdef
Remove special case for SerenityOS as fallback will still work.

(cherry picked from commit b040e5c12bd5f7b6596f8b4765ee662a5add3611)
2024-11-10 16:04:55 -05:00
Nathan E. Egge
8a2d4103f3 LibTimeZone: Read /etc/timezone for current TZ
Fallback to reading /etc/timezone by calling system_time_zone() when
unable determine time zone from /etc/localtime.
This works on systems where /etc/localtime is a file and not a symlink.

Fixes #65

(cherry picked from commit d83ab035ee0179ee3af308fff2f36ad6d6f6d3ba)
2024-11-10 16:04:55 -05:00
Ali Mohammad Pur
9d11d82e2c Meta+Toolchain: Move the jakt runtime files into the Toolchain build dir
These files are all static libs and source code, and aren't needed to be
present at runtime inside the image.
2024-11-10 19:22:14 +01:00
Ali Mohammad Pur
352f879993 Shell: Add the 'command' builtin 2024-11-10 19:22:14 +01:00
Nico Weber
c4bbc08c2c Meta: Add TextTrackCue{,List}, VTT{Cue,Region} to GN build 2024-11-10 10:46:01 -05:00
Kemal Zebari
9714e98dc9 LibWeb/MimeSniff: Update the MIME type sniffing algo to meet specs
The spec moved/added the xml and html checks to the beginning and
removed sniffing resource feeds.

(cherry picked from commit b8a5e18a016dc32ba065417a4d6d32bbc03f101d)
2024-11-10 10:46:01 -05:00
Timothy Flynn
bedf88c8eb UI/Qt: Do not create signal notifiers until after an event loop exists
We are currently creating a signal socket and socket notifier before the
Qt event loop itself has been created. Thus, when we receive a signal,
we are not actually notified when we write that signal number to the
signal socket.

This was also the source of the following error message being displayed
on every launch of the browser:

    QSocketNotifier: Can only be used with threads started with QThread

(cherry picked from commit 3393a7477103cb2dc2fe970e3559abb34b3a0ce8)
2024-11-10 10:46:01 -05:00
Andrew Kaster
1b36465eea LibWeb: Deduplicate attributes when emitting start and end tags
The HTML tokenizer specification says that we're supposed to do this
when leaving the Attribute name or when emitting the token, as
appropriate.

Hopefully 'as appropriate' can mean only when emitting the token, as
that's the easiest place to insert this logic without complicating the
tokenizer any more.

(cherry picked from commit 7aa0165fe75bb94b79bc847484c7913d249ce263)
2024-11-10 10:46:01 -05:00
Sam Atkins
efb32e1bcc LibWeb/HTML: Re-order promise resolution to match spec
Applies changes in https://github.com/whatwg/html/pull/10658 and also
whichever previous change split the step for firing the navigateerror
into two parts.

(cherry picked from commit ec15f8fa626e5b0faf5b3e420080e944ab31ff11)
2024-11-10 10:46:01 -05:00
Aliaksandr Kalenik
2a9b255b41 LibWeb: Forbid reentrancy of style-layout-repaint in EventLoop::process
Fixes crashing on https://playbiolab.com/ in
VERIFY(page.client().is_ready_to_paint()) caused by attempting to start
the next repaint before the ongoing repaint is done.

(cherry picked from commit f341af1d7265eee880355f10ef5d479c9ebceaf2)
2024-11-10 10:46:01 -05:00
Tim Ledbetter
eb3219781d LibWeb/WebSocket: Allow sending binary blob data over a websocket
(cherry picked from commit 4ccc52e921a5b17c6f6ec67dec7c0dff46ac7884)
2024-11-10 10:46:01 -05:00
Tim Ledbetter
1df82e4c49 LibWebSocket: Don't allow a connection to be discarded more than once
(cherry picked from commit 6095aa3cc5a38367a57c3d734129017104498904)
2024-11-10 10:46:01 -05:00
Andreas Kling
bca2b88b45 LibWeb: Always blockify the root element
This is what the spec tells us to do:

    The root element’s display type is always blockified,
    and its principal box always establishes an independent
    formatting context.

    Additionally, a display of contents computes to block
    on the root element.

Spec link: https://drafts.csswg.org/css-display/#root

Fixes #1562

(cherry picked from commit f1be662f683155705f851bcf440fe30d0e606a87)
2024-11-10 10:46:01 -05:00
Gingeh
1459d48b26 LibWeb: Use substring matching for content filters
(cherry picked from commit 2e5edcf27e7d2a212043a7ac1b906217b357b964)
2024-11-10 10:46:01 -05:00
Chase Willden
8d21f70c75 Base: Navigate DOM tree with arrows
(cherry picked from commit 9d82e8112493575f78f66b1a0dc65ae0e791e70b)
2024-11-10 10:46:01 -05:00
Tim Ledbetter
fa08ac3631 LibWeb: Fire error event when script has an execution error
We now use the "report an exception" AO when a script has an execution
error. This has mostly replaced the older "report the exception" AO in
various specifications. Using this newer AO ensures that
`window.onerror` is invoked when a script has an execution error.

(cherry picked from commit 579a289d3db849657987c3310e7b1d71d290b566)
2024-11-10 10:46:01 -05:00
Andreas Kling
16473663ea LibJS: Don't infinite loop on unknown console.log formatting specifiers
(cherry picked from commit ef9208047dc8770f6263b483d7a442df703bc42b)
2024-11-10 10:46:01 -05:00
Jamie Mansfield
781a571669 LibWeb/Fetch: Handle edge cases in 'get, decode, and split'
See:
- https://github.com/whatwg/fetch/pull/1769
- https://github.com/whatwg/fetch/commit/3153e5e

(cherry picked from commit 84351dfa51dc8bd0046c3a9ec3e574c58fe9f790)
2024-11-10 10:46:01 -05:00
Sam Atkins
812c55784b LibWeb/CSS: Clarify comment about cascading presentational hints
The spec allows us to either treat them as part of the UA origin, or as
its own origin before author styles. This second behaviour turns out to
be what we are currently doing, which is nice!

Funnily enough this was clarified in the spec barely a month after this
original comment was written. :^)

(cherry picked from commit dcf55dd4924e5369d75a3533af2b869033a0ebfd)
2024-11-10 10:46:01 -05:00
Sam Atkins
c369a2b48c LibWeb/CSS: Correct behavior of revert inside a @layer
`revert` is supposed to revert to the previous cascade origin, but we
previously had it reverting to the previous layer. To support both,
track them separately during the cascade.

As part of this, we make `set_property_expanding_shorthands()` fall back
to `initial` if it can't find a previous value to revert to. Previously
we would just shrug and do nothing if that happened, which only works
if the value you want to revert to is whatever is currently in `style`.
That's no longer the case, because `revert` should skip over any layer
styles that have been applied since the previous origin.

(cherry picked from commit bea47a25545adfb96d83a16a3e4f4435bae05e39)
2024-11-10 10:46:01 -05:00
Jamie Mansfield
070fa6febf LibWeb/WebVTT: Implement VTTCue idl interface
(cherry picked from commit 973f774e56b519964f2f43d965035d9076658096)
2024-11-10 10:46:01 -05:00
Jamie Mansfield
b8530d3848 LibWeb/WebVTT: Implement VTTRegion idl interface
(cherry picked from commit 1a012f279a9791c685781b7189fba6cddb973f96)
2024-11-10 10:46:01 -05:00
Jamie Mansfield
7003437a43 LibWeb/HTML: Implement TextTrackCueList idl interface
(cherry picked from commit cfec88feb312f3fbffe2270009a9ba07e2fd9b3f)
2024-11-10 10:46:01 -05:00
Jamie Mansfield
24f5f7289f LibWeb/HTML: Implement TextTrackCue idl interface
(cherry picked from commit 0b2449d8d264f58b39ed2a4a69b0afb8eb762011)
2024-11-10 10:46:01 -05:00
Timothy Flynn
dfe695cdac WebDriver: Do not break WebDriver responses into multiple socket writes
WPT uses Python's http.client.HTTPConnection to send/receive WebDriver
messages. For some reason, on Linux, we see an ~0.04s delay between the
WPT server receiving the WebDriver response headers and its body. There
are tests which make north of 1100 of these requests, which adds up to
~44s.

These connections are almost always going to be over localhost and able
the be sent in a single write. So let's send the response all at once.

On my Linux machine, this reduces the runtime of /cookies/name/name.html
from 45-60s down to 3-4s.

(cherry picked from commit e5877cda61eb53cd9c1eebbfaf3c35d084b2973c)
2024-11-10 10:46:01 -05:00
Sam Atkins
d727545a1f LibJS: Update wording from Console spec
https://github.com/whatwg/console/pull/240 is an editorial change to use
the term "implementation-defined" more consistently. This seems to be
the only instance in the spec text which we quote verbatim.

(cherry picked from commit 51f82c1d939dd28a3e719d7fa495cf9f30d0921c)
2024-11-10 10:46:01 -05:00
Daniel La Rocque
051f218007 LibWeb: Fix "attempt to update a history entry's document"
This updates our implementation of
[attempt-to-populate-the-history-entry's-document](https://html.spec.whatwg.org/multipage/browsing-the-web.html#attempt-to-populate-the-history-entry's-document)
after fixes were made to the logic inside the queued task in
cdd014ae84 (diff-41cf6794ba4200b839c53531555f0f3998df4cbb01a4d5cb0b94e3ca5e23947dL99534).

(cherry picked from commit ed04124cbffbfe8b850e8e3a1bc0788513ce6a4d)
2024-11-10 10:46:01 -05:00
Daniel La Rocque
fb06647372 LibWeb: Make make_unsalvageable a public field
(cherry picked from commit 8b4dde0b0911f59512e1c40d19f33f49bdeeb10c)
2024-11-10 10:46:01 -05:00
Andreas Kling
1bf3aeaab4 LibWeb: Sync with spec in "destroy a document and its descendants"
The only real change here is that we make the document unsalvageable.
Everything else is fixing up spec comments.

(cherry picked from commit faf097bb4168208a7c0250280ff07e638be8058a)
2024-11-10 10:46:01 -05:00