Commit graph

66204 commits

Author SHA1 Message Date
Tim Ledbetter
e764df15eb LibWebView+WebContent: Inform WebContent process if browser is headless 2024-12-10 10:31:47 -08:00
Timothy Flynn
520bf6c9be LibWeb: Return a better error message for invalid byte strings
We are currently returning LibJS's invalid code point message, but not
formatting it with the bad value. So we get something like:

    Unhandled JavaScript exception: [TypeError] Invalid code point {},
    must be an integer no less than 0 and no greater than 0x10FFFF

So not only is the error unformatted, but it's inaccurate; in this case,
the byte cannot be larger than 255.
2024-12-10 10:30:14 -08:00
Simek
a64432ec13 LibWeb/ARIA: Add missing menuitemradio widget role 2024-12-10 07:41:10 -08:00
Luke Wilde
d2acf32aae LibWeb: Register Wasm memory grow hook in constructor of Memory objects
Previously it would only register the hook for JavaScript constructed
Memory objects. This allows Ruffle to load again.
2024-12-10 15:54:20 +01:00
Feng Yu
f2eaf3381f LibWeb: Throw TypeError for new Headers(null)
The WebIDL for the `Headers` constructor specifies that the `init`
parameter is optional and must be of type `HeadersInit`. While the
parameter can be omitted (or explicitly set to `undefined`),
`null` is not a valid value.

This change fixes at least 2 "Create headers with null should throw"
WPT subtests which I have imported in this patch.
2024-12-10 06:46:31 -08:00
Luke Wilde
023c3aa5b0 LibWeb: Respect subarrays in Crypto#getRandomBytes
It is the responsibility of code that deals with TypedArrays to apply
the byte offset and byte length. Not doing this caused Unity Web to
crash, as they call getRandomValues with views into their full main
memory. Previously, it would fill their entire memory of about 33.5 MB
with random bytes.
2024-12-10 06:44:00 -08:00
Jelle Raaijmakers
30ec8c1d4d LibWeb: Implement "delete the selection" for the editing API 2024-12-10 14:54:19 +01:00
Jelle Raaijmakers
fd949ee3dd LibWeb: Only set selection focus if an associated DOM node was found
The relation from a paintable to a DOM node is not always set.
2024-12-10 14:54:19 +01:00
Jelle Raaijmakers
15e3db5932 LibWeb: Add internals.mouseDown(x, y)
This triggers a mouse button press without the up event, allowing us to
e.g. simulate a selection by moving the mouse while keeping the button
depressed.
2024-12-10 14:54:19 +01:00
Jelle Raaijmakers
bfb87b24a3 LibWeb: Use verify_cast in insertParagraph command
No functional changes.
2024-12-10 14:54:19 +01:00
Jelle Raaijmakers
1c55153d43 LibWeb: Refactor "editable" and "editing host" concepts
The DOM spec defines what it means for an element to be an "editing
host", and the Editing spec does the same for the "editable" concept.
Replace our `Node::is_editable()` implementation with these
spec-compliant algorithms.

An editing host is an element that has the properties to make its
contents effectively editable. Editable elements are descendants of an
editing host. Concepts like the inheritable contenteditable attribute
are propagated through the editable algorithm.
2024-12-10 14:54:19 +01:00
Jelle Raaijmakers
f88c13a58c LibWeb: Prevent null deref in collapsed whitespace check
The spec even warned us about the reference potentially being null.
2024-12-10 14:54:19 +01:00
Jelle Raaijmakers
d5143db081 LibWeb: Skip node trees outside of range in insertParagraph
Instead of recursively iterating all descendants of the common ancestor
of the new line range that are not contained by that range, skip the
entire node tree as soon as we determine they're not.
2024-12-10 14:54:19 +01:00
ronak69
d48831e893 LibWeb: Leave tooltip or unhover link only if page entered/hovered one
Before, on a mouse-move event, if the hovered html element did not have
a tooltip or it was not a link, `page_did_leave_tooltip_area()` and
`page_did_unhover_link()` virtual functions would get called.

Now, the page remembers if it is in a tooltip area or hovering a link
and only informs of leaving or unhovering only if it was.
2024-12-10 05:29:52 -08:00
ronak69
318fc62b53 LibWeb: Remember page's cursor and request change only when it changes
Before, on *every* mouse-move event, `page_did_request_cursor_change()`
virtual function would get called, requesting to change cursor to the
event's mouse position's cursor.

Now, the page keeps track of the last cursor change that was requested
("page's current cursor") and only requests cursor change again if and
only if the current cursor is not already the one that is required.
2024-12-10 05:29:52 -08:00
Shannon Booth
ac6fe2e211 LibWeb: Implement multiple import map support 2024-12-10 12:01:45 +00:00
Shannon Booth
0a216f9c14 LibWeb/HTML: Use DOM's post connection steps for <script> elements
This aligns our behaviour with WebKit and Chrome.

See: https://github.com/whatwg/html/commit/ddd2d0dd
2024-12-10 10:38:56 +00:00
Shannon Booth
02efb64e64 LibWeb/DOM: Implement the DOM post connection steps
See: https://github.com/whatwg/dom/commit/0616094
2024-12-10 10:38:56 +00:00
dependabot[bot]
4559af6ef5 CI: Bump JamesIves/github-pages-deploy-action from 4.6.9 to 4.7.2
Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.6.9 to 4.7.2.
- [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases)
- [Commits](https://github.com/jamesives/github-pages-deploy-action/compare/v4.6.9...v4.7.2)

---
updated-dependencies:
- dependency-name: JamesIves/github-pages-deploy-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-10 09:53:23 +01:00
Andrew Kaster
85b87508bf ClangPlugins: Remove confusing hasType check for lambda capture types
This check asserts that templated types will never escape. Which doesn't
hold up at all in practice.
2024-12-10 07:13:00 +01:00
Andrew Kaster
2f38c83caf LibGC: Mark GC::Function and create_function as ESCAPING
Whenever we create a GC function, it should always be so that we can
pass it to a platform event loop spin, HTML event loop spin, or some
queued task on the HTML event loop. For every use case, any local
variables will be out of scope by the time the function executes.
2024-12-10 07:13:00 +01:00
Andrew Kaster
66519af43f LibWeb: Remove some uses of [&] lambda captures for queued tasks
Using a default reference capture for these kinds of tasks is dangerous
and prone to error. Some of the variables should for sure be captured
by value so that we can keep a GC object alive rather than trying to
refer to stack objects.
2024-12-10 07:13:00 +01:00
Andrew Kaster
6ed2bf2bb1 LibWeb: Mark local variables captured in GC functions as ignored
These variables are all captured in queued events or other event loop
tasks, but are all guarded by event loop spins later in the function.

The IGNORE_USE_IN_ESCAPING_LAMBDA will soon be required for all locals
that are captured by ref in GC::Function as well as AK::Function.
2024-12-10 07:13:00 +01:00
Andrew Kaster
31d21570bf LibWeb: Don't store local functions in GC Function
If a function isn't going to be escaped from the current context,
there's no need to wrap the lambda in a GC allocation.
2024-12-10 07:13:00 +01:00
Jelle Raaijmakers
1514197e36 LibWeb: Remove dom_ from dom_exception_to_throw_completion
We're not converting `WebIDL::DOMException`, but `WebIDL::Exception`
instead.
2024-12-09 20:02:51 -07:00
Jelle Raaijmakers
17d5dfe597 LibWeb: Implement Web::Fetch::Body::fully_read() closer to spec
By actually using streams, they get marked as disturbed and the
`.bodyUsed` API starts to work. Fixes at least 94 subtests in the WPT
`fetch/api/request` test suite.

Co-authored-by: Timothy Flynn <trflynn89@pm.me>
2024-12-09 20:02:51 -07:00
Timothy Flynn
9396a643b8 LibWeb: Ensure FilteredResponse setters forward to the base class
The spec for filtered responses states:

    Unless stated otherwise a filtered response’s associated concepts
    (such as its body) refer to the associated concepts of its internal
    response.

This includes setting its associated concepts. In particular, when the
filtered response's body is set upon fetching a request with integrity
metadata, we must set the internal response's body instead.

Further restrictions that apply to filtered response subclasses (such as
opaque filtered responses having a status code of 0) are already
implemented.
2024-12-09 20:02:51 -07:00
Timothy Flynn
4b4b12165e LibWeb: Release acquired readers after piping through a stream
This very partially implements the spec's "finalize" steps for piping
streams.
2024-12-09 20:02:51 -07:00
Timothy Flynn
383d303b79 LibWeb: Enable callbacks in execution contexts when teeing streams
This will be needed once fetched response bodies are read using streams.
2024-12-09 20:02:51 -07:00
Timothy Flynn
5cd6d403ca LibWeb: Remove outdated comment about synchronous body initialization
We now do this step asynchronously.
2024-12-09 20:02:51 -07:00
Timothy Flynn
953fe75271 LibWeb: Remove exception handling from safely extracting response bodies
The entire purpose of this AO is to avoid handling exceptions, which we
can do now that the underlying AOs do not throw exceptions on OOM.
2024-12-09 20:02:51 -07:00
Timothy Flynn
49ff5eb4d8 LibWeb: Do not move heap functions into other heap functions in Fetch
In particular, the processBody callback here *can't* move the
processBodyError callback. It is needed a few lines after. Passing by
value is safe and intended here.
2024-12-09 20:02:51 -07:00
Andrew Kaster
f0bfb7f697 LibWeb: Don't capture local variables in HTMLImageElement::decode 2024-12-10 00:50:45 +01:00
Pavel Shliak
10311fba87 LibWeb: Align mfrac Padding with Updated MathML Core Spec
This aligns with the transition from the MathML Core Working Draft
(27 November 2023) to the Editor's Draft (26 November 2024).
2024-12-09 20:06:48 +00:00
Pavel Shliak
617ad9c3a5 LibWeb: Move expensive-to-copy arguments 2024-12-09 13:55:03 +01:00
Pavel Shliak
399af2416a LibWeb: Do not pass cheap-to-copy enums by reference 2024-12-09 13:55:03 +01:00
Pavel Shliak
6f81b80114 Everywhere: Include HashMap only where it's actually used 2024-12-09 12:31:16 +01:00
Pavel Shliak
97d99aa8d6 AK: Verify that HashMap is not empty in take_first
This makes the behavior uniform with:
- HashTable
- SinglyLinkedList
- Vector
2024-12-09 12:31:16 +01:00
Pavel Shliak
e08f6a69b2 LibWasm: Respect instance.types() bounds 2024-12-09 12:30:41 +01:00
Lucien Fiorini
3c2bbd45cf Tests: Mark test as passing in XMLSerializer-serializeToString.txt 2024-12-09 09:13:24 +00:00
Lucien Fiorini
ae8033b80f LibWeb: Rename abbreviated variable name 2024-12-09 09:13:24 +00:00
Lucien Fiorini
7feb8eb5bf Tests: Import WPT test for firstElementChild namespace in xhtml 2024-12-09 09:13:24 +00:00
Lucien Fiorini
0c24c9150a LibWeb: Parse the qualified name of XML dom elements correctly 2024-12-09 09:13:24 +00:00
sideshowbarker
0a2aa87107 LibWeb: Assign ARIA role “switch” to <input type=checkbox switch> 2024-12-09 09:47:36 +01:00
R-Goc
18132a0be1 LibJS: Remove compile flag for Windows 2024-12-08 17:37:26 -07:00
R-Goc
f380b4b95b AK: Port BumpAllocator.h to Windows
Done by forward declaring the required functions and defining the needed
constants. The defines shouldn't collide as they are from memoryapi.h.
This is done to avoid including windows.h.
2024-12-08 17:36:37 -07:00
R-Goc
c66eb5db11 LibCore: Add includes for S_ISDIR on Windows 2024-12-08 17:29:22 -07:00
stasoid
777dcdf6d0 LibCore: Port SharedCircularQueue to Windows 2024-12-08 17:25:40 -07:00
stasoid
85da489f39 LibThreading: Build on Windows 2024-12-08 17:19:42 -07:00
R-Goc
e2b6ab4a69 LibCrypto: DER.cpp use uz literals 2024-12-08 17:18:12 -07:00