mirror of
https://github.com/nodejs/node.git
synced 2025-05-21 18:59:08 +00:00

PR-URL: https://github.com/nodejs/node/pull/29694 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
60 lines
1.3 KiB
JavaScript
60 lines
1.3 KiB
JavaScript
// Copyright 2019 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// Flags: --allow-natives-syntax
|
|
|
|
function mainFreeze() {
|
|
const v2 = {foo:1.1};
|
|
Object.freeze(v2);
|
|
const v12 = {foo:2.2};
|
|
Object.preventExtensions(v12);
|
|
Object.freeze(v12);
|
|
const v18 = {foo:Object};
|
|
v12.__proto__ = 0;
|
|
v2[5] = 1;
|
|
}
|
|
mainFreeze();
|
|
|
|
function mainSeal() {
|
|
const v2 = {foo:1.1};
|
|
Object.seal(v2);
|
|
const v12 = {foo:2.2};
|
|
Object.preventExtensions(v12);
|
|
Object.seal(v12);
|
|
const v18 = {foo:Object};
|
|
v12.__proto__ = 0;
|
|
v2[5] = 1;
|
|
}
|
|
mainSeal();
|
|
|
|
function testSeal() {
|
|
a = new RangeError(null, null, null);
|
|
a.toFixed = () => {};
|
|
e = Object.seal(a);
|
|
a = new RangeError(null, null, null);
|
|
a.toFixed = () => {};
|
|
k = Object.preventExtensions(a);
|
|
l = Object.seal(a);
|
|
a.toFixed = () => {};
|
|
assertThrows(() => {
|
|
Array.prototype.unshift.call(l, false, Infinity);
|
|
}, TypeError);
|
|
}
|
|
testSeal();
|
|
|
|
function testFreeze() {
|
|
a = new RangeError(null, null, null);
|
|
a.toFixed = () => {};
|
|
e = Object.freeze(a);
|
|
a = new RangeError(null, null, null);
|
|
a.toFixed = () => {};
|
|
k = Object.preventExtensions(a);
|
|
l = Object.freeze(a);
|
|
a.toFixed = () => {};
|
|
assertThrows(() => {
|
|
Array.prototype.unshift.call(l, false, Infinity);
|
|
}, TypeError);
|
|
}
|
|
testFreeze();
|