servo/components/script
Nolan Lawson 25b182c372
fix(user-timing): fix clearing marks/measures by name (#32120)
This fixes several tests in
[wpt/user-timing](https://wpt.fyi/results/user-timing?label=master&product=chrome%5Bexperimental%5D&product=firefox%5Bexperimental%5D&product=safari%5Bexperimental%5D&product=servo&aligned)
by fixing some logic errors in how marks/measures are cleared (via
[`clearMarks`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/clearMarks)
and
[`clearMeasures`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/clearMeasures)).

There are two changes:

1. Fix the boolean logic in `clear_entries_by_name_and_type` so that,
when `clearMarks('foo')` or `clearMeasures('foo')` is called, the
presence of the entry name correctly filters based on existing entry
names.
2. Make the `entry_name` param a `DOMString` rather than an
`Option<DOMString>` since every API call has it as `Some` anyway, and
I'm not aware of any [Performance
APIs](https://developer.mozilla.org/en-US/docs/Web/API/Performance)
where you can clear all entries regardless of type. (This is not
strictly required for the fix, but I think it makes the code easier to
read.)

~~I also considered adding the expected WPT results using `mach
update-wpt`. But I'm not sure if you want these changes, since the
expectations are currently missing (i.e. `tests/wpt/meta/user-timing`
does not exist).~~ (_Update: added!_)

For the record, this PR fixes the following tests:

- `clearMarks.html.ini`
- `clearMeasures.html.ini`
- `clear_non_existent_mark.any.js.ini`
- `clear_non_existent_measure.any.js.ini`
- `clear_one_mark.any.js.ini`
- `clear_one_measure.any.js.ini`

~~In case you do want these meta files, here they are:
510e6146ba~~

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by
`[X]` when the step is complete, and replace `___` with appropriate
data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox
is checked, so that we can help you if you get stuck somewhere along the
way.-->

<!-- Pull requests that do not address these steps are welcome, but they
will require additional verification as part of the review process. -->
2024-04-22 09:16:05 +00:00
..
docs Update branch name to main (#30877) 2023-12-16 09:32:20 +00:00
dom fix(user-timing): fix clearing marks/measures by name (#32120) 2024-04-22 09:16:05 +00:00
layout_dom script: Make layout DOM wrappers not generic on layout data (#31994) 2024-04-04 11:34:35 +00:00
task_source clippy: Fix redundant field names warnings (#31793) 2024-03-20 23:05:29 +00:00
animation_timeline.rs script: Start replacing time with std::time and chrono (#30639) 2024-01-16 12:23:18 +00:00
animations.rs clippy: Fix mem_replace_with_default warnings (#31921) 2024-03-28 13:10:37 +00:00
body.rs clippy: Fix let_and_return warnings (#31964) 2024-04-01 15:43:24 +00:00
build.rs Update python detection in codegen (#31873) 2024-03-26 10:14:06 +00:00
canvas_state.rs Upgrade Stylo to 2024-03-01 (#32089) 2024-04-16 12:27:51 +00:00
Cargo.toml Update phf_codegen and phf_shared to 0.11 (#31537) 2024-03-08 07:25:12 +00:00
clipboard_provider.rs
devtools.rs clippy: fixed some warnings in components/script (#31888) 2024-03-26 21:25:42 +00:00
document_loader.rs clippy: fixed some warnings in components/script (#31888) 2024-03-26 21:25:42 +00:00
euclidext.rs Update euclid 2020-04-07 08:51:08 -07:00
fetch.rs Fixed some clippy warnings by replacing 'match' with 'if' (#32007) 2024-04-07 07:39:05 +00:00
image_listener.rs Strict import formatting (grouping and granularity) (#30325) 2023-09-11 19:16:54 +00:00
init.rs Fixed some clippy warning by adding default implementations (#31989) 2024-04-04 09:33:30 +00:00
layout_image.rs clippy: Fix some warnings in the script crate (#31719) 2024-03-18 10:05:18 +00:00
lib.rs crown: Do not warn about crown for rustdoc or clippy (#31805) 2024-03-21 15:33:06 +00:00
mem.rs Strict import formatting (grouping and granularity) (#30325) 2023-09-11 19:16:54 +00:00
microtask.rs Strict import formatting (grouping and granularity) (#30325) 2023-09-11 19:16:54 +00:00
network_listener.rs clippy: Fix redundant field names warnings (#31793) 2024-03-20 23:05:29 +00:00
realms.rs Strict import formatting (grouping and granularity) (#30325) 2023-09-11 19:16:54 +00:00
script_module.rs Fixed some clippy warnings in components (#32025) 2024-04-10 07:50:01 +00:00
script_runtime.rs Fixed some clippy warning by adding default implementations (#31989) 2024-04-04 09:33:30 +00:00
script_thread.rs script: Add an implementation of Default for Documents (#32048) 2024-04-19 08:45:38 +00:00
serviceworker_manager.rs clippy: fix warnings in components/script (#32023) 2024-04-09 09:34:52 +00:00
stylesheet_loader.rs fonts: Add support for WOFF2 and properly load web fonts from @imports (#31879) 2024-03-26 20:31:52 +00:00
stylesheet_set.rs
task.rs ensure clean shutdown of all threads running JS 2020-06-30 13:22:38 +08:00
task_manager.rs clippy: Allow too_many_arguments for all functions (#31962) 2024-04-01 14:53:33 +00:00
task_queue.rs clippy: Fix some clippy problems in components/script (#31778) 2024-03-20 18:41:07 +00:00
test.rs Strict import formatting (grouping and granularity) (#30325) 2023-09-11 19:16:54 +00:00
textinput.rs clippy: Fix collapsible_else_if warnings (#31853) 2024-03-26 09:15:04 +00:00
timers.rs clippy: Fix some warnings in components/script/timers.rs (#31878) 2024-03-27 10:15:15 +00:00
unpremultiplytable.rs
webdriver_handlers.rs Fix some clippy warnings in components/script/webdriver_handlers.rs (#31784) 2024-03-22 11:08:07 +00:00
window_named_properties.rs clippy: Fix several warnings (#31710) 2024-03-18 08:33:43 +00:00