mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1260673 - Stop using _DefineDataProperty in MoveHoles; r=jorendorff
_DefineDataProperty was used to ensure that modifying Array's setter wouldn't impact sorting, however, this is both not necessary and against the spec. --HG-- extra : rebase_source : f7d1301abf3207e2091f4c1e3b7e3949c0961ec8
This commit is contained in:
parent
c6555da9ca
commit
c5fa3b7151
@ -220,7 +220,7 @@ function Merge(list, start, mid, end, lBuffer, rBuffer, comparefn) {
|
||||
// dense array, filling remaining slots with holes.
|
||||
function MoveHoles(sparse, sparseLen, dense, denseLen) {
|
||||
for (var i = 0; i < denseLen; i++)
|
||||
_DefineDataProperty(sparse, i, dense[i]);
|
||||
sparse[i] = dense[i];
|
||||
for (var j = denseLen; j < sparseLen; j++)
|
||||
delete sparse[j];
|
||||
}
|
||||
|
@ -54,19 +54,5 @@ assertDeepEq(oneHole[0], {size: 27});
|
||||
assertEq(oneHole.length, 2600);
|
||||
assertEq(denseCount(oneHole), 1);
|
||||
|
||||
// Ensure that the array setter is touch touched during sorting.
|
||||
|
||||
Object.defineProperty(Array.prototype, "0", {
|
||||
set: (value) => {throw "Illegally touched the array's setter!"},
|
||||
configurable: true
|
||||
});
|
||||
|
||||
assertThrows(() => {o[1] = 11;});
|
||||
|
||||
let o = [,,,,,,,,,,,,,,,,,,,,{size: 1},{size: 2}];
|
||||
o.sort((a, b) => {+a.size - +b.size});
|
||||
|
||||
delete Array.prototype["0"];
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user