1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:37:43 +00:00

LibWeb: Fix some FIXMEs related to ExceptionOr<T>

This fixes a few FIXMEs mentioned in 5beacf08a2,
which depended on #6075 being fixed.
This commit is contained in:
AnotherTest 2021-04-13 23:03:48 +04:30 committed by Andreas Kling
parent 8ba2b5f36f
commit 9c201767a0
4 changed files with 16 additions and 24 deletions

View file

@ -743,17 +743,13 @@ void Document::adopt_node(Node& node)
}
// https://dom.spec.whatwg.org/#dom-document-adoptnode
NonnullRefPtr<Node> Document::adopt_node_binding(NonnullRefPtr<Node> node)
ExceptionOr<NonnullRefPtr<Node>> Document::adopt_node_binding(NonnullRefPtr<Node> node)
{
if (is<Document>(*node)) {
dbgln("Document::adopt_node_binding: Cannot adopt a document into a document (FIXME: throw as NotSupportedError exception, see issue #6075");
return node;
}
if (is<Document>(*node))
return DOM ::NotSupportedError::create("Cannot adopt a document into a document");
if (is<ShadowRoot>(*node)) {
dbgln("Document::adopt_node_binding: Cannot adopt a shadow root into a document (FIXME: throw as HierarchyRequestError exception, see issue #6075");
return node;
}
if (is<ShadowRoot>(*node))
return DOM::HierarchyRequestError::create("Cannot adopt a shadow root into a document");
if (is<DocumentFragment>(*node) && downcast<DocumentFragment>(*node).host())
return node;