From b4f48c561b4ef68b7d4d157db9a2ee62ace56e7a Mon Sep 17 00:00:00 2001 From: Kingsley Yung Date: Sun, 16 Feb 2025 05:29:34 +0800 Subject: script: Take away Fallible from new_resolved and new_rejected (#35473) * script: Take away Fallible from new_resolved and new_rejected Both Promise::new_resolved and new_rejected only return `Ok`. We don't need them to be fallible. Simply return `Rc`, instead of `Fallible>`. Also, clean up relevant code. Signed-off-by: Kingsley Yung * script: pull_algorithm becomes infallible The method pull_algorithm only returns `Some(Ok(_))`, which means it is infallible. Clean up the returned type. Signed-off-by: Kingsley Yung * script: generic_initialize becomes infallible The method generic_initialize only returns `Ok(())`, which means it is infallible. Clean up the returned type. Signed-off-by: Kingsley Yung --------- Signed-off-by: Kingsley Yung --- components/script_bindings/codegen/CodegenRust.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'components/script_bindings/codegen/CodegenRust.py') diff --git a/components/script_bindings/codegen/CodegenRust.py b/components/script_bindings/codegen/CodegenRust.py index 713291686af..61aa4b3d333 100644 --- a/components/script_bindings/codegen/CodegenRust.py +++ b/components/script_bindings/codegen/CodegenRust.py @@ -807,13 +807,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None, if !JS_WrapValue(*cx, valueToResolve.handle_mut()) { $*{exceptionCode} } - match Promise::new_resolved(&promiseGlobal, cx, valueToResolve.handle()) { - Ok(value) => value, - Err(error) => { - throw_dom_exception(cx, &promiseGlobal, error); - $*{exceptionCode} - } - } + Promise::new_resolved(&promiseGlobal, cx, valueToResolve.handle()) } """, exceptionCode=exceptionCode) -- cgit v1.2.3