mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Auto merge of #22170 - CYBAI:fix-promiserejectevent, r=jdm
Fix PromiseRejectionEvent constructor when promise argument is None Due to lack of `required` of the `promise` argument in webidl, we need to handle this so that it can be correct behavior. And then the constructor test will be passed! --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] There are tests for these changes <!-- 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/22170) <!-- Reviewable:end -->
This commit is contained in:
commit
369983211d
2 changed files with 6 additions and 7 deletions
|
@ -5,7 +5,7 @@
|
|||
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
||||
use crate::dom::bindings::codegen::Bindings::PromiseRejectionEventBinding;
|
||||
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::reflector::reflect_dom_object;
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
|
@ -73,7 +73,11 @@ impl PromiseRejectionEvent {
|
|||
let reason = init.reason.handle();
|
||||
let promise = match init.promise.as_ref() {
|
||||
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 cancelable = EventCancelable::from(init.parent.cancelable);
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
[promise-rejection-event-constructor.html]
|
||||
type: testharness
|
||||
[This tests the constructor for the PromiseRejectionEvent DOM class.]
|
||||
expected: FAIL
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue