Make RPC lists non-extensible
Assigning to non-existent index will throw an exception and all tests pass in Chrome!
This commit is contained in:
parent
85e2a26b42
commit
f2c4e7882a
|
@ -18,5 +18,10 @@ util.createMethods(List.prototype, constants.propTypes.LIST, [
|
||||||
], true);
|
], true);
|
||||||
|
|
||||||
function create(realmId, info) {
|
function create(realmId, info) {
|
||||||
return util.createList(List.prototype, realmId, info, true);
|
let meta = util.createList(List.prototype, realmId, info, true);
|
||||||
|
let list = Object.create(meta);
|
||||||
|
|
||||||
|
Object.preventExtensions(list);
|
||||||
|
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ function createList(prototype, realmId, info, mutable) {
|
||||||
|
|
||||||
list[keys.resize] = function(length) {
|
list[keys.resize] = function(length) {
|
||||||
if (length == null) {
|
if (length == null) {
|
||||||
length = this.length;
|
length = list.length;
|
||||||
}
|
}
|
||||||
if (length == size) {
|
if (length == size) {
|
||||||
return;
|
return;
|
||||||
|
@ -39,11 +39,11 @@ function createList(prototype, realmId, info, mutable) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.defineProperties(this, props);
|
Object.defineProperties(list, props);
|
||||||
}
|
}
|
||||||
else if (length < size) {
|
else if (length < size) {
|
||||||
for (let i = size - 1; i >= length; i--) {
|
for (let i = size - 1; i >= length; i--) {
|
||||||
delete this[i];
|
delete list[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue