Commit graph

1395 commits

Author SHA1 Message Date
Timothy Flynn
d835a00bee LibWeb: Use Fetch to retrieve HTMLObjectElement data URLs
This eliminates the use of ResourceLoader in HTMLObjectElement. The spec
steps around fetching have been slightly updated since we've last looked
at this, so those are updated here.

Regarding the text test change: we cannot rely on the data: URL being
fetched synchronously. It will occur on a deferred task now. This does
match the behavior of other browsers, as they also will not have run the
fallback representation steps as of DOMContentLoaded.
2024-12-10 10:37:01 -08:00
Jelle Raaijmakers
495006ddb5 LibWeb: Implement document.execCommand('insertLinebreak') 2024-12-10 19:34:38 +01:00
Tim Ledbetter
ae53059816 Tests: Don't display imported WPT test output if browser is headless
Previously, imported WPT tests didn't display any output if the
internals object was exposed. This change adds the condition that the
browser must also be running headlessly for test output to not be
displayed.
2024-12-10 10:31:47 -08:00
Tim Ledbetter
a44b18236c LibWeb: Add an Internals.headless attribute
This returns true if the browser is running in headless mode.
2024-12-10 10:31:47 -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
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
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
Lucien Fiorini
3c2bbd45cf Tests: Mark test as passing in XMLSerializer-serializeToString.txt 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
sideshowbarker
0a2aa87107 LibWeb: Assign ARIA role “switch” to <input type=checkbox switch> 2024-12-09 09:47:36 +01:00
Konstantin Konstantin
b03138cbff LibWeb: Support creation of shared memory in WebAssembly API
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Add support for shared memory creation in WebAssembly memory API.
This API is needed for WPT tests that use shared array buffers.

Import related WPT tests.
2024-12-08 22:10:45 +01:00
Felipe Muñoz Mazur
e27c59047a LibWeb: Handle abort signal in CloseWatcher
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
2024-12-07 12:06:53 +00:00
sideshowbarker
c1b29e7cc4 Tests: Import the WPT accname/basic.html test
This change imports the https://wpt.live/accname/basic.html — which we
had overlooked earlier when importing all the other WPT accname tests.
(Note that this one of the six upstream WPT tests that directly call
test_driver.get_computed_label(element) — and so that we’d otherwise
need to patch our copy of, if we weren’t patching it in testdriver.js).
2024-12-07 08:25:26 +00:00
sideshowbarker
e10db3aaf0 Tests: Move window.internals.getComputedLabel into testdriver.js file
This change takes the change we made in 120bc52f23 to patch the imported
WPT aria-utils.js file to use our window.internals.getComputedLabel(el)
function, and moves that patching into the imported WPT testdriver.js
file — in the same way we did in c5966bbdcb.

That centralizes the patching, and avoids the need to patch multiple
other WPT tests we’re likely to import eventually. There are actually
six different WPT test files upstream which we haven’t imported yet that
call window.test_driver_internal.get_computed_label(el) directly — and
that, without this change, we’d otherwise end up needing to patch.
2024-12-07 08:25:26 +00:00
sideshowbarker
68894306e2 LibWeb: Compute default ARIA roles context-sensitively where required
This change implements spec-conformant computation of default ARIA roles
for elements whose expected default role depends on the element’s
context — specifically, either on the element’s ancestry, or on whether
the element has an accessible name, or both. This affects the “aside”,
“footer”, “header”, and “section” elements.

