blob: 81a451b7c5653556483e44bd03187c24ca0345a4 (
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
28
29
30
31
32
33
34
35
36
|
// |jit-test| --disable-property-error-message-fix
function check(f, message) {
let caught = false;
try {
f();
} catch (e) {
assertEq(e.message, message);
caught = true;
}
assertEq(caught, true);
}
check(() => {
let obj = {
prop: undefined
};
obj.prop.prop2();
}, "obj.prop is undefined");
check(() => {
let obj = {
prop: null
};
obj.prop.prop2();
}, "obj.prop is null");
check(() => {
let prop = "prop";
undefined[prop]();
}, "undefined has no properties");
check(() => {
let prop = "prop";
null[prop]();
}, "null has no properties");
|