script: Add message to Dom exception Error::NotSupported (#40745)

Adding an optional message to Error::NotSupported. Unblocks
https://github.com/servo/servo/issues/39050.

The enum definition of NotSupported is now
`NotSupported(Option<String>)`.

Testing: Just a refactor
Fixes: Partially https://github.com/servo/servo/issues/39053

Signed-off-by: Dennis Kraus <kraus@posteo.de>
This commit is contained in:
d-kraus
2025-11-20 01:31:33 +00:00
committed by GitHub
parent aa1331c1fa
commit adf840a7c4
38 changed files with 138 additions and 135 deletions

View File

@@ -5054,7 +5054,7 @@ impl DocumentMethods<crate::DomTypeHolder> for Document {
) -> Fallible<DomRoot<CDATASection>> {
// Step 1
if self.is_html_document {
return Err(Error::NotSupported);
return Err(Error::NotSupported(None));
}
// Step 2
@@ -5096,7 +5096,7 @@ impl DocumentMethods<crate::DomTypeHolder> for Document {
fn ImportNode(&self, node: &Node, deep: bool, can_gc: CanGc) -> Fallible<DomRoot<Node>> {
// Step 1.
if node.is::<Document>() || node.is::<ShadowRoot>() {
return Err(Error::NotSupported);
return Err(Error::NotSupported(None));
}
// Step 2.
@@ -5113,7 +5113,7 @@ impl DocumentMethods<crate::DomTypeHolder> for Document {
fn AdoptNode(&self, node: &Node, can_gc: CanGc) -> Fallible<DomRoot<Node>> {
// Step 1.
if node.is::<Document>() {
return Err(Error::NotSupported);
return Err(Error::NotSupported(None));
}
// Step 2.
@@ -5184,7 +5184,7 @@ impl DocumentMethods<crate::DomTypeHolder> for Document {
&self.window,
can_gc,
))),
_ => Err(Error::NotSupported),
_ => Err(Error::NotSupported(None)),
}
}