Index: test/mjsunit/array-sort.js |
diff --git a/test/mjsunit/array-sort.js b/test/mjsunit/array-sort.js |
index fdd2333d7c8a1332e2ae7b5d6667218037c62993..ddfeffe4a20b98583f08f97b5ca09ddcc3631c13 100644 |
--- a/test/mjsunit/array-sort.js |
+++ b/test/mjsunit/array-sort.js |
@@ -480,6 +480,29 @@ function TestSortOnProxy() { |
} |
TestSortOnProxy(); |
+function TestSortOnNonExtensible() { |
+ { |
+ var arr = [1,,2]; |
+ Object.preventExtensions(arr); |
+ assertThrows(() => arr.sort(), TypeError); |
+ assertEquals(arr, [1,,2]); |
+ } |
+ { |
+ var arr = [1,,undefined]; |
+ Object.preventExtensions(arr); |
+ assertThrows(() => arr.sort(), TypeError); |
+ assertFalse(arr.hasOwnProperty(1)); |
+ assertEquals(arr, [1,,undefined]); |
+ } |
+ { |
+ var arr = [1,undefined,2]; |
+ Object.preventExtensions(arr); |
+ arr.sort(); |
+ assertEquals(arr, [1,2,undefined]); |
+ } |
+} |
+TestSortOnNonExtensible(); |
+ |
// Test special prototypes |
(function testSortSpecialPrototypes() { |