Bug 1871195 [wpt PR 43765] - Disallow invalid node types in DOM Parts API constructor...
commit35c787259f37f9683f9e07d8eeef91136531228e
authorMason Freed <masonf@chromium.org>
Fri, 5 Jan 2024 17:10:43 +0000 (5 17:10 +0000)
committermoz-wptsync-bot <wptsync@mozilla.com>
Sat, 6 Jan 2024 03:57:20 +0000 (6 03:57 +0000)
tree93b536e7bdba7041115ea5bb10bc18107591a8ff
parent10d51fb29a9f76bf5dfcbf794d80b29236ed66a5
Bug 1871195 [wpt PR 43765] - Disallow invalid node types in DOM Parts API constructors, a=testonly

Automatic update from web-platform-tests
Disallow invalid node types in DOM Parts API constructors

It was previously possible to construct, e.g., a ChildNodePart with
previousSibling and nextSibling being the DOCTYPE element and the
documentElement. That causes problems when trying to clone that part,
because the CloneParts code tries to cast the ChildNodePart to a
DocumentPart, which it isn't.

This CL also adds more testing for this set of cases, and sets a few
more of the `DCHECK`s to `CHECK`s. This might be a performance hit on
the perf tests, but I think it's worth it.

Fixed: 1510578
Change-Id: Ie18901857a4b089265185c3efdabfb5448da2e46
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5142457
Commit-Queue: Dan Clark <daniec@microsoft.com>
Auto-Submit: Mason Freed <masonf@chromium.org>
Reviewed-by: Dan Clark <daniec@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1240329}

--

wpt-commits: c3818b1575fe844e2e70307e91165bf9e78c963b
wpt-pr: 43765
testing/web-platform/tests/dom/parts/basic-dom-part-objects.tentative.html
testing/web-platform/tests/dom/parts/dom-parts-valid-node-types.tentative.html [new file with mode: 0644]