Add support for temporary storage via a new config option
`temporary_storage`
and a corresponding command-line argument `--temporary-storage`.
When enabled, client storage uses a storage directory
(e.g. `clientstorage/temporary/<uuid>`) instead of the shared default
location.
This can be used to provide isolation between concurrent servo
instances.
This is especially useful for WPT runs, where multiple Servo instances
may
execute in parallel and would otherwise share the same storage, leading
to
cross-test interference.
Based on that, this PR also updates the WPT runner to enable temporary
storage
by default.
Testing: Manual testing and a full try run.
Signed-off-by: Jan Varga <jvarga@igalia.com>
This change creates a new "type bundle" trait, which holds all of the
concrete implementations of the layout DOM types. The benefit here is
that each implementation of a layout DOM type needs a single associated
type. In addition, and most importantly, `Layout` itself only needs to
parameterized over a single type (the concrete type bundle). This will
make parameterizing layout a lot friendlier.
The downside is that extracting the concrete type from the type bundle
is a bit ugly in Rust, so the change also exposes some type aliases to
make this nicer. In the future, default associated types can make
things a bit simpler as well.
Testing: This should not change behavior so no new tests are necessary.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
When reporting an exception attempt to extract `ErrorInfo` from the
stack of the exception.
Testing: Covered by existing tests, expectations updated.
Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
In #44436, I neglected to remove some hard line break-related code from
the shaping code. This code is effectively dead code now that
hard line breaks never make it to this code path, so it can safely be
removed.
Testing: This should not change behavior, so existing tests should
suffice.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Refactored `HttpsState` by moving it from `Document` to `GlobalScope`
Testing: `./mach test-wpt
tests/wpt/tests/mixed-content/csp.https.window.js` & `./mach test-wpt
tests/wpt/tests/fetch/api/request/destination/fetch-destination.https.html`
passed locally. `./mach try` failed due to billing issue on my account.
Fixes: #44342
Signed-off-by: Sabb <sarafaabbas@gmail.com>
`Castable::is<T>()` calls `get_dom_class()` in a way that incurs a
roundtrip to the JS engine and
multiple pointer indirections:
self.reflector().get_jsobject().get() -> JSObject
Object.shape -> BaseShape.clasp -> JSClass
DOMJSClass.dom_class -> DOMClass
interface_chain[depth] == ID -> bool
Since the ID doesn't change after creation of reflectors, we can instead
store the ID on the reflector
and avoid most of that cost. The trick is to use a Depth First Search to
generate IDs that allow a
range check for `Castable::is<T>`. An example of IDs in the DFS looks
like:
EventTarget = 0
Node = 1
CharacterData = 2
Text = 3
CDATASection = 4
Comment = 5
ProcessingInstruction = 6
Document = 7
HTMLDocument = 8
XMLDocument = 9
Testing: Green try run at
https://github.com/webbeef/servo/actions/runs/24640508040 and manual
testing with general browsing.
Signed-off-by: webbeef <me@webbeef.org>
Debug mozjs builds don't like when we try to trace members of one global
object (realm) that originate from another global object (realm). This
triggers when we use `Dom<DebuggerGlobalScope>` in our global objects,
since all `Dom<T>` pointers are expected to in the same realm as the
containing object. To address this, we store a JS value of the debugger
global's reflector wrapped in the current global's relam, and use value
to reconstitute a `DebuggerGlobalScope` pointer as needed.
Testing: We don't run debug-mozjs in CI, but this change makes a bunch
of tests stop asserting.
Fixes: #44385
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Sets the accessibility role of nodes based on their DOM node type
(ignoring ARIA roles and computed styles for now), for a small subset of
roles.
This change also re-works some details of accessibility tree building:
- Set the `root` property for the accesskit tree to the node ID for the
root DOM node, rather than creating a placeholder root node which
contains the root DOM node.
- Since we now map the `<body>` node to the `RootWebArea` role, this
required a small change to the accessibility test logic to do a tree
walk to find the `RootWebArea` node, which used to be the first child
since we artificially set the placeholder root node to be the
`RootWebArea` node.
- Have `update_node_and_children()` return a bool indicating whether any
node was updated.
- Split the code updating the node itself into its own function,
`update_node()`, which takes a DOM node and returns a tuple containing
the accessibility node ID and a bool indicating whether the node
required updating
- Add an `assert_node_by_id()` method to retrieve an accessibility node
based on its ID.
Testing: See new tests added in this PR.
---------
Signed-off-by: Alice Boxhall <alice@igalia.com>
Co-authored-by: delan azabani <dazabani@igalia.com>
Also port `TextDecoderStream`, `TextEncoderStream`, `CompressionStream`
and `DecompressionStream` to `reflect_dom_object_with_proto_and_cx`.
Testing: It compiles
Part of #40600
Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
Added basic fields required by firefox remote debugging protocol for
stylesheets- `StyleSheetData`
Enabled stylesheets in devtools watcher, made stylesheet request return
an empty array for now.
Testing: No change in behaviour and tests
Fixes: part of #44315
Signed-off-by: Rover track <rishan.pgowda@gmail.com>
Propagate `&mut JSContext` in `DebuggerGlobalScope::fire_add_debugee`
Testing: Successful build is enough
Fixes: Part of #42638
Opened to reduces the complexity of #44254
Signed-off-by: Emmanuel Paul Elom <elomemmanuel007@gmail.com>
We are probably not anywhere close to reproducible builds, but we should
try to follow best practices where trivially possible.
See also: https://reproducible-builds.org/docs/source-date-epoch/
Firefox devtools expects the build_id to be provided in a datetime
specific format.
This PR also switches the time to UTC instead of `Local`, since there
seems to be no clear reason to use Local, and SOURCE_DATE_EPOCH is UTC.
Testing: No functional changes, the devtools build_id is not covered by
any tests.
Fixes: #44458
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Propagate `&mut JSContext` in
`DebuggerGlobalScope::fire_get_possible_breakpoints` and related call
sites.
Testing: Successful build is enough
Fixes: Part of #42638
Opened to reduces the complexity of #44254
Signed-off-by: Emmanuel Paul Elom <elomemmanuel007@gmail.com>
To comply with the Gamepad spec, this commit changes the type of Gamepad
axes from Float64Array to CachedFrozenArray as per [Gamepad
Interface](https://w3c.github.io/gamepad/#gamepad-interface).
Fixes: #44336
Testing: automated tests are not possible because the axes values can
only be accessed with a real gamepad attached.
Signed-off-by: log101 <ffrknerdm@gmail.com>
Propagate `&mut JSContext` in `XMLHttpRequest::change_ready_state`
Testing: Successful build is enough
Fixes: Part of #42638
Opened to reduces the complexity of #44254
Signed-off-by: Emmanuel Paul Elom <elomemmanuel007@gmail.com>
When reloading, the pipeline is closed before we get the chance to set
accessibility inactive, which we do for pipelines which stick around in
the bfcache. We don't need to panic if we're trying to de-activate
accessibility and the pipeline is already closed.
Trying to activate accessibility on a closed pipeline is an error we
should investigate, but probably also not a panic-worthy condition.
Testing: Not sure how to test this beyond manual testing. Manual
testing: run servoshell with `--pref accessibility_enabled` and reload
any page.
Signed-off-by: Alice Boxhall <alice@igalia.com>
Replaced `GamepadButtonList` interface with a frozen array of gamepad
buttons to match the gamepad webidl specification.
Testing: No idlharness tests possible since the values can't be accessed
without a real gamepad.
Fixes: #44333
---------
Signed-off-by: Rover track <rishan.pgowda@gmail.com>
This will allow us not to need to repeatedly borrow `self` when
reading/updating individual `AccessibilityNode`s.
Testing: No behaviour change, covered by existing `accessibility` test.
---------
Signed-off-by: Alice Boxhall <alice@igalia.com>
Co-authored-by: delan azabani <dazabani@igalia.com>
This change makes it so that hard line breaks are not shaped during
inline formatting context creation. Instead they are a separate variant
of a new `TextRunItem` enum. This will make it easier to start
linebreaking later in the flow of inline layout.
Testing: This fixes three WPT tests, likely because we are now properly
using the BiDi level of BiDi control characters. One test starts
failing, but
it depends on tab rendering, which we do not currently support properly.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
While working on this, I realised that the `current_state`
computation was wrong. Instead, the spec actually clearly
defines what to do, but I hadn't found it yet. The code
now correctly implements state computation and voila, it
also fixes the previous underline issue that I didn't
understand why it would fail.
Part of #25005
Testing: WPT
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This means keeping nodes in a temporary map until the accesskit
TreeUpdate is accessed via `finalize()`. After `finalize()` is called,
any further attempts to use the object will panic.
Testing: Added a unit test.
---------
Signed-off-by: Alice Boxhall <alice@igalia.com>
Signed-off-by: delan azabani <dazabani@igalia.com>
Co-authored-by: delan azabani <dazabani@igalia.com>
Follow-up to #44443.
This helps investigating the cold-start timeline, and could be used
by tooling to A/B compare branches affecting the cold-start time.
Additionally also change the `handle_request::select` span, so that we
can see the blocked time (which was probably what was intended), since
the actual time spent on recv after select is insignificant.
Testing: Tracing output is not covered by automatic tests.
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Adds a profiling event at the startup of servoshell, right after
initializing the tracing subsystem. To support this, add macro
abstractions for tracing events.
The existing span (macros) have a start and an end, but for one-off
events, we don't need a span and hence it make sense to also add the
event macros.
The new event at startup is useful when measuring / optimizing general
startup time. Adding a timestamp as field, allows us to ground the
measurement and compare it against time measured outside of servo,
regardless of how the profiling backend (tracing-perfetto,
tracing-hitrace, future backends) save timestamps.
Testing: Build-testing: the HarmonyOS build enables the tracing feature.
On other platforms this is not the case in CI.
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Implement the `Sanitizer.get()` method.
Same as the previous patches on Sanitizer API, the steps related to
processing instructions are marked as TODO. Support for process
instructions was recently added to the specification, and we will
implement it later when tests are ready.
Testing: Covered by WPT tests in
`sanitizer-api/sanitizer-get.tentative.html`
Fixes: Part of #43948
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
In DOM APIs, `Node.childNodes` is a `NodeList` that has an
`.item(index)` method that allows random access, but DOM nodes only
store pointers to their first/last child and next/previous sibling. The
previous implementation involved keeping a "last accessed" pointer, and
a significant amount of logic to find the requested index by walking
next/previous sibling pointers from whichever of last accessed, first
child, or last child is nearest. This logic sometimes incorrectly
assumed the (nullable) last accessed pointer to be present, causing a
panic in `Option::unwrap`.
Rather than try to fix that logic, this replaces entirely with the
approach suggested in #25206 and used [by
Firefox](https://searchfox.org/firefox-main/source/dom/base/nsChildContentList.h):
keep a cached `Vec` of pointers to all child nodes, created lazily when
needed, and invalidated whenever any part of it changes.
Testing: the first commit adds a failing WPT crashtest, the second
commit fixes it
Fixes: https://github.com/servo/servo/issues/25206
Fixes: https://github.com/servo/servo/issues/36764
---------
Signed-off-by: Simon Sapin <simon@igalia.com>
This moves Servo closer to the focus parts of the HTML specification.
The behavior should be the same as before, but now the code in `script`
matches the structure of the specification.
The main goal is to set us up for:
- Firing focus events in the right order on nested documents
- A proper implementation of the unfocusing steps.
Testing: This should not change behavior so is covered by existing
tests.
Signed-off-by: Martin Robinson <mrobinson@fastmail.fm>
Co-authored-by: Martin Robinson <mrobinson@fastmail.fm>
This PR makes minor cleanup in the media crates:
- Switch dependencies to workspace dependencies if they are already
included in the main Cargo.toml
- Switch from crate serde_derive to serde with feature flag derive.
- Switch from the separate crate for OnceCell to the std provided
LazyLock.
- Update num_complex
Testing: The only functional changes are either slight version bumps,
the replacement to LazyLock which is conservative and the num_complex
update which also shouldn't have any behavior changes.
---------
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Implement sanitizer configuration validation algorithm, and complete the
"set a configuration" algorithm.
The steps related to processing instructions are marked as TODO. Support
for process instructions was recently added to the specification, and we
will implement it later when tests are ready.
Specification:
- https://wicg.github.io/sanitizer-api/#sanitizerconfig-valid
- https://wicg.github.io/sanitizer-api/#sanitizer-set-a-configuration
Testing: Covered by WPT tests in
`sanitizer-api/sanitizer-config.tentative.html`
Fixes: Part of #43948
---------
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
As titled.
Testing: Manually tested with multiple real websites with viewbox in
svg.
It looked terrible before, but now looking good!
New passing in WPT.
Partially addresses: #38985
---------
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
By touching the crypto provider, we can force it to gather entropy.
On my linux VM, that moved ~60ms off the critical path (using aws-lc-rs,
but probably any other crypto provider would show similar behavior).
On my Linux workstation it was around ~30ms.
On Linux caching the rustls platform verifier cache optimizes another
50ms. On other platforms this will be cheaper, since
only on some systems all certificates are read. It might make sense to
explore
caching the whole tlsconfig (for websockets), since it looks like we are
just cloning
the same components and then constructing a new tlsconfig, which would
lead to
the same effective component. But that needs more investigation.
Testing: Doesn't change any visible behavior, covered by existing tests.
---------
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Instead of readily adding a strut for text carets when processing a line
break, wait until a line is finished. This allows placing a strut on the
final line. In addition to fixing #41338 this will also make it possible
to handle line breaks as a separate kind of text run item so that we can
preserve shaping results between layouts.
In addition, some changes are made in script to ensure that these
placeholders
are never placed for non-textual input elements.
Testing: This change adds a Servo-specific WPT test. Caret rendering
isn't specified.
Fixes: #41338
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This is a minor adjustment from #44276 that makes the way characters are
iterated easier to read.
Testing: This should not change behavior so should be covered by
existing tests.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
With these changes, we now fail the minimum set of tests. That is to
say: we don't fail any test that no other browser fails. All test
failures therefore match at least 1 other browser.
The one exception is the updated test expectation. That's because all
browsers fail this test in the exact same way, hence updating the
expectation. We fail it, since I don't know how browsers reach to that
point. I think it's related to traversal of the contained children and
the order that they are traversed in. Unfortunately my attempts at
fixing that have not been fruitful, so leaving that one for now.
Part of #25005
Testing: WPT
---------
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Signed-off-by: Tim van der Lippe <TimvdLippe@users.noreply.github.com>
Co-authored-by: Martin Robinson <martin@abandonedwig.info>
ResourceFetchTimings are set throughout the methods in http_loader.rs.
These methods are already very complicated, so having multiple times
`context.timings.lock().set_attribute()` can be quite distracting to
understanding.
This introduces ResourceFetchTimingsContainer structure which has the
lock inside and allows setting multiple attributes to clean up the code
in http_loader.
Testing: This is a refactor and does not change functionality.
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Always pass `ownPropertiesLength` to devtools
Testing: All tests are passing
Fixes: part of #39858
Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Co-authored-by: eri <eri@igalia.com>
Add the Storage Standard WebIDL for NavigatorStorage and StorageManager,
wire navigator.storage on Window and Worker, and implement persisted(),
persist(), and estimate().
Testing: covered by WP test.
part of #39100fixes#39101
---------
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>