From 81ef87b7f9028c21d7d3adadfdd0e6da4bf844e9 Mon Sep 17 00:00:00 2001 From: 0x7D2B <72297086+0x7D2B@users.noreply.github.com> Date: Wed, 26 May 2021 11:50:14 +0000 Subject: [PATCH] Fix GcObject to_json mutable borrow panic (#1284) --- boa/src/object/gcobject.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/boa/src/object/gcobject.rs b/boa/src/object/gcobject.rs index 5a7a0d05876..9973fa030b0 100644 --- a/boa/src/object/gcobject.rs +++ b/boa/src/object/gcobject.rs @@ -412,7 +412,8 @@ impl GcObject { } else { let mut new_obj = Map::new(); let this = Value::from(self.clone()); - for k in self.borrow().keys() { + let keys: Vec = self.borrow().keys().collect(); + for k in keys { let key = k.clone(); let value = this.get_field(k.to_string(), context)?; if let Some(value) = value.to_json(context)? {