Otherwise, without this change, “aside”, “footer”, “header”, and
“section” elements may unexpectedly end up with the wrong default roles.
2024-12-06 18:31:45 +00:00
sideshowbarker
c5966bbdcb LibWeb: Add window.internals.getComputedRole(element)
This change adds a window.internals.getComputedLabel(element) function,
for use in testing ARIA-related behavior. It also patches the imported
WPT testdriver.js script’s test_driver.get_computed_role(element)
function to call our window.internals.getComputedRole(element) function.
2024-12-06 18:31:45 +00:00
Tim Ledbetter
d946d94e2d LibWeb: Improve relList feature detection support
`DOMTokenList.supports()` is now correct for all possible `rel`
attribute values for `link`, `a`, `area` and `form` elements.
2024-12-06 18:09:53 +00:00
Andrew Kaster
af536e1192 LibWeb: Add stubbed-out WebGL2RenderingContext 2024-12-06 15:35:36 +01:00
Andrew Kaster
7abc79ece7 LibWeb/WebGL: Add stub class for WebGLVertexArrayObject
This is a WebGL 2.0 class
2024-12-06 15:35:36 +01:00
Andrew Kaster
39018d233f LibWeb/WebGL: Add stub class for WebGLTransformFeedback
This is a WebGL 2.0 class
2024-12-06 15:35:36 +01:00
Andrew Kaster
bb3226ee57 LibWeb/WebGL: Add stub class for WebGLSync
This is a WebGL 2.0 class
2024-12-06 15:35:36 +01:00
Andrew Kaster
2b5e54e995 LibWeb/WebGL: Add stub class for WebGLSampler
This is a WebGL 2.0 class
2024-12-06 15:35:36 +01:00
Andrew Kaster
69e4adbd98 LibWeb/WebGL: Add stub class for WebGLQuery
This is a WebGL 2.0 class
2024-12-06 15:35:36 +01:00
Totto16
9730e47d51 LibWeb: Add CanvasImageSource to ImageBitmapSource typedef 2024-12-06 13:10:27 +00:00
Luke Warlow
eb1c60f37b LibWeb: Implement popover methods
Implements basics of showPopover, hidePopover and togglePopover.
2024-12-06 12:39:14 +00:00
rmg-x
fa28337817 Tests/LibWeb: Add test for propagation of custom HTTP reason phrase
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
This commit adds an in-tree test for code added in a previous commit:
e89e084798

We want to make sure that the custom reason phrase is making it from
RequestServer to the "statusText" property in the XHR infrastructure.
2024-12-06 06:09:44 +00:00
Gingeh
c937aff95a LibWeb: Add test for computed mimetypes in loaded documents
This couldn't be added in #2207
2024-12-06 04:48:33 +00:00
Gingeh
e4512d8089 LibWeb: Add test for non-ascii content-type headers
This couldn't be added in #1893
2024-12-06 04:48:33 +00:00
rmg-x
cddbe7d10f LibWeb+Tests: Add internal property for echo server port 2024-12-05 17:02:57 -07:00
rmg-x
4dd21d0b80 Tests/LibWeb: Refactor HTTP echo server script
This commit makes the following changes:
- Adds a model "Echo" for the request body
- Changes the main endpoint from /create to /echo (more REST-y)
- Sends "400: Bad Request" for invalid params or a reserved path
- Sends "409: Conflict" when trying to use an already registered path
- Prints the server port to stdout
- Removes unnecessary subcommands/options (start, stop, --background)
2024-12-05 17:02:57 -07:00
Konstantin Konstantin
7d49704481 LibWeb: Serialization for resizable/shared array buffers
Add serialization for the following array buffer types:
* ResizableArrayBuffer
* SharedArrayBuffer
* GrowableSharedArrayBuffer
2024-12-05 17:02:41 -07:00
Andreas Kling
8d8aa964da LibWeb: Make window.clientInformation [Replaceable] per spec IDL 2024-12-05 21:35:59 +01:00
Kenneth Myhra
861f6e3965 LibWeb: Commit pull-into descriptors after filling from queue
These changes make sure that we postpone calls to
ReadableByteStreamControllerCommitPullIntoDescriptor until after all
pull-into descriptors have been filled up by
ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue.

