mirror of
https://github.com/servo/servo.git
synced 2025-07-02 21:13:39 +01:00
Auto merge of #23530 - gatoWololo:omar_update_CustomElementConstructor_type, r=cybai,jdm
Use TypeError instead of InvalidState for exception. <!-- Please describe your changes on the following line: --> Use TypeError instead of InvalidState as per https://github.com/whatwg/html/pull/4525 for making CustomElementConstructor exceptions more consistent. <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #23202 (GitHub issue number if applicable) <!-- Either: --> - [X] There are tests for these changes: Tests that expected failure now expect passing with correct result. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23530) <!-- Reviewable:end -->
This commit is contained in:
commit
d72cd4df20
5 changed files with 10 additions and 29 deletions
|
@ -182,7 +182,12 @@ where
|
|||
DomRoot::downcast(element).ok_or(Error::InvalidState)
|
||||
},
|
||||
// Step 10
|
||||
Some(ConstructionStackEntry::AlreadyConstructedMarker) => Err(Error::InvalidState),
|
||||
Some(ConstructionStackEntry::AlreadyConstructedMarker) => {
|
||||
let s = "Top of construction stack marked AlreadyConstructed due to \
|
||||
a custom element constructor constructing itself after super()"
|
||||
.to_string();
|
||||
Err(Error::Type(s))
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -680,7 +680,9 @@ fn run_upgrade_constructor(
|
|||
return Err(Error::JSFailed);
|
||||
}
|
||||
if !same {
|
||||
return Err(Error::InvalidState);
|
||||
return Err(Error::Type(
|
||||
"Returned element is not SameValue as the upgraded element".to_string(),
|
||||
));
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
|
|
@ -13,7 +13,7 @@ interface CustomElementRegistry {
|
|||
Promise<void> whenDefined(DOMString name);
|
||||
};
|
||||
|
||||
callback CustomElementConstructor = any();
|
||||
callback CustomElementConstructor = HTMLElement();
|
||||
|
||||
dictionary ElementDefinitionOptions {
|
||||
DOMString extends;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue