Browse Source

Using unstable sort for sorting keys on `to_json()` for GC objects (#833)

pull/840/head
Iban Eguia 4 years ago committed by GitHub
parent
commit
e82dee1ae3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      boa/src/object/gcobject.rs

2
boa/src/object/gcobject.rs

@ -350,7 +350,7 @@ impl GcObject {
Err(interpreter.construct_type_error("cyclic object value")) Err(interpreter.construct_type_error("cyclic object value"))
} else if self.borrow().is_array() { } else if self.borrow().is_array() {
let mut keys: Vec<u32> = self.borrow().index_property_keys().cloned().collect(); let mut keys: Vec<u32> = self.borrow().index_property_keys().cloned().collect();
keys.sort(); keys.sort_unstable();
let mut arr: Vec<JSONValue> = Vec::with_capacity(keys.len()); let mut arr: Vec<JSONValue> = Vec::with_capacity(keys.len());
let this = Value::from(self.clone()); let this = Value::from(self.clone());
for key in keys { for key in keys {

Loading…
Cancel
Save