mirror of
https://github.com/servo/servo.git
synced 2025-07-13 10:23:40 +01:00
Fail to construct if promise is none
This commit is contained in:
parent
19b4f35de1
commit
202d747035
1 changed files with 6 additions and 2 deletions
|
@ -5,7 +5,7 @@
|
||||||
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::PromiseRejectionEventBinding;
|
use crate::dom::bindings::codegen::Bindings::PromiseRejectionEventBinding;
|
||||||
use crate::dom::bindings::codegen::Bindings::PromiseRejectionEventBinding::PromiseRejectionEventMethods;
|
use crate::dom::bindings::codegen::Bindings::PromiseRejectionEventBinding::PromiseRejectionEventMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
|
@ -73,7 +73,11 @@ impl PromiseRejectionEvent {
|
||||||
let reason = init.reason.handle();
|
let reason = init.reason.handle();
|
||||||
let promise = match init.promise.as_ref() {
|
let promise = match init.promise.as_ref() {
|
||||||
Some(promise) => promise.clone(),
|
Some(promise) => promise.clone(),
|
||||||
None => Promise::new(global),
|
None => {
|
||||||
|
return Err(Error::Type(
|
||||||
|
"required member promise is undefined.".to_string(),
|
||||||
|
))
|
||||||
|
},
|
||||||
};
|
};
|
||||||
let bubbles = EventBubbles::from(init.parent.bubbles);
|
let bubbles = EventBubbles::from(init.parent.bubbles);
|
||||||
let cancelable = EventCancelable::from(init.parent.cancelable);
|
let cancelable = EventCancelable::from(init.parent.cancelable);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue