Expose the paintable tree dump through the internals object, analogous
to the existing dumpLayoutTree(). This is useful for testing and
debugging painting behavior.
Unfortunately this is a bit of a pain to test as it is surprisingly
difficult to create a non secure context in our test harness.
This is because both file scheme URLs and localhost are considered
secure contexts.
To test this, add a very specific internals setter to change the
top level origin of the environment for the current realm.
The WebDriver clear handler for textarea elements sets the raw
value to child_text_content() instead of an empty string. This
is a copy-paste from the adjacent reset handler, which correctly
uses child_text_content() per its own spec. The clear spec says
"set the raw value of element to an empty string".
This new testing API dumps the layout subtree rooted at a given DOM
node. It will be useful for testing partial layout tree rebuilds, where
we need to verify the layout tree structure for specific subtrees rather
than the entire document.
Instead of defining somewhat high level mouse actions, allow granular
control of mouse clicks and mouse down/up/move events. We will want to
simulate things like holding down a mouse button after double clicking
and then dragging the mouse to another position in the future, and this
enables that.
If our UI informed the page of a DPI change, we would store the new
device pixel ratio and leave it at that. It would take a layout/style
update (e.g. by clicking the page) to actually render the page using the
new DPI. This is very visible on macOS when moving the Ladybird window
from a 1x resolution monitor to a HiDPI 2x monitor.
We now instantly update the backing stores and mark media queries for
reevaluation. Moving the Ladybird window on macOS now immediately
updates the page when dragging it to a HiDPI monitor.
Upcoming commits will fix some regressions related to the highlighting
of nodes from within the inspector. Let's add the necessary
infrastructure so that we can write regression tests and avoid breaking
things again.
This new API allows tests to inspect the stacking context tree structure
which is useful for verifying that stacking context invalidation and
rebuilding work correctly.
Connected gamepads are stored on the Navigator, which means that when we
navigate to a new test, they stick around, including the virtual ones
we create for testing purposes. This caused issues such as the one
fixed in #7329 where failing to manually disconnect a virtual gamepad
meant that it would interfere with subsequent tests.
We don't want to rely on tests cleaning things up correctly, so this
commit introduces an automatic clean-up of these virtual gamepads.
InternalGamepad objects are now tracked in Internals, and all
disconnected in `Internals::perform_per_test_cleanup()`. It's named
generically as I'm expecting other systems (eg, localStorage or
cookies) to want similar cleanup between tests, but implementing those
is left as an exercise for a future person.
This method is called from signal_test_is_done(). This method is always
called in the case where the test completes. A test that crashes means
the WebContent isn't reused. A test that times out should also not have
its WebContent process reused, though it's not clear to me what we
currently do there.
Verified by commenting-out the `gamepad.disconnect()` line from the
Text/input/GamepadAPI/gamepad-is-available-in-new-navigables.html test
and then running:
```bash
for run in {1..20}; do
Meta/ladybird.py run test-web -s -j1 -f GamepadAPI;
done
```
Add support for WPT test variants, which allow a single test file to be
run multiple times with different URL query parameters. Tests declare
variants using `<meta name="variant" content="?param=value">` tags.
When test-web encounters a test with variants, it expands that test into
multiple runs, each with its own expectation file using the naming
convention `testname@variant.txt` (e.g., `test@run_type=uri.txt`).
Implementation details:
- WebContent observes variant meta tags and communicates them to the
test runner via a new `did_receive_test_variant_metadata` IPC call
- test-web dynamically expands tests with variants during execution,
waking idle views after each test completion to pick up new work
- Use index-based test tracking to avoid dangling references when the
test vector grows during variant expansion
- Introduce TestRunContext to group test run state, and store a static
pointer to it for signal handler access
This enables proper testing of WPT tests that use variants, such as the
html5lib parsing tests (which test uri, write, and write_single modes)
and the editing/bold tests (which split across multiple ranges).
If a script on the page cancels a mousemove event, we would return early
and neglect to update the cursor. This is seen regularly on "Diablo Web"
where they set the cursor to "none" on the main canvas, and also cancel
mousemove events.
Our HTTP disk cache is currently manually tested against various sites.
This patch adds some tests to cover various scenarios, including non-
cacheable responses, expired responses, and revalidation.
In order to ensure we hit the disk cache in RequestServer, we must
disable the in-memory cache in WebContent.
This lets you access closed shadow roots from JavaScript, even though
they're not normally accessible to JavaScript. This can be used to poke
into UA shadow roots in tests.
WPT reference tests can add metadata to tests to instruct the test
runner how to interpret the results. Because of this, it is not enough
to have an action that starts loading the (mis)match reference: we need
the test runner to receive the metadata so it can act accordingly.
This sets our test runner up for potentially supporting multiple
(mis)match references, and fuzzy rendering matches - the latter will be
implemented in the following commit.
It's useful to have tests that dump display list items, so we can more
easily see how changes to the display list recording process affect the
output. Even the small sample test added in this commit shows that we
currently record an unnecessary AddClipRect item for empty paint phases.
For now, the dump doesn't include every single property of an item, but
we can shape it to include more useful information as we iterate on it.
Some tests take longer than others, and so may want to set a custom
timeout so that they pass, without increasing the timeout for all other
tests. For example, this is done in WPT.
Add an `internals.setTestTimeout(milliseconds)` method that overrides
the test runner's default timeout for the currently-run test.
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.
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.
Resulting in a massive rename across almost everywhere! Alongside the
namespace change, we now have the following names:
* JS::NonnullGCPtr -> GC::Ref
* JS::GCPtr -> GC::Ptr
* JS::HeapFunction -> GC::Function
* JS::CellImpl -> GC::Cell
* JS::Handle -> GC::Root