From f40d7bb816fe010155be0df63456178088f4657e Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 19 Sep 2016 15:15:50 +0200 Subject: [PATCH] Return a ConversionResult::Failure when converting a non-iterable value to Vec. --- mozjs/js/rust/src/conversions.rs | 6 +++++- mozjs/js/rust/tests/vec_conversion.rs | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/mozjs/js/rust/src/conversions.rs b/mozjs/js/rust/src/conversions.rs index 61f82c8bfda..0ce0c03caba 100644 --- a/mozjs/js/rust/src/conversions.rs +++ b/mozjs/js/rust/src/conversions.rs @@ -580,10 +580,14 @@ impl> FromJSValConvertible for Vec::from_jsval(cx, rval.handle(), + ConversionBehavior::Default); + assert!(match converted { + Ok(ConversionResult::Failure(_)) => true, + _ => false, + }); } }