mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
bindings: Convert certain Exceptions into Promise rejections (#32923)
* Impl promise exception to rejection for methods Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Impl promise exception to rejection for getters Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Impl promise exception to rejection for static methods Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Add tests for exception to rejection Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Expectations Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
fd83281657
commit
f3bec0aed3
11 changed files with 291 additions and 20 deletions
|
@ -1084,6 +1084,29 @@ impl TestBindingMethods for TestBinding {
|
|||
stringMember: Some(s2),
|
||||
}
|
||||
}
|
||||
|
||||
fn MethodThrowToRejectPromise(&self) -> Fallible<Rc<Promise>> {
|
||||
Err(Error::Type("test".to_string()))
|
||||
}
|
||||
|
||||
fn GetGetterThrowToRejectPromise(&self) -> Fallible<Rc<Promise>> {
|
||||
Err(Error::Type("test".to_string()))
|
||||
}
|
||||
|
||||
fn MethodInternalThrowToRejectPromise(&self, _arg: u64) -> Rc<Promise> {
|
||||
unreachable!("Method should already throw")
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
impl TestBinding {
|
||||
pub fn StaticThrowToRejectPromise(_: &GlobalScope) -> Fallible<Rc<Promise>> {
|
||||
Err(Error::Type("test".to_string()))
|
||||
}
|
||||
|
||||
pub fn StaticInternalThrowToRejectPromise(_: &GlobalScope, _arg: u64) -> Rc<Promise> {
|
||||
unreachable!("Method should already throw")
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue