mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Add a simple API to reject promises with DOM error values.
This commit is contained in:
parent
ae81ab3972
commit
27d44c8d10
5 changed files with 35 additions and 2 deletions
|
@ -20,7 +20,7 @@ use dom::bindings::codegen::UnionTypes::{EventOrUSVString, HTMLElementOrLong, Lo
|
|||
use dom::bindings::codegen::UnionTypes::{HTMLElementOrUnsignedLongOrStringOrBoolean, LongSequenceOrBoolean};
|
||||
use dom::bindings::codegen::UnionTypes::{StringOrLongSequence, StringOrStringSequence, StringSequenceOrUnsignedLong};
|
||||
use dom::bindings::codegen::UnionTypes::{StringOrUnsignedLong, StringOrBoolean, UnsignedLongOrBoolean};
|
||||
use dom::bindings::error::Fallible;
|
||||
use dom::bindings::error::{Error, Fallible};
|
||||
use dom::bindings::global::{GlobalRef, global_root_from_context};
|
||||
use dom::bindings::js::Root;
|
||||
use dom::bindings::mozmap::MozMap;
|
||||
|
@ -668,6 +668,10 @@ impl TestBindingMethods for TestBinding {
|
|||
p.maybe_reject(cx, v);
|
||||
}
|
||||
|
||||
fn PromiseRejectWithTypeError(&self, p: &Promise, s: USVString) {
|
||||
p.maybe_reject_error(self.global().r().get_cx(), Error::Type(s.0));
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
fn PromiseNativeHandler(&self,
|
||||
resolve: Option<Rc<SimpleCallback>>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue