Conform to ECMAScript 2019 by making the sort stable
@@ -352,7 +352,7 @@ func (r *Runtime) arrayproto_sort(call FunctionCall) Value {
compare: compareFn,
}
- sort.Sort(&ctx)
+ sort.Stable(&ctx)
return o
@@ -973,7 +973,7 @@ func (r *Runtime) typedArrayProto_sort(call FunctionCall) Value {
return call.This
panic(r.NewTypeError("Method TypedArray.prototype.sort called on incompatible receiver %s", call.This.String()))