blob: 87fe29a55fa302d0127bb3e04eb734a029ec8bc4 [file] [edit]
function assert(x) {
if (!x)
throw new Error("Bad assertion!");
}
globalThis.a = 1;
globalThis.b = 2;
Object.preventExtensions(globalThis);
let didThrow = false;
try {
$262.evalScript(`
function a() {}
function b() {}
var c = 3;
`);
} catch (err) {
didThrow = true;
assert(err.toString() === "TypeError: Can't declare global variable 'c': global object must be extensible");
}
assert(didThrow);
assert(a === 1);
assert(b === 2);