Commit graph

64691 commits

Author SHA1 Message Date
Timothy Flynn
9dc1302768 WebContent+WebDriver: Consolidate driver execution completion callbacks
Some WebDriver hooks will need to inform the client that execution has
completed, but without any knowledge of what endpoint was running. Since
there can only ever be a single WebDriver endpoint executing at once, we
can replace the completion callbacks with a single callback.
2024-11-02 11:09:41 +01:00
Timothy Flynn
1be67faab7 LibWeb+WebContent: Handle user prompts that open during script execution
If a dialog is opened while a script is executing, we must give control
back to the WebDriver client. The script must also continue executing
though, so once it completes, we ignore its result.
2024-11-02 11:09:41 +01:00
Timothy Flynn
3cc7118bf4 LibWeb: Insert newlines around WebDriver scripts
This allows the script to end with a comment, which is tested by WPT.
Otherwise, an ending comment would create a function of the form:

    function() { return 1; // comment }

And the script would fail to parse.
2024-11-02 11:09:41 +01:00
Shannon Booth
371ddf9dc3 LibWeb: Don't assume a Window global object in HostEnqueuePromiseJob
This was causing crashes in Worker test cases making use of promises,
fixing a regression introduced in
da18551f10
2024-11-02 09:41:58 +00:00
Gingeh
c4e8eeb9a3 LibWeb: Don't crash on transformed clip-paths
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, 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
We can remove this check and FIXME because we already support them
2024-11-02 04:30:14 +00:00
Shannon Booth
da18551f10 LibWeb: Change HTML::Script to hold a realm instead of settings object
This is part of a refactor needed for introduction of the shadow realm
proposal in the web platform.
2024-11-01 18:55:23 -06:00
Shannon Booth
0382933a0a LibWeb: Add AO for 'module map of realm'
This allows you to get the module map for any realm, whether it is a
principal or synthetic realm. We don't yet have the concept of a
synethetic realm, but this puts the groundwork in place for it.
2024-11-01 18:55:23 -06:00
Shannon Booth
1871b744ff LibWeb: Add principal settings object helper function
To more clearly represent the host binding which a principal setting
realm has.
2024-11-01 18:55:23 -06:00
Shannon Booth
cc91473f4d LibWeb: Make TemporaryExecutionContext take a Realm& 2024-11-01 18:55:23 -06:00
Shannon Booth
f7a4d94b24 LibWeb: Add scaffold for 'principal realm of realm'
Allowing us to implement other AOs in terms of this one.
2024-11-01 18:55:23 -06:00
Hermes Junior
cdd78be2d3 LibWeb: Make javascript mime matching spec compliant
When mime essence matching, the spec only asks for a string comparison
ignoring ascii case. The whitespace trimming and parsing of the mime
produces unexpected and wrong results.
Fixes tests on WPT html/semantics/scripting-1/the-script-element :^)
2024-11-01 22:51:00 +00:00
sideshowbarker
437879f849 LibWeb: Correctly descend element nodes when computing accessible name
This change implements the “is a descendant of a native host language
text alternative element” condition in the “F: Name From Content” step
at https://w3c.github.io/accname/#step2F in the “Accessible Name and
Description Computation” spec — to ensure that all descendant nodes get
included as expected in computations for accessible names for elements.

Otherwise, without this change, Ladybird unexpectedly skips descendant
element nodes when computing accessible names — which can result in the
wrong accessible name being returned.
2024-11-01 18:13:41 -04:00
Kostya Farber
aeab342fd7 Documentation: Add VSCode debugger instructions
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, 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
Co-authored-by: sideshowbarker <mike@w3.org>
2024-11-01 12:25:28 -07:00
Shannon Booth
d7023f5f45 LibWeb: Change backup imcumbent stack to hold Realm instead of Settings
This is a bit of a chonkier commit as it results in both:

clean_up_after_running_callback and prepare_to_run_callback being
changed to accept a realm instead of an environment settings object,
which has a bunch of fallout, particuarly for IDL abstract operations.
2024-11-01 12:15:17 -07:00
Shannon Booth
8dffd8e7d6 LibWeb: Implement prepare_to_run_script on a Realm&
Making further progress porting away from depending on the
EnvironmentSettingObject.
2024-11-01 12:15:17 -07:00
Shannon Booth
d6fdaf6b26 LibWeb: Implement clean_up_after_running_script on a Realm
Taking further steps towards implementing the shadow realm spec :^)
2024-11-01 12:15:17 -07:00
Shannon Booth
0628b74272 LibWeb: Add scaffold for for "execution context of a realm"
Alongside some const qualfied getters that this requires.
2024-11-01 12:15:17 -07:00
Shannon Booth
aef18435fb LibWeb: Implement whether scripting is disabled based on a realm
Instead of a settings object. This matches updates to the HTML spec as
part of the shadow realm proposal, and begins the refactor of running
scripts on a realm instead of a settings environment object.

Some of the spec steps are slightly messy here (such as in
MainThreadVM.cpp) as this partially implements the ShadowRealm changes
but not other pieces which we have not implemented yet, such as
preparing to run a script also being based on a realm instead of an
environment. But this will be addressed in further commits.
2024-11-01 12:15:17 -07:00
Shannon Booth
583a8f41d3 LibWeb: Update spec comments for 'create a classic script'
To align with spec updates. No functional changes.
2024-11-01 12:15:17 -07:00
Shannon Booth
738e603c2f LibWeb: Implement current_principal_global_object to shadow realm spec
No functional change, as it is using the yet to be fully implemented
'current_principal_realm'.
2024-11-01 12:15:17 -07:00
Shannon Booth
84dc83e0e0 LibWeb: Rename current_global_object to current_principal_global_object
Again, following a rename as part of the introduction of shadow realms
inducing a bunch of mechanical changes.
2024-11-01 12:15:17 -07:00
Shannon Booth
0c2400641e LibWeb: Fill out implementation of current_principal_settings_object
In terms of the 'current principal realm' definition.

No functional impact, as we still need to implement current principal
realm once the surrounding infrastructure is in place. But it is one
less place which needs to be updated when that is all in place :^)
2024-11-01 12:15:17 -07:00
Shannon Booth
b2f3ed8b5a LibWeb: Rename current settings object to 'current principal'
Aligning the name with the the PR implementing the javascript
shadow realm proposal into the web platform. This commit
simply performs the rename before implementing the behaviour
change.

The actual change to the behaviour of the AO is not implemented in this
commit to support 'synthetic' shadow realms as the surrounding
infrastructure is not in place yet.

Not all specs have a MR open to align with this proposed change to the
HTML standard. But in this case we can just apply the same mechanical
change everywhere.
2024-11-01 12:15:17 -07:00
Andrew Kaster
72f5fac2ff LibWeb: Use HeapFunction in async WebAssembly module compilation
This fixes a compile error from merging
ba6dcd7521
without a rebase.
2024-11-01 12:53:13 -06:00
Shannon Booth
472b56b47c LibWeb: Propagate exception if serializing inner node fails
Fixing a crash for the given test.
2024-11-01 14:02:14 -04:00
Shannon Booth
fd32f17c56 headless-browser: Support running XHTML tests 2024-11-01 14:02:14 -04:00
Shannon Booth
4dd912e686 LibWeb: Rebaseline XHTML test case
At some point we must have broken the ability of running XHTML test
cases, so the whitespace expectation changes have not been rebaselined
for this test case.
2024-11-01 14:02:14 -04:00
Andrew Kaster
36feebb1e7 LibWeb: Add Wasm Web-API streaming compilation and instantiation
This requires fixing up the "parameter is a promise" handling in
the IDL generator.
2024-11-01 10:42:24 -07:00
Andrew Kaster
881a270e58 LibWeb: Verify buffer type in WebIDL get buffer source copy AO 2024-11-01 10:42:24 -07:00
Andrew Kaster
ba6dcd7521 LibWeb: Refactor WebAssembly API to use spec-defined promise AOs 2024-11-01 10:42:24 -07:00
Jelle Raaijmakers
3504370281 LibWeb: Add stubbed Media Source Extensions API
Just the boilerplate :^)
2024-11-01 13:23:45 -04:00
Jelle Raaijmakers
3e3851983d LibGfx: Remove unused include from Line 2024-11-01 13:23:45 -04:00
stelar7
559fd1c0c2 LibWeb: Add FIXME for missing SubtleCrypto algorithms 2024-11-01 13:13:30 -04:00
Shannon Booth
1dc1bebd2a LibWeb: Push a temporary execution context for setTimeout
This fixes a crash seen running stream tests.
2024-11-01 13:12:01 -04:00
Aliaksandr Kalenik
4a1e109678 LibWeb: Fix ability to modify selection outside of inputs using keyboard
Fixes regression introduced in a8077f79cc
2024-11-01 13:11:10 -04:00
Aliaksandr Kalenik
7dc11050f2 LibWeb: Add internals API to dispatch doubleclick mouse event 2024-11-01 13:11:10 -04:00
Hermes Junior
1be6c12501 Documentation: Explain how to fix CMake errors in CLion
When importing the project in some CLion versions,
the build profile can be created missing configurations,
breaking code insight.
2024-11-01 16:22:40 +00:00
Sam Atkins
d0d5600f47 LibWeb/CSS: Move rule-conversion code into its own file
This is an attempt to bring the size of Parser.cpp down. No code
changes, just moves and some explicit template instantiations now that
we're using them from a different file.
2024-11-01 16:16:40 +00:00
Shannon Booth
f20822e293 LibWeb: Handle language attributes without a '-'
Where we would previously index out of bounds.
2024-11-01 16:09:12 +01:00
Aliaksandr Kalenik
e915143593 LibWeb: Fix selectionchange event dispatch on text control elements
With a8077f79cc Selection object is no
longer aware of selection state inside text controls (<textarea> and
<input>), so this change makes them responsible for dispatching
`selectionchange` if their selection state was changed.
2024-11-01 15:06:09 +01:00
Timothy Flynn
3a6b698572 Documentation: Add note about making the macOS terminal a developer tool 2024-11-01 15:04:53 +01:00
Grubre
8703ca0c7d LibWeb: Use String::to_fullwidth() when applying text-transform
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, 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
Before, we just returned the input string. Now the property is applied
using the `String::to_fullwidth()` function.

fixes:
https://wpt.fyi/results/css/css-text/text-transform/text-transform-fullwidth-001.xht
2024-11-01 07:48:17 -04:00
Grubre
a8a81342bb LibUnicode: Implement to_fullwidth() in String
The implementation uses the transliterator class from icu.
2024-11-01 07:48:17 -04:00
Grubre
5a6a7b7e5e LibWeb: Pass locale to to_lowercase() from apply_text_transform
Previously we passed `{}` which resulted in incorrect text when using
some languages like `lt`.

Fixes:
http://wpt.fyi/results/css/css-text/text-transform/text-transform-upperlower-039.html
2024-11-01 07:48:17 -04:00
Grubre
1b25fb5d40 LibWeb: Pass locale to to_uppercase() from apply_text_transform
Previously we passed the default argument which is `{}`. This resulted
in incorrect uppercasing for some languages like `tr`.

Fixes:
http://wpt.live/css/css-text/text-transform/text-transform-tailoring-002.html
2024-11-01 07:48:17 -04:00
Jelle Raaijmakers
47597d0fb8 LibIDL: Allow trailing comma in enumerations
IDL enumerations are one of the rare list types in the IDL spec that
allow for a trailing comma:

https://www.w3.org/Bugs/Public/show_bug.cgi?id=17508
2024-11-01 12:27:41 +01:00
sideshowbarker
286511c4cf Meta: Make import-wpt-test.py use html.parser, not BeautifulSoup
This change switches the Meta/import-wpt-test.py script to using the
standard html.parser module rather than BeautifulSoup.

Otherwise, without this change, when a contributor first tries to run
the script, if they don’t have BeautifulSoup installed, it will fail.

Note that this patch also includes an unrelated small change that
switches to using os.path.normpath — rather than Path.absolute() — to
“normalize” the destination names of the downloaded test files.
2024-11-01 12:27:24 +01:00
Andreas Kling
56e1c0e7ee LibWeb: Check for active document in descendant_navigables()
This is not in the spec, but I did see a null pointer dereference here
while browsing the web, and it seems completely harmless for this
function to skip over navigables without an active document.
2024-11-01 12:25:52 +01:00
Shannon Booth
aa585c4182 LibWeb: Avoid potential infinite recursion in Document::update_layout 2024-11-01 12:25:17 +01:00
Shannon Booth
15c15116dd LibWeb: Ensure fully active document before appending to an iframe 2024-11-01 12:25:17 +01:00