blob: 3cd296f4b99edd63de0e97b2b14b3ab92b1a36ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// If obj[@@unscopables][id], then `delete id` works across `with (obj)` scope.
this.niche = 7;
let obj = { niche: 8, [Symbol.unscopables]: { niche: true } };
with (obj) {
delete niche;
}
assertEq(obj.niche, 8);
assertEq("niche" in this, false);
// Same thing, but delete a variable introduced by sloppy direct eval.
this.niche = 9;
function f() {
eval("var niche = 10;");
with (obj) {
assertEq(niche, 10);
delete niche;
}
assertEq(niche, 9);
}
// Of course none of this affects a qualified delete.
assertEq(delete this.niche, true);
assertEq("niche" in this, false);
reportCompare(0, 0);
|