Also pulls in the WPT test which was created in relation to this spec
change. The test verifies that a patched then() will see a null
byobRequest.
2024-12-05 13:03:12 -05:00
Aliaksandr Kalenik
fd25fea3ab LibWeb: Add missing empty size check before allocating PaintingSurface
Fixes crashing when Gfx::PaintingSurface::create_with_size() is called
with a size of 0.
2024-12-05 17:21:05 +01:00
Lucien Fiorini
0567960ce4 Tests: Import WPT tests for shadowBlur 2024-12-05 17:07:13 +01:00
Andreas Kling
3f461b96df LibWeb: Implement window.stop()
Fixes a handful of timeouts on WPT.
2024-12-05 12:13:09 +01:00
Luke Warlow
fdee82d203 LibWeb: Implement ::file-selector-button pseudo element
The button for a file input now matches `::file-selector-button`.
2024-12-05 10:49:57 +00:00
Tim Ledbetter
f1bbba2ba5 Tests: Enable imported WPT tests that were previously too slow for CI
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
2024-12-04 21:25:33 +00:00
Yuval Carmon
be979a1e65 LibWeb/CSS: Test css shadow host selector matching
Add a test that verifies selectors inside a shadow
root can only match their host element through :host pseudo-class.
Tests both simple selectors (#id, .class)
and complex selectors (:not, :where) to ensure they are blocked from
matching the host element directly.

Fixes issue #2319
2024-12-04 16:19:32 +00:00
Lucas CHOLLET
6804ce348e LibWeb/CSS: Interpret NaN as 0 when resolving alpha and rgb values
Fixes the crash in css/css-color/parsing/color-valid-hwb.html.

The crash was probably introduced in 248e4bb5, as it was the first
commit to VERIFY that the value given to `Color::with_opacity` were in
the correct range. As the values in color-valid-hwb.html were resolved
as NaN, the check never passed.
2024-12-04 16:11:41 +00:00
Aliaksandr Kalenik
72f093ba9f LibWeb: Null-check surface before allocating painter for context2d
Fixes https://github.com/LadybirdBrowser/ladybird/issues/2755
2024-12-04 16:58:55 +01:00
Sam Atkins
624b4689ac Tests: Remove invalid WPT flexbox test
`css/css-flexbox/order-001.htm` is a ref test that does not include any
page to match against.

https://github.com/web-platform-tests/wpt/issues/49521
2024-12-04 13:33:42 +00:00
Lucas CHOLLET
ad3dd547b7 LibWeb/CSS: Shorten the length of srgb serialization
The WPT tests require the shortest possible serialization that support
an 8 bits roundtrip.

As an example, `128` is serialized to `0.5` while `127` needs more
precision and thus will be serialized to `0.498`.

This commit fixes 33 WPT subtests in css/css-color.
2024-12-04 11:30:44 +00:00
Christoffer Sandberg
879af72850 LibWeb: Improve painting of nested inline elements
PaintableWithLines created from inline nodes need to examine their
children to fully compute their size and offset as nested children
might have textnodes that are placed before their parent.

Fixes #1286
2024-12-04 11:23:54 +00:00
Jelle Raaijmakers
4f76cec096 LibWeb: Implement document.execCommand("insertParagraph") 2024-12-04 06:51:59 +01:00
Konstantin Konstantin
9dad8f55a4 LibWeb: Implement transfer for Resizable/ArrayBuffer
Implement transfer logic for ArrayBuffer and ResizableArrayBuffer.

Change TransferDataHolder data type to Vector<u32> to reuse existing
serialization infrastructure.

Fix 5 WPT tests in `window-postmessage.window.html` that relates to
transport.
Fix `LibWeb/Text/input/Worker/Worker-postMessage-transfer.html`.
The latter is currently ignored due to flakiness, no rebaseline is
needed.

During serialization with transfer, initialize memory with known index
and initialize Serializer at position that dependent on the memory.
This is mandatory to make ArrayBuffer transport to work. It also happens
to fix 4 WPT tests, that are related to curcular references during
serialization.
2024-12-03 21:32:01 +00:00
Tim Ledbetter
163b8a69e3 LibWeb: Assert that nodes share shadow-including root in BP calculation
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Previously, it was assumed that nodes must share the same root, prior
to the calculation of their relative boundary point positions. This is
no longer the case, since `Selection.setBaseAndExtent()` now accepts
anchor and focus nodes that may be in different shadow trees.
2024-12-03 15:31:41 +01:00