Index: src/array.js |
diff --git a/src/array.js b/src/array.js |
index 309871f6f95a7811537d1be6132e6afe7fea1be3..69f0910cee58b4ec09545a59fc941c8d4382fd9f 100644 |
--- a/src/array.js |
+++ b/src/array.js |
@@ -1176,8 +1176,9 @@ function InnerArraySort(length, comparefn) { |
function ArraySort(comparefn) { |
CHECK_OBJECT_COERCIBLE(this, "Array.prototype.sort"); |
- var length = TO_UINT32(this.length); |
- return %_CallFunction(this, length, comparefn, InnerArraySort); |
+ var array = $toObject(this); |
+ var length = TO_UINT32(array.length); |
+ return %_CallFunction(array, length, comparefn, InnerArraySort); |
} |