diff options
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 2 | ||||
-rw-r--r-- | components/script/dom/promise.rs | 16 | ||||
-rw-r--r-- | components/script/dom/testbinding.rs | 4 |
3 files changed, 13 insertions, 9 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 174bda2b0ca..9a98848108b 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -788,7 +788,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None, if !JS_WrapValue(cx, valueToResolve.handle_mut()) { $*{exceptionCode} } - match Promise::Resolve(&promiseGlobal, cx, valueToResolve.handle()) { + match Promise::new_resolved(&promiseGlobal, cx, valueToResolve.handle()) { Ok(value) => value, Err(error) => { throw_dom_exception(cx, &promiseGlobal, error); diff --git a/components/script/dom/promise.rs b/components/script/dom/promise.rs index 5595e999c9d..f850ef10172 100644 --- a/components/script/dom/promise.rs +++ b/components/script/dom/promise.rs @@ -114,9 +114,11 @@ impl Promise { } #[allow(unrooted_must_root, unsafe_code)] - pub fn Resolve(global: &GlobalScope, - cx: *mut JSContext, - value: HandleValue) -> Fallible<Rc<Promise>> { + pub fn new_resolved( + global: &GlobalScope, + cx: *mut JSContext, + value: HandleValue, + ) -> Fallible<Rc<Promise>> { let _ac = JSAutoCompartment::new(cx, global.reflector().get_jsobject().get()); rooted!(in(cx) let p = unsafe { CallOriginalPromiseResolve(cx, value) }); assert!(!p.handle().is_null()); @@ -126,9 +128,11 @@ impl Promise { } #[allow(unrooted_must_root, unsafe_code)] - pub fn Reject(global: &GlobalScope, - cx: *mut JSContext, - value: HandleValue) -> Fallible<Rc<Promise>> { + pub fn new_rejected( + global: &GlobalScope, + cx: *mut JSContext, + value: HandleValue, + ) -> Fallible<Rc<Promise>> { let _ac = JSAutoCompartment::new(cx, global.reflector().get_jsobject().get()); rooted!(in(cx) let p = unsafe { CallOriginalPromiseReject(cx, value) }); assert!(!p.handle().is_null()); diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index 7bdb6e9910c..0403cb56573 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -675,13 +675,13 @@ impl TestBindingMethods for TestBinding { #[allow(unrooted_must_root)] #[allow(unsafe_code)] unsafe fn ReturnResolvedPromise(&self, cx: *mut JSContext, v: HandleValue) -> Fallible<Rc<Promise>> { - Promise::Resolve(&self.global(), cx, v) + Promise::new_resolved(&self.global(), cx, v) } #[allow(unrooted_must_root)] #[allow(unsafe_code)] unsafe fn ReturnRejectedPromise(&self, cx: *mut JSContext, v: HandleValue) -> Fallible<Rc<Promise>> { - Promise::Reject(&self.global(), cx, v) + Promise::new_rejected(&self.global(), cx, v) } #[allow(unsafe_code)] |