js/src/jit-test/tests/saved-stacks/getters-on-invalid-objects.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:2fa6fcc93d41
1 // Test that you can't call the SavedFrame constructor and can only use
2 // SavedFrame's getters on SavedFrame instances.
3
4 load(libdir + "asserts.js");
5
6 let proto = Object.getPrototypeOf(saveStack());
7
8 // Can't create new SavedFrame instances by hand.
9 assertThrowsInstanceOf(() => {
10 new proto.constructor();
11 }, TypeError);
12
13 for (let p of ["source", "line", "column", "functionDisplayName", "parent"]) {
14 // The getters shouldn't work on the prototype.
15 assertThrowsInstanceOf(() => proto[p], TypeError);
16
17 // Nor should they work on random objects.
18 let o = {};
19 Object.defineProperty(o, p, Object.getOwnPropertyDescriptor(proto, p));
20 assertThrowsInstanceOf(() => o[p], TypeError);
21 }

mercurial