blob: 542bada65f40edf4e080fc7ff616a101028001f7 (
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; skip-if: getBuildConfiguration('pbl')
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");
|