diff options
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 11 | ||||
-rw-r--r-- | components/util/non_geckolib.rs | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index db60cd55459..2a04db77cc9 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -700,7 +700,16 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None, raise TypeError("Can't handle array arguments yet") if type.isSequence(): - raise TypeError("Can't handle sequence arguments yet") + # Use the same type that for return values + declType = getRetvalDeclarationForType(type, descriptorProvider) + config = getConversionConfigForType(type, isEnforceRange, isClamp, treatNullAs) + + templateBody = ("match FromJSValConvertible::from_jsval(cx, ${val}, %s) {\n" + " Ok(value) => value,\n" + " Err(()) => { %s },\n" + "}" % (config, exceptionCode)) + + return handleOptional(templateBody, declType, handleDefaultNull("None")) if type.isUnion(): declType = CGGeneric(union_native_type(type)) diff --git a/components/util/non_geckolib.rs b/components/util/non_geckolib.rs index f7e6fc401da..cb047a0ec18 100644 --- a/components/util/non_geckolib.rs +++ b/components/util/non_geckolib.rs @@ -25,7 +25,7 @@ use std::slice; use str::DOMString; /// Behavior for stringification of `JSVal`s. -#[derive(PartialEq)] +#[derive(PartialEq, Clone)] pub enum StringificationBehavior { /// Convert `null` to the string `"null"`. Default, |