chromium/third_party/blink/web_tests/shadow-dom/crashes/cyclic-detach-crash2.html

<!doctype html>
<script src='../../resources/testharness.js'></script>
<script src='../../resources/testharnessreport.js'></script>
<div id="div1"><div id="div2"></div></div>
<script>
test(() => {
  const div1 = document.getElementById('div1');
  const div2 = document.getElementById('div2');
  // slot1 (#div2 is assigned)
  div1.attachShadow({mode: 'open'}).innerHTML='<slot></slot>';
  // slot2
  div2.attachShadow({mode: 'open'}).innerHTML='<slot></slot>';

  document.body.offsetTop;
  // All shadow roots' assignment recalc flags are clean.
  div1.remove();
  const span = document.createElement('span');
  // #div2's shadow root's assignment recalc flag becomes dirty.
  div2.appendChild(span);
  // #div1's shadow root's assignment recalc flag becomes dirty.
  document.body.appendChild(div2);
  // slot2's assignment is recalculated.
  document.body.offsetTop;
  span.appendChild(div1);
  // #div1's shadow root's assignment recalc flag is still dirty.
  span.remove();
}, "crbug.com/847056. Cyclic detach should not happen.");
</script>