summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/property-error-message-fix-disabled.js
blob: a011605ed914d6967fe521431f3dc7a120edbbdc (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| --setpref=property_error_message_fix=false; 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");