aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2016-09-05 11:53:06 -0400
committerJosh Matthews <josh@joshmatthews.net>2016-09-22 16:16:56 -0400
commitae81ab3972b0a4064046dce8d0c37a2a375fe385 (patch)
tree6cef57fc742cdd9642e65a56b794960e7ba8773b /components/script
parent57b3ccd38cbdf53b8e45f68e8ff6c4fd786118dc (diff)
downloadservo-ae81ab3972b0a4064046dce8d0c37a2a375fe385.tar.gz
servo-ae81ab3972b0a4064046dce8d0c37a2a375fe385.zip
Create meaningful tests for native promise handlers.
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/testbinding.rs8
-rw-r--r--components/script/dom/webidls/TestBinding.webidl2
2 files changed, 10 insertions, 0 deletions
diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs
index 26a79a029ff..c318badc1ba 100644
--- a/components/script/dom/testbinding.rs
+++ b/components/script/dom/testbinding.rs
@@ -660,6 +660,14 @@ impl TestBindingMethods for TestBinding {
Promise::Reject(self.global().r(), cx, v)
}
+ fn PromiseResolveNative(&self, cx: *mut JSContext, p: &Promise, v: HandleValue) {
+ p.maybe_resolve(cx, v);
+ }
+
+ fn PromiseRejectNative(&self, cx: *mut JSContext, p: &Promise, v: HandleValue) {
+ p.maybe_reject(cx, v);
+ }
+
#[allow(unrooted_must_root)]
fn PromiseNativeHandler(&self,
resolve: Option<Rc<SimpleCallback>>,
diff --git a/components/script/dom/webidls/TestBinding.webidl b/components/script/dom/webidls/TestBinding.webidl
index 3ecfaf4cdef..65c68514895 100644
--- a/components/script/dom/webidls/TestBinding.webidl
+++ b/components/script/dom/webidls/TestBinding.webidl
@@ -516,6 +516,8 @@ interface TestBinding {
void acceptPromise(Promise<DOMString> string);
void acceptNullablePromise(Promise<DOMString>? string);
Promise<any> promiseNativeHandler(SimpleCallback? resolve, SimpleCallback? reject);
+ void promiseResolveNative(Promise<any> p, any value);
+ void promiseRejectNative(Promise<any> p, any value);
void panic();
};