Repository: servo/servo (language: python)

Issue:
Crash when attempting to proceed through Cloudflare Verification
**Describe the bug:**
When trying to access a site that uses Cloudflare Verification, the "Verifying you are a human" process causes a panic stemming from here https://github.com/servo/servo/blob/main/components/script/layout_dom/element.rs#L746, I believe when it's trying to attach the Cloudflare Turnstile. Unsure if this is because the Shadow DOM implementation is incomplete or something else

**To Reproduce:**
`./mach run https://rateyourmusic.com --pref dom.shadowdom.enabled`

**Platform:**
Windows 10

Crash when attempting to proceed through Cloudflare Verification
**Describe the bug:**
When trying to access a site that uses Cloudflare Verification, the "Verifying you are a human" process causes a panic stemming from here https://github.com/servo/servo/blob/main/components/script/layout_dom/element.rs#L746, I believe when it's trying to attach the Cloudflare Turnstile. Unsure if this is because the Shadow DOM implementation is incomplete or something else

**To Reproduce:**
`./mach run https://rateyourmusic.com --pref dom.shadowdom.enabled`

**Platform:**
Windows 10



Discussion / hints:
I did some more triaging without really understanding what's going on, here are my findings:

## With Shadow DOM enabled

<details>
<summary>Debug log output</summary>

```
[2024-10-24T12:08:35Z DEBUG style::sharing] Failing to insert into the cache: Shadow Host
[2024-10-24T12:08:35Z DEBUG style::traversal] element_needs_traversal(<iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78), TraversalFlags(0x0), None)
[2024-10-24T12:08:35Z DEBUG style::traversal] recalc_style_at: <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78) (restyle_kind=Some(MatchAndCascade), dirty_descendants=true, data=ElementData { styles: ElementStyles { primary: None, pseudos: EagerPseudoStyles(None) }, damage: ServoRestyleDamage(0x0), hint: RestyleHint(0x0), flags: ElementDataFlags(0x0) })
[2024-10-24T12:08:35Z DEBUG style::traversal] compute_style: <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78) (kind=MatchAndCascade)
[2024-10-24T12:08:35Z DEBUG style::sharing] Can't share style, because DOM depth changed from 5 to 7, element: <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78)
[2024-10-24T12:08:35Z DEBUG style::style_resolver] Match primary for <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78), visited: AllLinksUnvisited
[2024-10-24T12:08:35Z DEBUG selectors::matching] Matching complex selector [title]abbr for <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78)
[2024-10-24T12:08:35Z DEBUG selectors::matching] Matching complex selector [title]acronym for <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78)
[2024-10-24T12:08:35Z DEBUG selectors::matching] Matching complex selector :not([seamless])iframe for <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78)
[2024-10-24T12:08:35Z DEBUG selectors::matching] Matching complex selector [seamless] for <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78)
[2024-10-24T12:08:35Z DEBUG selectors::matching] Matching complex selector :fullscreeniframe for <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78)
[2024-10-24T12:08:35Z DEBUG selectors::matching] Matching complex selector :autofill for <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78)
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] 0x154ad4140: 11+
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] 0x154ad4140: 12+
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] Creating rule node: 0x154ad8bf0
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] 0x154ad4140: 13-
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] Dropping node: 0x154ad4140, root: None, parent: None
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] 0x154ad8bf0: 1+
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] Creating rule node: 0x154ad8c40
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] 0x154ad8bf0: 2-
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] Dropping node: 0x154ad8bf0, root: Some(0x154ad4140), parent: Some(0x154ad4140)
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] 0x154ad8c40: 1+
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] 0x154ad8c40: 2-
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] Dropping node: 0x154ad8c40, root: Some(0x154ad4140), parent: Some(0x154ad8bf0)
[2024-10-24T12:08:35Z DEBUG style::style_resolver] Match pseudo <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78) for After, visited: AllLinksUnvisited
[2024-10-24T12:08:35Z DEBUG style::style_resolver] Match pseudo <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78) for Before, visited: AllLinksUnvisited
[2024-10-24T12:08:35Z DEBUG style::style_resolver] Match pseudo <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78) for Selection, visited: AllLinksUnvisited
[2024-10-24T12:08:35Z DEBUG style::sharing] Inserting into cache: <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78) with parent <div> (0x1962bbfa0ba0)
[2024-10-24T12:08:35Z DEBUG style::sharing] Clearing cache because depth changed from 5 to 7, element: <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78)
[2024-10-24T12:08:35Z DEBUG style::traversal] <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78) style is display:none - clearing data from descendants.
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] 0x154ad4140: 12+
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] Upgrading weak node: 0x17c3cc050
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] 0x154ad4140: 13-
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] Dropping node: 0x154ad4140, root: None, parent: None
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] 0x17c3cc050: 2+
[2024-10-24T12:08:35Z WARN  servoshell::panic_hook] Panic hook called.
```

</details>

1. The Cloudfront Turnstile is at least partially loaded.
2. An `iframe` with `id="cf-chl-widget-..."` is encountered during the styling pass.
3. It is found to have `display:none`, so stylo deletes the style data for the descendants. (See near the end of the output.)
4. Shortly thereafter, Servo tries to read the style data of some element and panics because it's not there.

🧠 Presumably that element is a child of that iframe, not sure how to check that yet.

## Without Shadow DOM

1. The debug output doesn't even mention an `iframe` 🤷 (I also grepped for `cf-chl-widget`)
2. Things load without panicking.
> I did some more triaging without really understanding what's going on, here are my findings:
> ## With Shadow DOM enabled
> Debug log output
> 
>     1. The Cloudfront Turnstile is at least partially loaded.
> 
>     2. An `iframe` with `id="cf-chl-widget-..."` is encountered during the styling pass.
> 
>     3. It is found to have `display:none`, so stylo deletes the style data for the descendants. (See near the end of the output.)
> 
>     4. Shortly thereafter, Servo tries to read the style data of some element and panics because it's not there.
> 
> 
> 🧠 Presumably that element is a child of that iframe, not sure how to check that yet.

Very interesting! It would be worth checking if this behavior is reproducible in a standalone test file that mimics these steps.
I have not been able to make servo crash yet with the following:
```
<script>
function check() {
    let iframe = document.querySelector('iframe');
    iframe.style.display = "none";
    let elem = iframe.contentDocument.querySelector('div');
    let style = iframe.contentWindow.getComputedStyle(elem);
    setTimeout(() => {
        console.log(elem.getBoundingClientRect());
        console.log(style.display);
    }, 1000);
}
</script>
<iframe onload="check()" src="hello.html"></iframe>
```
<details>
<summary>Full backtrace</summary>

```
Unstyled layout node? (thread StyleThread#2, at components/script/layout_dom/element.rs:758)
   0: backtrace::backtrace::libunwind::trace
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.74/src/backtrace/libunwind.rs:116:5
      backtrace::backtrace::trace_unsynchronized
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.74/src/backtrace/mod.rs:66:5
   1: <servoshell::backtrace::Print as core::fmt::Debug>::fmt
             at /Users/jdm/src/servo/ports/servoshell/backtrace.rs:65:13
   2: core::fmt::rt::Argument::fmt
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/fmt/rt.rs:165:63
      core::fmt::write
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/fmt/mod.rs:1168:21
   3: std::io::Write::write_fmt
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/io/mod.rs:1835:15
   4: servoshell::backtrace::print
             at /Users/jdm/src/servo/ports/servoshell/backtrace.rs:18:5
   5: servoshell::panic_hook::panic_hook
             at /Users/jdm/src/servo/ports/servoshell/panic_hook.rs:40:17
   6: core::ops::function::Fn::call
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/ops/function.rs:79:5
   7: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/alloc/src/boxed.rs:2077:9
      std::panicking::rust_panic_with_hook
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:799:13
   8: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:664:13
   9: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/sys_common/backtrace.rs:171:18
  10: rust_begin_unwind
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:652:5
  11: core::panicking::panic_fmt
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/panicking.rs:72:14
  12: core::panicking::panic_display
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/panicking.rs:262:5
      core::option::expect_failed
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/option.rs:1995:5
  13: core::option::Option<T>::expect
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/option.rs:898:21
  14: <script::layout_dom::element::ServoThreadSafeLayoutElement as script_layout_interface::wrapper_traits::ThreadSafeLayoutElement>::style_data
             at /Users/jdm/src/servo/components/script/layout_dom/element.rs:758:9
  15: script_layout_interface::wrapper_traits::ThreadSafeLayoutElement::style
             at /Users/jdm/src/servo/components/shared/script_layout/wrapper_traits.rs:424:20
  16: script_layout_interface::wrapper_traits::ThreadSafeLayoutNode::style
             at /Users/jdm/src/servo/components/shared/script_layout/wrapper_traits.rs:251:13
  17: <LayoutNodeType as layout_2020::dom::NodeExt>::style
             at /Users/jdm/src/servo/components/layout_2020/dom.rs:194:9
  18: layout_2020::dom_traversal::traverse_element
             at /Users/jdm/src/servo/components/layout_2020/dom_traversal.rs:220:17
  19: layout_2020::dom_traversal::traverse_children_of
             at /Users/jdm/src/servo/components/layout_2020/dom_traversal.rs:204:17
  20: layout_2020::dom_traversal::NonReplacedContents::traverse
             at /Users/jdm/src/servo/components/layout_2020/dom_traversal.rs:364:47
  21: layout_2020::flow::construct::<impl layout_2020::flow::BlockContainer>::construct
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:179:9
  22: layout_2020::flow::construct::IntermediateBlockContainer::finish
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:742:18
  23: layout_2020::flow::construct::BlockLevelJob<Node>::finish
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:654:32
  24: layout_2020::flow::construct::BlockContainerBuilder<Node>::finish::{{closure}}
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:235:40
  25: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &F>::call_mut
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/ops/function.rs:272:13
  26: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/ops/function.rs:305:13
  27: core::option::Option<T>::map
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/option.rs:1075:29
      <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/iter/adapters/map.rs:108:26
  28: rayon::iter::plumbing::Folder::consume_iter
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:177:21
  29: <rayon::iter::map::MapFolder<C,F> as rayon::iter::plumbing::Folder<T>>::consume_iter
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/map.rs:248:21
  30: rayon::iter::plumbing::Producer::fold_with
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:109:9
  31: rayon::iter::plumbing::bridge_producer_consumer::helper
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:437:13
  32: rayon::iter::plumbing::bridge_producer_consumer
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:396:12
  33: <rayon::iter::plumbing::bridge::Callback<C> as rayon::iter::plumbing::ProducerCallback<I>>::callback
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:372:13
  34: <rayon::vec::Drain<T> as rayon::iter::IndexedParallelIterator>::with_producer
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/vec.rs:147:13
  35: <rayon::vec::IntoIter<T> as rayon::iter::IndexedParallelIterator>::with_producer
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/vec.rs:83:9
  36: rayon::iter::plumbing::bridge
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:356:12
  37: <rayon::vec::IntoIter<T> as rayon::iter::ParallelIterator>::drive_unindexed
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/vec.rs:58:9
  38: <rayon::iter::map::Map<I,F> as rayon::iter::ParallelIterator>::drive_unindexed
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/map.rs:49:9
  39: rayon::iter::collect::special_extend::{{closure}}
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/collect/mod.rs:39:46
  40: rayon::iter::collect::collect_with_consumer
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/collect/mod.rs:84:18
  41: rayon::iter::collect::special_extend
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/collect/mod.rs:39:5
  42: rayon::iter::extend::<impl rayon::iter::ParallelExtend<T> for alloc::vec::Vec<T>>::par_extend
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/extend.rs:584:17
  43: rayon::iter::from_par_iter::collect_extended
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/from_par_iter.rs:20:5
  44: rayon::iter::from_par_iter::<impl rayon::iter::FromParallelIterator<T> for alloc::vec::Vec<T>>::from_par_iter
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/from_par_iter.rs:33:9
  45: rayon::iter::ParallelIterator::collect
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/mod.rs:2069:9
  46: layout_2020::flow::construct::BlockContainerBuilder<Node>::finish
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:233:13
  47: layout_2020::flow::construct::<impl layout_2020::flow::BlockContainer>::construct
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:180:9
  48: layout_2020::flow::construct::IntermediateBlockContainer::finish
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:742:18
  49: layout_2020::flow::construct::BlockLevelJob<Node>::finish
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:654:32
  50: layout_2020::flow::construct::BlockContainerBuilder<Node>::finish::{{closure}}
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:235:40
  51: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &F>::call_mut
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/ops/function.rs:272:13
  52: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/ops/function.rs:305:13
  53: core::option::Option<T>::map
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/option.rs:1075:29
      <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/iter/adapters/map.rs:108:26
  54: rayon::iter::plumbing::Folder::consume_iter
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:177:21
  55: <rayon::iter::map::MapFolder<C,F> as rayon::iter::plumbing::Folder<T>>::consume_iter
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/map.rs:248:21
  56: rayon::iter::plumbing::Producer::fold_with
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:109:9
  57: rayon::iter::plumbing::bridge_producer_consumer::helper
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:437:13
  58: rayon::iter::plumbing::bridge_producer_consumer
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:396:12
  59: <rayon::iter::plumbing::bridge::Callback<C> as rayon::iter::plumbing::ProducerCallback<I>>::callback
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:372:13
  60: <rayon::vec::Drain<T> as rayon::iter::IndexedParallelIterator>::with_producer
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/vec.rs:147:13
  61: <rayon::vec::IntoIter<T> as rayon::iter::IndexedParallelIterator>::with_producer
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/vec.rs:83:9
  62: rayon::iter::plumbing::bridge
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:356:12
  63: <rayon::vec::IntoIter<T> as rayon::iter::ParallelIterator>::drive_unindexed
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/vec.rs:58:9
  64: <rayon::iter::map::Map<I,F> as rayon::iter::ParallelIterator>::drive_unindexed
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/map.rs:49:9
  65: rayon::iter::collect::special_extend::{{closure}}
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/collect/mod.rs:39:46
  66: rayon::iter::collect::collect_with_consumer
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/collect/mod.rs:84:18
  67: rayon::iter::collect::special_extend
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/collect/mod.rs:39:5
  68: rayon::iter::extend::<impl rayon::iter::ParallelExtend<T> for alloc::vec::Vec<T>>::par_extend
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/extend.rs:584:17
  69: rayon::iter::from_par_iter::collect_extended
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/from_par_iter.rs:20:5
  70: rayon::iter::from_par_iter::<impl rayon::iter::FromParallelIterator<T> for alloc::vec::Vec<T>>::from_par_iter
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/from_par_iter.rs:33:9
  71: rayon::iter::ParallelIterator::collect
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/mod.rs:2069:9
  72: layout_2020::flow::construct::BlockContainerBuilder<Node>::finish
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:233:13
  73: layout_2020::flow::construct::<impl layout_2020::flow::BlockContainer>::construct
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:180:9
  74: layout_2020::flow::construct::IntermediateBlockContainer::finish
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:742:18
  75: layout_2020::flow::construct::BlockLevelJob<Node>::finish
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:654:32
  76: layout_2020::flow::construct::BlockContainerBuilder<Node>::finish::{{closure}}
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:235:40
  77: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &F>::call_mut
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/ops/function.rs:272:13
  78: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/ops/function.rs:305:13
  79: core::option::Option<T>::map
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/option.rs:1075:29
      <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/iter/adapters/map.rs:108:26
  80: rayon::iter::plumbing::Folder::consume_iter
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:177:21
  81: <rayon::iter::map::MapFolder<C,F> as rayon::iter::plumbing::Folder<T>>::consume_iter
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/map.rs:248:21
  82: rayon::iter::plumbing::Producer::fold_with
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:109:9
  83: rayon::iter::plumbing::bridge_producer_consumer::helper
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:437:13
  84: rayon::iter::plumbing::bridge_producer_consumer::helper::{{closure}}
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:417:21
  85: rayon_core::join::join_context::call_a::{{closure}}
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/join/mod.rs:124:17
  86: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/panic/unwind_safe.rs:272:9
  87: std::panicking::try::do_call
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:559:40
  88: ___rust_try
  89: std::panicking::try
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:523:19
  90: std::panic::catch_unwind
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panic.rs:149:14
  91: rayon_core::unwind::halt_unwinding
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/unwind.rs:17:5
  92: rayon_core::join::join_context::{{closure}}
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/join/mod.rs:142:24
  93: rayon_core::registry::in_worker
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:951:13
  94: rayon_core::join::join_context
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/join/mod.rs:132:5
  95: rayon::iter::plumbing::bridge_producer_consumer::helper
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:415:47
  96: rayon::iter::plumbing::bridge_producer_consumer::helper::{{closure}}
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:426:21
  97: rayon_core::join::join_context::call_b::{{closure}}
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/join/mod.rs:129:25
  98: rayon_core::job::JobResult<T>::call::{{closure}}
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/job.rs:218:41
  99: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/panic/unwind_safe.rs:272:9
 100: std::panicking::try::do_call
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:559:40
 101: ___rust_try
 102: std::panicking::try
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:523:19
 103: std::panic::catch_unwind
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panic.rs:149:14
 104: rayon_core::unwind::halt_unwinding
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/unwind.rs:17:5
 105: rayon_core::job::JobResult<T>::call
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/job.rs:218:15
 106: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/job.rs:120:32
 107: rayon_core::job::JobRef::execute
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/job.rs:64:9
 108: rayon_core::registry::WorkerThread::execute
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:860:9
 109: rayon_core::registry::WorkerThread::wait_until_cold
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:794:21
 110: rayon_core::registry::WorkerThread::wait_until
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:769:13
 111: rayon_core::registry::WorkerThread::wait_until_out_of_work
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:818:9
 112: rayon_core::registry::main_loop
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:923:5
 113: rayon_core::registry::ThreadBuilder::run
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:53:18
 114: style::global_style_data::thread_spawn::{{closure}}
             at /Users/jdm/.cargo/git/checkouts/stylo-d5871ad1ba1940d3/789ab89/style/global_style_data.rs:73:34
 115: std::sys_common::backtrace::__rust_begin_short_backtrace
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/sys_common/backtrace.rs:155:18
 116: std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/thread/mod.rs:542:17
 117: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/panic/unwind_safe.rs:272:9
 118: std::panicking::try::do_call
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:559:40
 119: ___rust_try
 120: std::panicking::try
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:523:19
 121: std::panic::catch_unwind
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panic.rs:149:14
      std::thread::Builder::spawn_unchecked_::{{closure}}
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/thread/mod.rs:541:30
 122: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/ops/function.rs:250:5
 123: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/alloc/src/boxed.rs:2063:9
      <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/alloc/src/boxed.rs:2063:9
      std::sys::pal::unix::thread::Thread::new::thread_start
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/sys/pal/unix/thread.rs:108:17
 124: __pthread_joiner_wake
```

</details>
Here's a minimal reproduction:
```html
<html>
    <body>
        <div id="cf-turnstile"></div>
        <script defer>
            var challenge_element = document.getElementById("cf-turnstile");

            var div = document.createElement("div");
            var shadow_root = div.attachShadow();

            var ke = document.createElement("div");
            div.appendChild(ke)
            challenge_element.appendChild(div);
        </script>
    </body>
</html>
```
This happens because `ServoLayoutElement::traversal_children` fails to account for children outside the shadow DOM if the element is a shadow host:
https://github.com/servo/servo/blob/c73e4baca206c172802be145c1fb8d110c1be863/components/script/layout_dom/element.rs#L151-L157

Stylo doesn't know about the element, so it is never assigned a style.

Very fun debugging session!
I did some more triaging without really understanding what's going on, here are my findings:

## With Shadow DOM enabled

<details>
<summary>Debug log output</summary>

```
[2024-10-24T12:08:35Z DEBUG style::sharing] Failing to insert into the cache: Shadow Host
[2024-10-24T12:08:35Z DEBUG style::traversal] element_needs_traversal(<iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78), TraversalFlags(0x0), None)
[2024-10-24T12:08:35Z DEBUG style::traversal] recalc_style_at: <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78) (restyle_kind=Some(MatchAndCascade), dirty_descendants=true, data=ElementData { styles: ElementStyles { primary: None, pseudos: EagerPseudoStyles(None) }, damage: ServoRestyleDamage(0x0), hint: RestyleHint(0x0), flags: ElementDataFlags(0x0) })
[2024-10-24T12:08:35Z DEBUG style::traversal] compute_style: <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78) (kind=MatchAndCascade)
[2024-10-24T12:08:35Z DEBUG style::sharing] Can't share style, because DOM depth changed from 5 to 7, element: <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78)
[2024-10-24T12:08:35Z DEBUG style::style_resolver] Match primary for <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78), visited: AllLinksUnvisited
[2024-10-24T12:08:35Z DEBUG selectors::matching] Matching complex selector [title]abbr for <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78)
[2024-10-24T12:08:35Z DEBUG selectors::matching] Matching complex selector [title]acronym for <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78)
[2024-10-24T12:08:35Z DEBUG selectors::matching] Matching complex selector :not([seamless])iframe for <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78)
[2024-10-24T12:08:35Z DEBUG selectors::matching] Matching complex selector [seamless] for <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78)
[2024-10-24T12:08:35Z DEBUG selectors::matching] Matching complex selector :fullscreeniframe for <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78)
[2024-10-24T12:08:35Z DEBUG selectors::matching] Matching complex selector :autofill for <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78)
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] 0x154ad4140: 11+
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] 0x154ad4140: 12+
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] Creating rule node: 0x154ad8bf0
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] 0x154ad4140: 13-
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] Dropping node: 0x154ad4140, root: None, parent: None
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] 0x154ad8bf0: 1+
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] Creating rule node: 0x154ad8c40
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] 0x154ad8bf0: 2-
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] Dropping node: 0x154ad8bf0, root: Some(0x154ad4140), parent: Some(0x154ad4140)
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] 0x154ad8c40: 1+
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] 0x154ad8c40: 2-
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] Dropping node: 0x154ad8c40, root: Some(0x154ad4140), parent: Some(0x154ad8bf0)
[2024-10-24T12:08:35Z DEBUG style::style_resolver] Match pseudo <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78) for After, visited: AllLinksUnvisited
[2024-10-24T12:08:35Z DEBUG style::style_resolver] Match pseudo <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78) for Before, visited: AllLinksUnvisited
[2024-10-24T12:08:35Z DEBUG style::style_resolver] Match pseudo <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78) for Selection, visited: AllLinksUnvisited
[2024-10-24T12:08:35Z DEBUG style::sharing] Inserting into cache: <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78) with parent <div> (0x1962bbfa0ba0)
[2024-10-24T12:08:35Z DEBUG style::sharing] Clearing cache because depth changed from 5 to 7, element: <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78)
[2024-10-24T12:08:35Z DEBUG style::traversal] <iframe id=cf-chl-widget-7iqo8> (0x1962bbfa0b78) style is display:none - clearing data from descendants.
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] 0x154ad4140: 12+
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] Upgrading weak node: 0x17c3cc050
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] 0x154ad4140: 13-
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] Dropping node: 0x154ad4140, root: None, parent: None
[2024-10-24T12:08:35Z DEBUG style::rule_tree::core] 0x17c3cc050: 2+
[2024-10-24T12:08:35Z WARN  servoshell::panic_hook] Panic hook called.
```

</details>

1. The Cloudfront Turnstile is at least partially loaded.
2. An `iframe` with `id="cf-chl-widget-..."` is encountered during the styling pass.
3. It is found to have `display:none`, so stylo deletes the style data for the descendants. (See near the end of the output.)
4. Shortly thereafter, Servo tries to read the style data of some element and panics because it's not there.

🧠 Presumably that element is a child of that iframe, not sure how to check that yet.

## Without Shadow DOM

1. The debug output doesn't even mention an `iframe` 🤷 (I also grepped for `cf-chl-widget`)
2. Things load without panicking.
> I did some more triaging without really understanding what's going on, here are my findings:
> ## With Shadow DOM enabled
> Debug log output
> 
>     1. The Cloudfront Turnstile is at least partially loaded.
> 
>     2. An `iframe` with `id="cf-chl-widget-..."` is encountered during the styling pass.
> 
>     3. It is found to have `display:none`, so stylo deletes the style data for the descendants. (See near the end of the output.)
> 
>     4. Shortly thereafter, Servo tries to read the style data of some element and panics because it's not there.
> 
> 
> 🧠 Presumably that element is a child of that iframe, not sure how to check that yet.

Very interesting! It would be worth checking if this behavior is reproducible in a standalone test file that mimics these steps.
I have not been able to make servo crash yet with the following:
```
<script>
function check() {
    let iframe = document.querySelector('iframe');
    iframe.style.display = "none";
    let elem = iframe.contentDocument.querySelector('div');
    let style = iframe.contentWindow.getComputedStyle(elem);
    setTimeout(() => {
        console.log(elem.getBoundingClientRect());
        console.log(style.display);
    }, 1000);
}
</script>
<iframe onload="check()" src="hello.html"></iframe>
```
<details>
<summary>Full backtrace</summary>

```
Unstyled layout node? (thread StyleThread#2, at components/script/layout_dom/element.rs:758)
   0: backtrace::backtrace::libunwind::trace
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.74/src/backtrace/libunwind.rs:116:5
      backtrace::backtrace::trace_unsynchronized
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.74/src/backtrace/mod.rs:66:5
   1: <servoshell::backtrace::Print as core::fmt::Debug>::fmt
             at /Users/jdm/src/servo/ports/servoshell/backtrace.rs:65:13
   2: core::fmt::rt::Argument::fmt
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/fmt/rt.rs:165:63
      core::fmt::write
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/fmt/mod.rs:1168:21
   3: std::io::Write::write_fmt
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/io/mod.rs:1835:15
   4: servoshell::backtrace::print
             at /Users/jdm/src/servo/ports/servoshell/backtrace.rs:18:5
   5: servoshell::panic_hook::panic_hook
             at /Users/jdm/src/servo/ports/servoshell/panic_hook.rs:40:17
   6: core::ops::function::Fn::call
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/ops/function.rs:79:5
   7: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/alloc/src/boxed.rs:2077:9
      std::panicking::rust_panic_with_hook
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:799:13
   8: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:664:13
   9: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/sys_common/backtrace.rs:171:18
  10: rust_begin_unwind
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:652:5
  11: core::panicking::panic_fmt
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/panicking.rs:72:14
  12: core::panicking::panic_display
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/panicking.rs:262:5
      core::option::expect_failed
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/option.rs:1995:5
  13: core::option::Option<T>::expect
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/option.rs:898:21
  14: <script::layout_dom::element::ServoThreadSafeLayoutElement as script_layout_interface::wrapper_traits::ThreadSafeLayoutElement>::style_data
             at /Users/jdm/src/servo/components/script/layout_dom/element.rs:758:9
  15: script_layout_interface::wrapper_traits::ThreadSafeLayoutElement::style
             at /Users/jdm/src/servo/components/shared/script_layout/wrapper_traits.rs:424:20
  16: script_layout_interface::wrapper_traits::ThreadSafeLayoutNode::style
             at /Users/jdm/src/servo/components/shared/script_layout/wrapper_traits.rs:251:13
  17: <LayoutNodeType as layout_2020::dom::NodeExt>::style
             at /Users/jdm/src/servo/components/layout_2020/dom.rs:194:9
  18: layout_2020::dom_traversal::traverse_element
             at /Users/jdm/src/servo/components/layout_2020/dom_traversal.rs:220:17
  19: layout_2020::dom_traversal::traverse_children_of
             at /Users/jdm/src/servo/components/layout_2020/dom_traversal.rs:204:17
  20: layout_2020::dom_traversal::NonReplacedContents::traverse
             at /Users/jdm/src/servo/components/layout_2020/dom_traversal.rs:364:47
  21: layout_2020::flow::construct::<impl layout_2020::flow::BlockContainer>::construct
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:179:9
  22: layout_2020::flow::construct::IntermediateBlockContainer::finish
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:742:18
  23: layout_2020::flow::construct::BlockLevelJob<Node>::finish
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:654:32
  24: layout_2020::flow::construct::BlockContainerBuilder<Node>::finish::{{closure}}
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:235:40
  25: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &F>::call_mut
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/ops/function.rs:272:13
  26: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/ops/function.rs:305:13
  27: core::option::Option<T>::map
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/option.rs:1075:29
      <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/iter/adapters/map.rs:108:26
  28: rayon::iter::plumbing::Folder::consume_iter
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:177:21
  29: <rayon::iter::map::MapFolder<C,F> as rayon::iter::plumbing::Folder<T>>::consume_iter
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/map.rs:248:21
  30: rayon::iter::plumbing::Producer::fold_with
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:109:9
  31: rayon::iter::plumbing::bridge_producer_consumer::helper
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:437:13
  32: rayon::iter::plumbing::bridge_producer_consumer
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:396:12
  33: <rayon::iter::plumbing::bridge::Callback<C> as rayon::iter::plumbing::ProducerCallback<I>>::callback
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:372:13
  34: <rayon::vec::Drain<T> as rayon::iter::IndexedParallelIterator>::with_producer
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/vec.rs:147:13
  35: <rayon::vec::IntoIter<T> as rayon::iter::IndexedParallelIterator>::with_producer
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/vec.rs:83:9
  36: rayon::iter::plumbing::bridge
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:356:12
  37: <rayon::vec::IntoIter<T> as rayon::iter::ParallelIterator>::drive_unindexed
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/vec.rs:58:9
  38: <rayon::iter::map::Map<I,F> as rayon::iter::ParallelIterator>::drive_unindexed
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/map.rs:49:9
  39: rayon::iter::collect::special_extend::{{closure}}
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/collect/mod.rs:39:46
  40: rayon::iter::collect::collect_with_consumer
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/collect/mod.rs:84:18
  41: rayon::iter::collect::special_extend
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/collect/mod.rs:39:5
  42: rayon::iter::extend::<impl rayon::iter::ParallelExtend<T> for alloc::vec::Vec<T>>::par_extend
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/extend.rs:584:17
  43: rayon::iter::from_par_iter::collect_extended
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/from_par_iter.rs:20:5
  44: rayon::iter::from_par_iter::<impl rayon::iter::FromParallelIterator<T> for alloc::vec::Vec<T>>::from_par_iter
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/from_par_iter.rs:33:9
  45: rayon::iter::ParallelIterator::collect
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/mod.rs:2069:9
  46: layout_2020::flow::construct::BlockContainerBuilder<Node>::finish
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:233:13
  47: layout_2020::flow::construct::<impl layout_2020::flow::BlockContainer>::construct
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:180:9
  48: layout_2020::flow::construct::IntermediateBlockContainer::finish
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:742:18
  49: layout_2020::flow::construct::BlockLevelJob<Node>::finish
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:654:32
  50: layout_2020::flow::construct::BlockContainerBuilder<Node>::finish::{{closure}}
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:235:40
  51: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &F>::call_mut
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/ops/function.rs:272:13
  52: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/ops/function.rs:305:13
  53: core::option::Option<T>::map
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/option.rs:1075:29
      <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/iter/adapters/map.rs:108:26
  54: rayon::iter::plumbing::Folder::consume_iter
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:177:21
  55: <rayon::iter::map::MapFolder<C,F> as rayon::iter::plumbing::Folder<T>>::consume_iter
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/map.rs:248:21
  56: rayon::iter::plumbing::Producer::fold_with
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:109:9
  57: rayon::iter::plumbing::bridge_producer_consumer::helper
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:437:13
  58: rayon::iter::plumbing::bridge_producer_consumer
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:396:12
  59: <rayon::iter::plumbing::bridge::Callback<C> as rayon::iter::plumbing::ProducerCallback<I>>::callback
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:372:13
  60: <rayon::vec::Drain<T> as rayon::iter::IndexedParallelIterator>::with_producer
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/vec.rs:147:13
  61: <rayon::vec::IntoIter<T> as rayon::iter::IndexedParallelIterator>::with_producer
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/vec.rs:83:9
  62: rayon::iter::plumbing::bridge
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:356:12
  63: <rayon::vec::IntoIter<T> as rayon::iter::ParallelIterator>::drive_unindexed
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/vec.rs:58:9
  64: <rayon::iter::map::Map<I,F> as rayon::iter::ParallelIterator>::drive_unindexed
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/map.rs:49:9
  65: rayon::iter::collect::special_extend::{{closure}}
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/collect/mod.rs:39:46
  66: rayon::iter::collect::collect_with_consumer
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/collect/mod.rs:84:18
  67: rayon::iter::collect::special_extend
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/collect/mod.rs:39:5
  68: rayon::iter::extend::<impl rayon::iter::ParallelExtend<T> for alloc::vec::Vec<T>>::par_extend
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/extend.rs:584:17
  69: rayon::iter::from_par_iter::collect_extended
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/from_par_iter.rs:20:5
  70: rayon::iter::from_par_iter::<impl rayon::iter::FromParallelIterator<T> for alloc::vec::Vec<T>>::from_par_iter
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/from_par_iter.rs:33:9
  71: rayon::iter::ParallelIterator::collect
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/mod.rs:2069:9
  72: layout_2020::flow::construct::BlockContainerBuilder<Node>::finish
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:233:13
  73: layout_2020::flow::construct::<impl layout_2020::flow::BlockContainer>::construct
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:180:9
  74: layout_2020::flow::construct::IntermediateBlockContainer::finish
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:742:18
  75: layout_2020::flow::construct::BlockLevelJob<Node>::finish
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:654:32
  76: layout_2020::flow::construct::BlockContainerBuilder<Node>::finish::{{closure}}
             at /Users/jdm/src/servo/components/layout_2020/flow/construct.rs:235:40
  77: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &F>::call_mut
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/ops/function.rs:272:13
  78: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/ops/function.rs:305:13
  79: core::option::Option<T>::map
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/option.rs:1075:29
      <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/iter/adapters/map.rs:108:26
  80: rayon::iter::plumbing::Folder::consume_iter
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:177:21
  81: <rayon::iter::map::MapFolder<C,F> as rayon::iter::plumbing::Folder<T>>::consume_iter
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/map.rs:248:21
  82: rayon::iter::plumbing::Producer::fold_with
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:109:9
  83: rayon::iter::plumbing::bridge_producer_consumer::helper
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:437:13
  84: rayon::iter::plumbing::bridge_producer_consumer::helper::{{closure}}
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:417:21
  85: rayon_core::join::join_context::call_a::{{closure}}
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/join/mod.rs:124:17
  86: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/panic/unwind_safe.rs:272:9
  87: std::panicking::try::do_call
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:559:40
  88: ___rust_try
  89: std::panicking::try
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:523:19
  90: std::panic::catch_unwind
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panic.rs:149:14
  91: rayon_core::unwind::halt_unwinding
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/unwind.rs:17:5
  92: rayon_core::join::join_context::{{closure}}
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/join/mod.rs:142:24
  93: rayon_core::registry::in_worker
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:951:13
  94: rayon_core::join::join_context
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/join/mod.rs:132:5
  95: rayon::iter::plumbing::bridge_producer_consumer::helper
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:415:47
  96: rayon::iter::plumbing::bridge_producer_consumer::helper::{{closure}}
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:426:21
  97: rayon_core::join::join_context::call_b::{{closure}}
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/join/mod.rs:129:25
  98: rayon_core::job::JobResult<T>::call::{{closure}}
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/job.rs:218:41
  99: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/panic/unwind_safe.rs:272:9
 100: std::panicking::try::do_call
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:559:40
 101: ___rust_try
 102: std::panicking::try
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:523:19
 103: std::panic::catch_unwind
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panic.rs:149:14
 104: rayon_core::unwind::halt_unwinding
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/unwind.rs:17:5
 105: rayon_core::job::JobResult<T>::call
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/job.rs:218:15
 106: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/job.rs:120:32
 107: rayon_core::job::JobRef::execute
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/job.rs:64:9
 108: rayon_core::registry::WorkerThread::execute
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:860:9
 109: rayon_core::registry::WorkerThread::wait_until_cold
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:794:21
 110: rayon_core::registry::WorkerThread::wait_until
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:769:13
 111: rayon_core::registry::WorkerThread::wait_until_out_of_work
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:818:9
 112: rayon_core::registry::main_loop
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:923:5
 113: rayon_core::registry::ThreadBuilder::run
             at /Users/jdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:53:18
 114: style::global_style_data::thread_spawn::{{closure}}
             at /Users/jdm/.cargo/git/checkouts/stylo-d5871ad1ba1940d3/789ab89/style/global_style_data.rs:73:34
 115: std::sys_common::backtrace::__rust_begin_short_backtrace
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/sys_common/backtrace.rs:155:18
 116: std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/thread/mod.rs:542:17
 117: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/panic/unwind_safe.rs:272:9
 118: std::panicking::try::do_call
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:559:40
 119: ___rust_try
 120: std::panicking::try
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:523:19
 121: std::panic::catch_unwind
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panic.rs:149:14
      std::thread::Builder::spawn_unchecked_::{{closure}}
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/thread/mod.rs:541:30
 122: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/ops/function.rs:250:5
 123: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/alloc/src/boxed.rs:2063:9
      <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/alloc/src/boxed.rs:2063:9
      std::sys::pal::unix::thread::Thread::new::thread_start
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/sys/pal/unix/thread.rs:108:17
 124: __pthread_joiner_wake
```

</details>
Here's a minimal reproduction:
```html
<html>
    <body>
        <div id="cf-turnstile"></div>
        <script defer>
            var challenge_element = document.getElementById("cf-turnstile");

            var div = document.createElement("div");
            var shadow_root = div.attachShadow();

            var ke = document.createElement("div");
            div.appendChild(ke)
            challenge_element.appendChild(div);
        </script>
    </body>
</html>
```
This happens because `ServoLayoutElement::traversal_children` fails to account for children outside the shadow DOM if the element is a shadow host:
https://github.com/servo/servo/blob/c73e4baca206c172802be145c1fb8d110c1be863/components/script/layout_dom/element.rs#L151-L157

Stylo doesn't know about the element, so it is never assigned a style.

Very fun debugging session!

Fix patch:
diff --git a/components/script/layout_dom/element.rs b/components/script/layout_dom/element.rs
index 05349205c8232..e4841b509a999 100644
--- a/components/script/layout_dom/element.rs
+++ b/components/script/layout_dom/element.rs
@@ -140,20 +140,41 @@ impl<'dom> ServoLayoutElement<'dom> {
     }
 }
 
+pub struct DomChildrenIncludingShadowDom<N> {
+    children: DomChildren<N>,
+    children_in_shadow_root: Option<DomChildren<N>>,
+}
+
+impl<N> Iterator for DomChildrenIncludingShadowDom<N>
+where
+    N: TNode,
+{
+    type Item = N;
+
+    fn next(&mut self) -> Option<Self::Item> {
+        self.children
+            .next()
+            .or_else(|| self.children_in_shadow_root.as_mut()?.next())
+    }
+}
+
 impl<'dom> style::dom::TElement for ServoLayoutElement<'dom> {
     type ConcreteNode = ServoLayoutNode<'dom>;
-    type TraversalChildrenIterator = DomChildren<Self::ConcreteNode>;
+    type TraversalChildrenIterator = DomChildrenIncludingShadowDom<Self::ConcreteNode>;
 
     fn as_node(&self) -> ServoLayoutNode<'dom> {
         ServoLayoutNode::from_layout_js(self.element.upcast())
     }
 
     fn traversal_children(&self) -> LayoutIterator<Self::TraversalChildrenIterator> {
-        LayoutIterator(if let Some(shadow) = self.shadow_root() {
-            shadow.as_node().dom_children()
-        } else {
-            self.as_node().dom_children()
-        })
+        let children = DomChildrenIncludingShadowDom {
+            children: self.as_node().dom_children(),
+            children_in_shadow_root: self
+                .shadow_root()
+                .map(|shadow| shadow.as_node().dom_children()),
+        };
+
+        LayoutIterator(children)
     }
 
     fn is_html_element(&self) -> bool {


Test patch:
diff --git a/tests/wpt/meta/css/css-animations/cancel-animation-shadow-slot-invalidation.html.ini b/tests/wpt/meta/css/css-animations/cancel-animation-shadow-slot-invalidation.html.ini
index 691bc0385f166..001271124aa4b 100644
--- a/tests/wpt/meta/css/css-animations/cancel-animation-shadow-slot-invalidation.html.ini
+++ b/tests/wpt/meta/css/css-animations/cancel-animation-shadow-slot-invalidation.html.ini
@@ -1,2 +1,2 @@
 [cancel-animation-shadow-slot-invalidation.html]
-  expected: CRASH
+  expected: TIMEOUT
diff --git a/tests/wpt/meta/css/css-cascade/layer-slotted-rule.html.ini b/tests/wpt/meta/css/css-cascade/layer-slotted-rule.html.ini
index 4eb703de442b8..2b19f6fdf0ef6 100644
--- a/tests/wpt/meta/css/css-cascade/layer-slotted-rule.html.ini
+++ b/tests/wpt/meta/css/css-cascade/layer-slotted-rule.html.ini
@@ -1,2 +1,2 @@
 [layer-slotted-rule.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/css/css-cascade/revert-layer-014.html.ini b/tests/wpt/meta/css/css-cascade/revert-layer-014.html.ini
index 5a9f9a704fa69..3bd4bc7ec81dc 100644
--- a/tests/wpt/meta/css/css-cascade/revert-layer-014.html.ini
+++ b/tests/wpt/meta/css/css-cascade/revert-layer-014.html.ini
@@ -1,2 +1,2 @@
 [revert-layer-014.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/css/css-content/quotes-slot-scoping.html.ini b/tests/wpt/meta/css/css-content/quotes-slot-scoping.html.ini
index 7f62608409e97..8edc9adb64f7b 100644
--- a/tests/wpt/meta/css/css-content/quotes-slot-scoping.html.ini
+++ b/tests/wpt/meta/css/css-content/quotes-slot-scoping.html.ini
@@ -1,2 +1,2 @@
 [quotes-slot-scoping.html]
-  expected: CRASH
+  expected: PASS
diff --git a/tests/wpt/meta/css/css-display/display-contents-shadow-dom-1.html.ini b/tests/wpt/meta/css/css-display/display-contents-shadow-dom-1.html.ini
index 38b2543b2ca96..cf0907404f8e4 100644
--- a/tests/wpt/meta/css/css-display/display-contents-shadow-dom-1.html.ini
+++ b/tests/wpt/meta/css/css-display/display-contents-shadow-dom-1.html.ini
@@ -1,2 +1,2 @@
 [display-contents-shadow-dom-1.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/css/css-lists/counter-list-item-slot-order.html.ini b/tests/wpt/meta/css/css-lists/counter-list-item-slot-order.html.ini
index 641c85bc5e6a2..0275be6b33841 100644
--- a/tests/wpt/meta/css/css-lists/counter-list-item-slot-order.html.ini
+++ b/tests/wpt/meta/css/css-lists/counter-list-item-slot-order.html.ini
@@ -1,2 +1,2 @@
 [counter-list-item-slot-order.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/css/css-lists/counter-slot-order-scoping.html.ini b/tests/wpt/meta/css/css-lists/counter-slot-order-scoping.html.ini
index be6bf3ce5953c..9e06a8d2ccb52 100644
--- a/tests/wpt/meta/css/css-lists/counter-slot-order-scoping.html.ini
+++ b/tests/wpt/meta/css/css-lists/counter-slot-order-scoping.html.ini
@@ -1,2 +1,2 @@
 [counter-slot-order-scoping.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/css/css-lists/counter-slot-order.html.ini b/tests/wpt/meta/css/css-lists/counter-slot-order.html.ini
index 0d273e984c648..96ad6ce267933 100644
--- a/tests/wpt/meta/css/css-lists/counter-slot-order.html.ini
+++ b/tests/wpt/meta/css/css-lists/counter-slot-order.html.ini
@@ -1,2 +1,2 @@
 [counter-slot-order.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/css/css-text-decor/text-decoration-propagation-shadow.html.ini b/tests/wpt/meta/css/css-text-decor/text-decoration-propagation-shadow.html.ini
deleted file mode 100644
index 6d7f865e2a202..0000000000000
--- a/tests/wpt/meta/css/css-text-decor/text-decoration-propagation-shadow.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[text-decoration-propagation-shadow.html]
-  expected: CRASH
diff --git a/tests/wpt/meta/css/css-text/white-space/remove-slotted-with-whitespace-sibling.html.ini b/tests/wpt/meta/css/css-text/white-space/remove-slotted-with-whitespace-sibling.html.ini
index b1aab92307ec9..9470360b86134 100644
--- a/tests/wpt/meta/css/css-text/white-space/remove-slotted-with-whitespace-sibling.html.ini
+++ b/tests/wpt/meta/css/css-text/white-space/remove-slotted-with-whitespace-sibling.html.ini
@@ -1,2 +1,2 @@
 [remove-slotted-with-whitespace-sibling.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/css/cssom-view/checkVisibility.html.ini b/tests/wpt/meta/css/cssom-view/checkVisibility.html.ini
index beb953175e09a..59b2f56943bb6 100644
--- a/tests/wpt/meta/css/cssom-view/checkVisibility.html.ini
+++ b/tests/wpt/meta/css/cssom-view/checkVisibility.html.ini
@@ -1,5 +1,4 @@
 [checkVisibility.html]
-  expected: CRASH
   [checkVisibility on visibility:hidden element.]
     expected: FAIL
 
@@ -29,3 +28,18 @@
 
   [checkVisibility on content-visibility:hidden element after forced layout update.]
     expected: FAIL
+
+  [checkVisibility on element slotted in content-visibility: hidden shadow host.]
+    expected: FAIL
+
+  [checkVisibility on element slotted in display:none shadow host.]
+    expected: FAIL
+
+  [checkVisibility on display:contents element.]
+    expected: FAIL
+
+  [checkVisibility on element slotted in opacity: 0; shadow host.]
+    expected: FAIL
+
+  [checkVisibility on root element with content-visibility: hidden returns true.]
+    expected: FAIL
diff --git a/tests/wpt/meta/css/cssom/insert-dir-rule-crash.html.ini b/tests/wpt/meta/css/cssom/insert-dir-rule-crash.html.ini
deleted file mode 100644
index fb88575a052a5..0000000000000
--- a/tests/wpt/meta/css/cssom/insert-dir-rule-crash.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[insert-dir-rule-crash.html]
-  expected: CRASH
diff --git a/tests/wpt/meta/css/cssom/insert-dir-rule-in-iframe-crash.html.ini b/tests/wpt/meta/css/cssom/insert-dir-rule-in-iframe-crash.html.ini
deleted file mode 100644
index 38f550a4d270c..0000000000000
--- a/tests/wpt/meta/css/cssom/insert-dir-rule-in-iframe-crash.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[insert-dir-rule-in-iframe-crash.html]
-  expected: CRASH
diff --git a/tests/wpt/meta/css/selectors/focus-within-shadow-001.html.ini b/tests/wpt/meta/css/selectors/focus-within-shadow-001.html.ini
index dd5cd13f18807..4cfa7c59d6b89 100644
--- a/tests/wpt/meta/css/selectors/focus-within-shadow-001.html.ini
+++ b/tests/wpt/meta/css/selectors/focus-within-shadow-001.html.ini
@@ -1,2 +1,2 @@
 [focus-within-shadow-001.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/css/selectors/focus-within-shadow-002.html.ini b/tests/wpt/meta/css/selectors/focus-within-shadow-002.html.ini
index 9cdf27b3a0b6a..c3d6de39fc804 100644
--- a/tests/wpt/meta/css/selectors/focus-within-shadow-002.html.ini
+++ b/tests/wpt/meta/css/selectors/focus-within-shadow-002.html.ini
@@ -1,2 +1,2 @@
 [focus-within-shadow-002.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/css/selectors/focus-within-shadow-003.html.ini b/tests/wpt/meta/css/selectors/focus-within-shadow-003.html.ini
index 719aa5550bad0..eb93805b402f9 100644
--- a/tests/wpt/meta/css/selectors/focus-within-shadow-003.html.ini
+++ b/tests/wpt/meta/css/selectors/focus-within-shadow-003.html.ini
@@ -1,2 +1,2 @@
 [focus-within-shadow-003.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/css/selectors/focus-within-shadow-004.html.ini b/tests/wpt/meta/css/selectors/focus-within-shadow-004.html.ini
index ce65b3672bd3e..db688bdec0a37 100644
--- a/tests/wpt/meta/css/selectors/focus-within-shadow-004.html.ini
+++ b/tests/wpt/meta/css/selectors/focus-within-shadow-004.html.ini
@@ -1,2 +1,2 @@
 [focus-within-shadow-004.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/css/selectors/focus-within-shadow-005.html.ini b/tests/wpt/meta/css/selectors/focus-within-shadow-005.html.ini
index 6e6bb268a4bd9..ebc78dee513ec 100644
--- a/tests/wpt/meta/css/selectors/focus-within-shadow-005.html.ini
+++ b/tests/wpt/meta/css/selectors/focus-within-shadow-005.html.ini
@@ -1,2 +1,2 @@
 [focus-within-shadow-005.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/css/selectors/focus-within-shadow-006.html.ini b/tests/wpt/meta/css/selectors/focus-within-shadow-006.html.ini
index 3bc435fa25406..ee9af74cdccfa 100644
--- a/tests/wpt/meta/css/selectors/focus-within-shadow-006.html.ini
+++ b/tests/wpt/meta/css/selectors/focus-within-shadow-006.html.ini
@@ -1,2 +1,2 @@
 [focus-within-shadow-006.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/css/selectors/i18n/lang-pseudo-class-across-shadow-boundaries.html.ini b/tests/wpt/meta/css/selectors/i18n/lang-pseudo-class-across-shadow-boundaries.html.ini
index ea34cadc7ee1d..f2f324e2968e3 100644
--- a/tests/wpt/meta/css/selectors/i18n/lang-pseudo-class-across-shadow-boundaries.html.ini
+++ b/tests/wpt/meta/css/selectors/i18n/lang-pseudo-class-across-shadow-boundaries.html.ini
@@ -1,2 +1,2 @@
 [lang-pseudo-class-across-shadow-boundaries.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/css/selectors/is-where-shadow.html.ini b/tests/wpt/meta/css/selectors/is-where-shadow.html.ini
index f92f34dac22a2..70220f3301845 100644
--- a/tests/wpt/meta/css/selectors/is-where-shadow.html.ini
+++ b/tests/wpt/meta/css/selectors/is-where-shadow.html.ini
@@ -1,2 +1,9 @@
 [is-where-shadow.html]
-  expected: CRASH
+  [:is() inside :host()]
+    expected: FAIL
+
+  [:is() inside :host-context()]
+    expected: FAIL
+
+  [:is() inside ::slotted()]
+    expected: FAIL
diff --git a/tests/wpt/meta/html/canvas/element/2d.text-outside-of-the-flat-tree.html.ini b/tests/wpt/meta/html/canvas/element/2d.text-outside-of-the-flat-tree.html.ini
index ef002111c84d4..a41bcb75d55ad 100644
--- a/tests/wpt/meta/html/canvas/element/2d.text-outside-of-the-flat-tree.html.ini
+++ b/tests/wpt/meta/html/canvas/element/2d.text-outside-of-the-flat-tree.html.ini
@@ -1,2 +1,2 @@
 [2d.text-outside-of-the-flat-tree.html]
-  expected: CRASH
+  expected: PASS
diff --git a/tests/wpt/meta/html/dom/elements/global-attributes/dir-auto-dynamic-changes.window.js.ini b/tests/wpt/meta/html/dom/elements/global-attributes/dir-auto-dynamic-changes.window.js.ini
index 66060b866c4d0..dcaaf38491c9c 100644
--- a/tests/wpt/meta/html/dom/elements/global-attributes/dir-auto-dynamic-changes.window.js.ini
+++ b/tests/wpt/meta/html/dom/elements/global-attributes/dir-auto-dynamic-changes.window.js.ini
@@ -1,5 +1,5 @@
 [dir-auto-dynamic-changes.window.html]
-  expected: CRASH
+  expected: OK
   [dynamic insertion of RTL text in a child element]
     expected: FAIL
 
diff --git a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-01.html.ini b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-01.html.ini
index bd6fd2b0e33c5..cc76a05c1d8c4 100644
--- a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-01.html.ini
+++ b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-01.html.ini
@@ -1,2 +1,2 @@
 [dir-shadow-01.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-02.html.ini b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-02.html.ini
index dd377d62db89d..d83ab8db3b91b 100644
--- a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-02.html.ini
+++ b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-02.html.ini
@@ -1,2 +1,2 @@
 [dir-shadow-02.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-03.html.ini b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-03.html.ini
index 26e6aa27f78ea..341d054ebbc30 100644
--- a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-03.html.ini
+++ b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-03.html.ini
@@ -1,2 +1,2 @@
 [dir-shadow-03.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-04.html.ini b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-04.html.ini
index 33bd75634fc8f..d34ae8710b23c 100644
--- a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-04.html.ini
+++ b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-04.html.ini
@@ -1,2 +1,2 @@
 [dir-shadow-04.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-05.html.ini b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-05.html.ini
index efe96493579fe..c80d7307d5721 100644
--- a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-05.html.ini
+++ b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-05.html.ini
@@ -1,2 +1,2 @@
 [dir-shadow-05.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-06.html.ini b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-06.html.ini
index 60c9a99ea1b7f..40d08e09e38c1 100644
--- a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-06.html.ini
+++ b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-06.html.ini
@@ -1,2 +1,2 @@
 [dir-shadow-06.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-07.html.ini b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-07.html.ini
index 6f8ac74943b22..8b118b20ad7b1 100644
--- a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-07.html.ini
+++ b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-07.html.ini
@@ -1,2 +1,2 @@
 [dir-shadow-07.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-08.html.ini b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-08.html.ini
index c96870d6fd604..927891eb7e0ba 100644
--- a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-08.html.ini
+++ b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-08.html.ini
@@ -1,2 +1,2 @@
 [dir-shadow-08.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-09.html.ini b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-09.html.ini
index d79d8ff644bd9..53ac23518f6e9 100644
--- a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-09.html.ini
+++ b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-09.html.ini
@@ -1,2 +1,2 @@
 [dir-shadow-09.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-10.html.ini b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-10.html.ini
index 87bad4294ac07..9e6f6f536c08a 100644
--- a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-10.html.ini
+++ b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-10.html.ini
@@ -1,2 +1,2 @@
 [dir-shadow-10.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-11.html.ini b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-11.html.ini
index 122163ab5e48c..69ea943cfa855 100644
--- a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-11.html.ini
+++ b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-11.html.ini
@@ -1,2 +1,2 @@
 [dir-shadow-11.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-12.html.ini b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-12.html.ini
index dfc1837aa066f..cb9af7df593ef 100644
--- a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-12.html.ini
+++ b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-12.html.ini
@@ -1,2 +1,2 @@
 [dir-shadow-12.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-31.html.ini b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-31.html.ini
index 698c82e7c6109..052af59916278 100644
--- a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-31.html.ini
+++ b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-31.html.ini
@@ -1,2 +1,2 @@
 [dir-shadow-31.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-35.html.ini b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-35.html.ini
index 40d4430c54a04..4b931e6b8851d 100644
--- a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-35.html.ini
+++ b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-35.html.ini
@@ -1,2 +1,2 @@
 [dir-shadow-35.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-41.html.ini b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-41.html.ini
index d7d12becf31bc..75cf38f059b45 100644
--- a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-41.html.ini
+++ b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-41.html.ini
@@ -1,2 +1,2 @@
 [dir-shadow-41.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-42.html.ini b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-42.html.ini
index d7c05be42f041..1a4b5035cc0b6 100644
--- a/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-42.html.ini
+++ b/tests/wpt/meta/html/dom/elements/global-attributes/dir-shadow-42.html.ini
@@ -1,2 +1,2 @@
 [dir-shadow-42.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/html/dom/elements/global-attributes/dir-slots-directionality.html.ini b/tests/wpt/meta/html/dom/elements/global-attributes/dir-slots-directionality.html.ini
index 856415a2a928f..cef483189948c 100644
--- a/tests/wpt/meta/html/dom/elements/global-attributes/dir-slots-directionality.html.ini
+++ b/tests/wpt/meta/html/dom/elements/global-attributes/dir-slots-directionality.html.ini
@@ -1,5 +1,5 @@
 [dir-slots-directionality.html]
-  expected: CRASH
+  expected: OK
   [Slots: Directionality: dir=rtl on slot]
     expected: FAIL
 
diff --git a/tests/wpt/meta/html/editing/editing-0/contenteditable/contentEditable-slotted-inherit.html.ini b/tests/wpt/meta/html/editing/editing-0/contenteditable/contentEditable-slotted-inherit.html.ini
index 0a668792c69c8..8eba625c7d492 100644
--- a/tests/wpt/meta/html/editing/editing-0/contenteditable/contentEditable-slotted-inherit.html.ini
+++ b/tests/wpt/meta/html/editing/editing-0/contenteditable/contentEditable-slotted-inherit.html.ini
@@ -1,5 +1,5 @@
 [contentEditable-slotted-inherit.html]
-  expected: CRASH
+  expected: OK
   [Slotted child of contenteditable host should be editable - slot direct child of shadow root]
     expected: FAIL
 
diff --git a/tests/wpt/meta/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-in-slot.html.ini b/tests/wpt/meta/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-in-slot.html.ini
index d4875571e44c6..4ed1ce5159e1a 100644
--- a/tests/wpt/meta/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-in-slot.html.ini
+++ b/tests/wpt/meta/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-in-slot.html.ini
@@ -1,2 +1,2 @@
 [legend-in-slot.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/sticky-content-crash.html.ini b/tests/wpt/meta/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/sticky-content-crash.html.ini
index 5897e02b025d8..8a2f6a31db7de 100644
--- a/tests/wpt/meta/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/sticky-content-crash.html.ini
+++ b/tests/wpt/meta/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/sticky-content-crash.html.ini
@@ -1,2 +1,2 @@
 [sticky-content-crash.html]
-  expected: CRASH
+  expected: PASS
diff --git a/tests/wpt/meta/html/semantics/interactive-elements/the-dialog-element/showmodal-in-shadow-crash.html.ini b/tests/wpt/meta/html/semantics/interactive-elements/the-dialog-element/showmodal-in-shadow-crash.html.ini
deleted file mode 100644
index a98363d97c373..0000000000000
--- a/tests/wpt/meta/html/semantics/interactive-elements/the-dialog-element/showmodal-in-shadow-crash.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[showmodal-in-shadow-crash.html]
-  expected: CRASH
diff --git a/tests/wpt/meta/selection/shadow-dom/tentative/Selection-getComposedRanges-dom-mutations-removal.html.ini b/tests/wpt/meta/selection/shadow-dom/tentative/Selection-getComposedRanges-dom-mutations-removal.html.ini
index 0465cdf5000bc..e47d5cad18194 100644
--- a/tests/wpt/meta/selection/shadow-dom/tentative/Selection-getComposedRanges-dom-mutations-removal.html.ini
+++ b/tests/wpt/meta/selection/shadow-dom/tentative/Selection-getComposedRanges-dom-mutations-removal.html.ini
@@ -1,5 +1,5 @@
 [Selection-getComposedRanges-dom-mutations-removal.html?mode=open]
-  expected: CRASH
+  expected: OK
   [Range is fully in shadow tree. Removing shadow host collapses composed StaticRange. Note it does not update previously returned composed StaticRange.]
     expected: FAIL
 
@@ -17,7 +17,7 @@
 
 
 [Selection-getComposedRanges-dom-mutations-removal.html?mode=closed]
-  expected: CRASH
+  expected: OK
   [Range is fully in shadow tree. Removing shadow host collapses composed StaticRange. Note it does not update previously returned composed StaticRange.]
     expected: FAIL
 
diff --git a/tests/wpt/meta/selection/shadow-dom/tentative/Selection-later-become-slotted-content.html.ini b/tests/wpt/meta/selection/shadow-dom/tentative/Selection-later-become-slotted-content.html.ini
index e1fc94e4e61fc..258b3e1d4ff5c 100644
--- a/tests/wpt/meta/selection/shadow-dom/tentative/Selection-later-become-slotted-content.html.ini
+++ b/tests/wpt/meta/selection/shadow-dom/tentative/Selection-later-become-slotted-content.html.ini
@@ -1,4 +1,4 @@
 [Selection-later-become-slotted-content.html]
-  expected: CRASH
+  expected: OK
   [test to select a light DOM element and it becomes a slotted content after the selection]
     expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/declarative/declarative-after-attachshadow.html.ini b/tests/wpt/meta/shadow-dom/declarative/declarative-after-attachshadow.html.ini
index dc77d39f10a12..80e5b44150bcb 100644
--- a/tests/wpt/meta/shadow-dom/declarative/declarative-after-attachshadow.html.ini
+++ b/tests/wpt/meta/shadow-dom/declarative/declarative-after-attachshadow.html.ini
@@ -1,2 +1,3 @@
 [declarative-after-attachshadow.html]
-  expected: CRASH
+  [Declarative Shadow DOM: declarative shadow should fail if attachShadow() already called]
+    expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/declarative/declarative-shadow-dom-repeats.html.ini b/tests/wpt/meta/shadow-dom/declarative/declarative-shadow-dom-repeats.html.ini
index 2e607f671d147..c6200e5d9944e 100644
--- a/tests/wpt/meta/shadow-dom/declarative/declarative-shadow-dom-repeats.html.ini
+++ b/tests/wpt/meta/shadow-dom/declarative/declarative-shadow-dom-repeats.html.ini
@@ -1,2 +1,9 @@
 [declarative-shadow-dom-repeats.html]
-  expected: CRASH
+  [Repeated declarative shadow roots keep only the first]
+    expected: FAIL
+
+  [Calling attachShadow() on declarative shadow root must match mode]
+    expected: FAIL
+
+  [Calling attachShadow() on declarative shadow root must match all parameters]
+    expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/declarative/innerhtml-on-ordinary-template.html.ini b/tests/wpt/meta/shadow-dom/declarative/innerhtml-on-ordinary-template.html.ini
index 2fa94a52b745e..55cf7e0ec373f 100644
--- a/tests/wpt/meta/shadow-dom/declarative/innerhtml-on-ordinary-template.html.ini
+++ b/tests/wpt/meta/shadow-dom/declarative/innerhtml-on-ordinary-template.html.ini
@@ -1,2 +1,3 @@
 [innerhtml-on-ordinary-template.html]
-  expected: CRASH
+  [Declarative Shadow DOM: innerHTML should work on <template shadowroot> that is left over]
+    expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/directionality-001.tentative.html.ini b/tests/wpt/meta/shadow-dom/directionality-001.tentative.html.ini
index 0fc1e421721a8..8929df10f6747 100644
--- a/tests/wpt/meta/shadow-dom/directionality-001.tentative.html.ini
+++ b/tests/wpt/meta/shadow-dom/directionality-001.tentative.html.ini
@@ -1,2 +1,2 @@
 [directionality-001.tentative.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/directionality-002.tentative.html.ini b/tests/wpt/meta/shadow-dom/directionality-002.tentative.html.ini
index 648e6d3a3e48a..6e695e571145a 100644
--- a/tests/wpt/meta/shadow-dom/directionality-002.tentative.html.ini
+++ b/tests/wpt/meta/shadow-dom/directionality-002.tentative.html.ini
@@ -1,2 +1,2 @@
 [directionality-002.tentative.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/event-inside-slotted-node.html.ini b/tests/wpt/meta/shadow-dom/event-inside-slotted-node.html.ini
index 665c280fe7e48..5186d4b5b5f51 100644
--- a/tests/wpt/meta/shadow-dom/event-inside-slotted-node.html.ini
+++ b/tests/wpt/meta/shadow-dom/event-inside-slotted-node.html.ini
@@ -1,2 +1,60 @@
 [event-inside-slotted-node.html]
-  expected: CRASH
+  [Firing an event inside a grand child of a detached open mode shadow host]
+    expected: FAIL
+
+  [Firing an event inside a grand child of a detached closed mode shadow host]
+    expected: FAIL
+
+  [Firing an event inside a grand child of an in-document open mode shadow host]
+    expected: FAIL
+
+  [Firing an event inside a grand child of an in-document closed mode shadow host]
+    expected: FAIL
+
+  [Firing an event on a node with two ancestors with a detached open and open shadow trees with an inner open shadow tree]
+    expected: FAIL
+
+  [Firing an event on a node with two ancestors with a detached open and open shadow trees with an inner closed shadow tree]
+    expected: FAIL
+
+  [Firing an event on a node with two ancestors with a detached open and closed shadow trees with an inner open shadow tree]
+    expected: FAIL
+
+  [Firing an event on a node with two ancestors with a detached open and closed shadow trees with an inner closed shadow tree]
+    expected: FAIL
+
+  [Firing an event on a node with two ancestors with a detached closed and open shadow trees with an inner open shadow tree]
+    expected: FAIL
+
+  [Firing an event on a node with two ancestors with a detached closed and open shadow trees with an inner closed shadow tree]
+    expected: FAIL
+
+  [Firing an event on a node with two ancestors with a detached closed and closed shadow trees with an inner open shadow tree]
+    expected: FAIL
+
+  [Firing an event on a node with two ancestors with a detached closed and closed shadow trees with an inner closed shadow tree]
+    expected: FAIL
+
+  [Firing an event on a node within a open shadow tree that is itself a open shadow tree (the latter being the descendent of a host for a separate open shadow tree)]
+    expected: FAIL
+
+  [Firing an event on a node within a closed shadow tree that is itself a open shadow tree (the latter being the descendent of a host for a separate open shadow tree)]
+    expected: FAIL
+
+  [Firing an event on a node within a open shadow tree that is itself a closed shadow tree (the latter being the descendent of a host for a separate open shadow tree)]
+    expected: FAIL
+
+  [Firing an event on a node within a closed shadow tree that is itself a closed shadow tree (the latter being the descendent of a host for a separate open shadow tree)]
+    expected: FAIL
+
+  [Firing an event on a node within a open shadow tree that is itself a open shadow tree (the latter being the descendent of a host for a separate closed shadow tree)]
+    expected: FAIL
+
+  [Firing an event on a node within a closed shadow tree that is itself a open shadow tree (the latter being the descendent of a host for a separate closed shadow tree)]
+    expected: FAIL
+
+  [Firing an event on a node within a open shadow tree that is itself a closed shadow tree (the latter being the descendent of a host for a separate closed shadow tree)]
+    expected: FAIL
+
+  [Firing an event on a node within a closed shadow tree that is itself a closed shadow tree (the latter being the descendent of a host for a separate closed shadow tree)]
+    expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/focus/focus-pseudo-on-shadow-host-2.html.ini b/tests/wpt/meta/shadow-dom/focus/focus-pseudo-on-shadow-host-2.html.ini
index 9a21d90bdf85d..808653f145359 100644
--- a/tests/wpt/meta/shadow-dom/focus/focus-pseudo-on-shadow-host-2.html.ini
+++ b/tests/wpt/meta/shadow-dom/focus/focus-pseudo-on-shadow-host-2.html.ini
@@ -1,2 +1,2 @@
 [focus-pseudo-on-shadow-host-2.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/focus/focus-pseudo-on-shadow-host-3.html.ini b/tests/wpt/meta/shadow-dom/focus/focus-pseudo-on-shadow-host-3.html.ini
deleted file mode 100644
index 35bc21e002e33..0000000000000
--- a/tests/wpt/meta/shadow-dom/focus/focus-pseudo-on-shadow-host-3.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[focus-pseudo-on-shadow-host-3.html]
-  expected: CRASH
diff --git a/tests/wpt/meta/shadow-dom/imperative-slot-api-crash.html.ini b/tests/wpt/meta/shadow-dom/imperative-slot-api-crash.html.ini
deleted file mode 100644
index 194526448ada5..0000000000000
--- a/tests/wpt/meta/shadow-dom/imperative-slot-api-crash.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[imperative-slot-api-crash.html]
-  expected: CRASH
diff --git a/tests/wpt/meta/shadow-dom/imperative-slot-fallback-clear.html.ini b/tests/wpt/meta/shadow-dom/imperative-slot-fallback-clear.html.ini
index a78d00d310356..2fec56352dbb2 100644
--- a/tests/wpt/meta/shadow-dom/imperative-slot-fallback-clear.html.ini
+++ b/tests/wpt/meta/shadow-dom/imperative-slot-fallback-clear.html.ini
@@ -1,2 +1,6 @@
 [imperative-slot-fallback-clear.html]
-  expected: CRASH
+  [Text node fallback should be cleared in a subsequently layout]
+    expected: FAIL
+
+  [Element fallback should be cleared in a subsequent layout]
+    expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/imperative-slot-layout-invalidation-001.html.ini b/tests/wpt/meta/shadow-dom/imperative-slot-layout-invalidation-001.html.ini
index f28e88ceed29a..42aa554151025 100644
--- a/tests/wpt/meta/shadow-dom/imperative-slot-layout-invalidation-001.html.ini
+++ b/tests/wpt/meta/shadow-dom/imperative-slot-layout-invalidation-001.html.ini
@@ -1,2 +1,2 @@
 [imperative-slot-layout-invalidation-001.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/layout-slot-no-longer-assigned.html.ini b/tests/wpt/meta/shadow-dom/layout-slot-no-longer-assigned.html.ini
deleted file mode 100644
index dadc817860cf8..0000000000000
--- a/tests/wpt/meta/shadow-dom/layout-slot-no-longer-assigned.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[layout-slot-no-longer-assigned.html]
-  expected: CRASH
diff --git a/tests/wpt/meta/shadow-dom/layout-slot-no-longer-fallback.html.ini b/tests/wpt/meta/shadow-dom/layout-slot-no-longer-fallback.html.ini
deleted file mode 100644
index da67033986a78..0000000000000
--- a/tests/wpt/meta/shadow-dom/layout-slot-no-longer-fallback.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[layout-slot-no-longer-fallback.html]
-  expected: CRASH
diff --git a/tests/wpt/meta/shadow-dom/slot-fallback-content-001.html.ini b/tests/wpt/meta/shadow-dom/slot-fallback-content-001.html.ini
deleted file mode 100644
index 83f6ae3c10801..0000000000000
--- a/tests/wpt/meta/shadow-dom/slot-fallback-content-001.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[slot-fallback-content-001.html]
-  expected: CRASH
diff --git a/tests/wpt/meta/shadow-dom/slot-fallback-content-002.html.ini b/tests/wpt/meta/shadow-dom/slot-fallback-content-002.html.ini
deleted file mode 100644
index 736c991275c9a..0000000000000
--- a/tests/wpt/meta/shadow-dom/slot-fallback-content-002.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[slot-fallback-content-002.html]
-  expected: CRASH
diff --git a/tests/wpt/meta/shadow-dom/slot-fallback-content-004.html.ini b/tests/wpt/meta/shadow-dom/slot-fallback-content-004.html.ini
index b3b7d494e84b1..c333328c8e7bb 100644
--- a/tests/wpt/meta/shadow-dom/slot-fallback-content-004.html.ini
+++ b/tests/wpt/meta/shadow-dom/slot-fallback-content-004.html.ini
@@ -1,2 +1,2 @@
 [slot-fallback-content-004.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/slot-fallback-content-005.html.ini b/tests/wpt/meta/shadow-dom/slot-fallback-content-005.html.ini
index 3bf06ac5e715f..f3a768eb4900f 100644
--- a/tests/wpt/meta/shadow-dom/slot-fallback-content-005.html.ini
+++ b/tests/wpt/meta/shadow-dom/slot-fallback-content-005.html.ini
@@ -1,2 +1,2 @@
 [slot-fallback-content-005.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/slot-fallback-content-006.html.ini b/tests/wpt/meta/shadow-dom/slot-fallback-content-006.html.ini
index b417a9e4eea0c..8f8567c99f8f7 100644
--- a/tests/wpt/meta/shadow-dom/slot-fallback-content-006.html.ini
+++ b/tests/wpt/meta/shadow-dom/slot-fallback-content-006.html.ini
@@ -1,2 +1,2 @@
 [slot-fallback-content-006.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/slot-fallback-content-007.html.ini b/tests/wpt/meta/shadow-dom/slot-fallback-content-007.html.ini
index 458b7c8fca317..f25986dbaff72 100644
--- a/tests/wpt/meta/shadow-dom/slot-fallback-content-007.html.ini
+++ b/tests/wpt/meta/shadow-dom/slot-fallback-content-007.html.ini
@@ -1,2 +1,2 @@
 [slot-fallback-content-007.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/slot-fallback-content-008.html.ini b/tests/wpt/meta/shadow-dom/slot-fallback-content-008.html.ini
index d6b140847f32b..aaa3b56bdce70 100644
--- a/tests/wpt/meta/shadow-dom/slot-fallback-content-008.html.ini
+++ b/tests/wpt/meta/shadow-dom/slot-fallback-content-008.html.ini
@@ -1,2 +1,2 @@
 [slot-fallback-content-008.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/slotchange-event.html.ini b/tests/wpt/meta/shadow-dom/slotchange-event.html.ini
index e281b12ffee4c..5382cd7110e0f 100644
--- a/tests/wpt/meta/shadow-dom/slotchange-event.html.ini
+++ b/tests/wpt/meta/shadow-dom/slotchange-event.html.ini
@@ -1,2 +1,96 @@
 [slotchange-event.html]
-  expected: CRASH
+  [slotchange event must fire on a default slot element inside an open shadow root  in a document]
+    expected: FAIL
+
+  [slotchange event must fire on a default slot element inside a closed shadow root  in a document]
+    expected: FAIL
+
+  [slotchange event must fire on a default slot element inside an open shadow root  not in a document]
+    expected: FAIL
+
+  [slotchange event must fire on a default slot element inside a closed shadow root  not in a document]
+    expected: FAIL
+
+  [slotchange event must fire on a named slot element insidean open shadow root  in a document]
+    expected: FAIL
+
+  [slotchange event must fire on a named slot element insidea closed shadow root  in a document]
+    expected: FAIL
+
+  [slotchange event must fire on a named slot element insidean open shadow root  not in a document]
+    expected: FAIL
+
+  [slotchange event must fire on a named slot element insidea closed shadow root  not in a document]
+    expected: FAIL
+
+  [slotchange event must not fire on a slot element inside an open shadow root  in a document when another slot's assigned nodes change]
+    expected: FAIL
+
+  [slotchange event must not fire on a slot element inside a closed shadow root  in a document when another slot's assigned nodes change]
+    expected: FAIL
+
+  [slotchange event must not fire on a slot element inside an open shadow root  not in a document when another slot's assigned nodes change]
+    expected: FAIL
+
+  [slotchange event must not fire on a slot element inside a closed shadow root  not in a document when another slot's assigned nodes change]
+    expected: FAIL
+
+  [slotchange event must fire on a slot element when a shadow host has a slottable and the slot was inserted and must not fire when the shadow host was mutated after the slot was removed inside an open shadow root  in a document]
+    expected: FAIL
+
+  [slotchange event must fire on a slot element when a shadow host has a slottable and the slot was inserted and must not fire when the shadow host was mutated after the slot was removed inside a closed shadow root  in a document]
+    expected: FAIL
+
+  [slotchange event must fire on a slot element when a shadow host has a slottable and the slot was inserted and must not fire when the shadow host was mutated after the slot was removed inside an open shadow root  not in a document]
+    expected: FAIL
+
+  [slotchange event must fire on a slot element when a shadow host has a slottable and the slot was inserted and must not fire when the shadow host was mutated after the slot was removed inside a closed shadow root  not in a document]
+    expected: FAIL
+
+  [slotchange event must fire on a slot element inside an open shadow root  in a document even if the slot was removed immediately after the assigned nodes were mutated]
+    expected: FAIL
+
+  [slotchange event must fire on a slot element inside a closed shadow root  in a document even if the slot was removed immediately after the assigned nodes were mutated]
+    expected: FAIL
+
+  [slotchange event must fire on a slot element inside an open shadow root  not in a document even if the slot was removed immediately after the assigned nodes were mutated]
+    expected: FAIL
+
+  [slotchange event must fire on a slot element inside a closed shadow root  not in a document even if the slot was removed immediately after the assigned nodes were mutated]
+    expected: FAIL
+
+  [slotchange event must fire on a slot element inside an open shadow root  in a document when innerHTML modifies the children of the shadow host]
+    expected: FAIL
+
+  [slotchange event must fire on a slot element inside a closed shadow root  in a document when innerHTML modifies the children of the shadow host]
+    expected: FAIL
+
+  [slotchange event must fire on a slot element inside an open shadow root  not in a document when innerHTML modifies the children of the shadow host]
+    expected: FAIL
+
+  [slotchange event must fire on a slot element inside a closed shadow root  not in a document when innerHTML modifies the children of the shadow host]
+    expected: FAIL
+
+  [slotchange event must fire on a slot element inside an open shadow root  in a document when nested slots's contents change]
+    expected: FAIL
+
+  [slotchange event must fire on a slot element inside a closed shadow root  in a document when nested slots's contents change]
+    expected: FAIL
+
+  [slotchange event must fire on a slot element inside an open shadow root  not in a document when nested slots's contents change]
+    expected: FAIL
+
+  [slotchange event must fire on a slot element inside a closed shadow root  not in a document when nested slots's contents change]
+    expected: FAIL
+
+  [slotchange event must fire at the end of current microtask after mutation observers are invoked inside an open shadow root  in a document when slots's contents change]
+    expected: FAIL
+
+  [slotchange event must fire at the end of current microtask after mutation observers are invoked inside a closed shadow root  in a document when slots's contents change]
+    expected: FAIL
+
+  [slotchange event must fire at the end of current microtask after mutation observers are invoked inside an open shadow root  not in a document when slots's contents change]
+    expected: FAIL
+
+  [slotchange event must fire at the end of current microtask after mutation observers are invoked inside a closed shadow root  not in a document when slots's contents change]
+    expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/slots-outside-shadow-dom.html.ini b/tests/wpt/meta/shadow-dom/slots-outside-shadow-dom.html.ini
index 9e4d52a0a95aa..d9a5833db8385 100644
--- a/tests/wpt/meta/shadow-dom/slots-outside-shadow-dom.html.ini
+++ b/tests/wpt/meta/shadow-dom/slots-outside-shadow-dom.html.ini
@@ -1,2 +1,3 @@
 [slots-outside-shadow-dom.html]
-  expected: CRASH
+  [Light DOM slot element should be in flattened assignedNodes]
+    expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/untriaged/elements-and-dom-objects/extensions-to-element-interface/methods/test-002.html.ini b/tests/wpt/meta/shadow-dom/untriaged/elements-and-dom-objects/extensions-to-element-interface/methods/test-002.html.ini
index 978d96e75cf74..410d47668ae35 100644
--- a/tests/wpt/meta/shadow-dom/untriaged/elements-and-dom-objects/extensions-to-element-interface/methods/test-002.html.ini
+++ b/tests/wpt/meta/shadow-dom/untriaged/elements-and-dom-objects/extensions-to-element-interface/methods/test-002.html.ini
@@ -1,2 +1,3 @@
 [test-002.html]
-  expected: CRASH
+  [A_10_02_02_02_T01]
+    expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/untriaged/events/event-retargeting/test-003.html.ini b/tests/wpt/meta/shadow-dom/untriaged/events/event-retargeting/test-003.html.ini
deleted file mode 100644
index a2b0b97e56faa..0000000000000
--- a/tests/wpt/meta/shadow-dom/untriaged/events/event-retargeting/test-003.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[test-003.html]
-  expected: CRASH
diff --git a/tests/wpt/meta/shadow-dom/untriaged/events/retargeting-focus-events/test-001.html.ini b/tests/wpt/meta/shadow-dom/untriaged/events/retargeting-focus-events/test-001.html.ini
deleted file mode 100644
index 7eb350cb16152..0000000000000
--- a/tests/wpt/meta/shadow-dom/untriaged/events/retargeting-focus-events/test-001.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[test-001.html]
-  expected: CRASH
diff --git a/tests/wpt/meta/shadow-dom/untriaged/shadow-trees/reprojection/reprojection-001.html.ini b/tests/wpt/meta/shadow-dom/untriaged/shadow-trees/reprojection/reprojection-001.html.ini
index 93d3406a544c7..e229960af83ef 100644
--- a/tests/wpt/meta/shadow-dom/untriaged/shadow-trees/reprojection/reprojection-001.html.ini
+++ b/tests/wpt/meta/shadow-dom/untriaged/shadow-trees/reprojection/reprojection-001.html.ini
@@ -1,2 +1,2 @@
 [reprojection-001.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/untriaged/shadow-trees/shadow-root-002.html.ini b/tests/wpt/meta/shadow-dom/untriaged/shadow-trees/shadow-root-002.html.ini
index 6f8fed5fe750b..07a6ef6989e07 100644
--- a/tests/wpt/meta/shadow-dom/untriaged/shadow-trees/shadow-root-002.html.ini
+++ b/tests/wpt/meta/shadow-dom/untriaged/shadow-trees/shadow-root-002.html.ini
@@ -1,2 +1,2 @@
 [shadow-root-002.html]
-  expected: CRASH
+  expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/untriaged/styles/test-008.html.ini b/tests/wpt/meta/shadow-dom/untriaged/styles/test-008.html.ini
index 52f3c0eaadace..d758520ec6ccd 100644
--- a/tests/wpt/meta/shadow-dom/untriaged/styles/test-008.html.ini
+++ b/tests/wpt/meta/shadow-dom/untriaged/styles/test-008.html.ini
@@ -1,2 +1,3 @@
 [test-008.html]
-  expected: CRASH
+  [A_06_00_09_T01]
+    expected: FAIL
diff --git a/tests/wpt/meta/shadow-dom/untriaged/user-interaction/ranges-and-selections/test-001.html.ini b/tests/wpt/meta/shadow-dom/untriaged/user-interaction/ranges-and-selections/test-001.html.ini
deleted file mode 100644
index 7eb350cb16152..0000000000000
--- a/tests/wpt/meta/shadow-dom/untriaged/user-interaction/ranges-and-selections/test-001.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[test-001.html]
-  expected: CRASH
diff --git a/tests/wpt/meta/shadow-dom/untriaged/user-interaction/ranges-and-selections/test-002.html.ini b/tests/wpt/meta/shadow-dom/untriaged/user-interaction/ranges-and-selections/test-002.html.ini
index 978d96e75cf74..94e6a0f404aab 100644
--- a/tests/wpt/meta/shadow-dom/untriaged/user-interaction/ranges-and-selections/test-002.html.ini
+++ b/tests/wpt/meta/shadow-dom/untriaged/user-interaction/ranges-and-selections/test-002.html.ini
@@ -1,2 +1,6 @@
 [test-002.html]
-  expected: CRASH
+  [A_07_01_02_T01]
+    expected: FAIL
+
+  [A_07_07_02_T02]
+    expected: FAIL