Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 // Test that you can't call the SavedFrame constructor and can only use
2 // SavedFrame's getters on SavedFrame instances.
4 load(libdir + "asserts.js");
6 let proto = Object.getPrototypeOf(saveStack());
8 // Can't create new SavedFrame instances by hand.
9 assertThrowsInstanceOf(() => {
10 new proto.constructor();
11 }, TypeError);
13 for (let p of ["source", "line", "column", "functionDisplayName", "parent"]) {
14 // The getters shouldn't work on the prototype.
15 assertThrowsInstanceOf(() => proto[p], TypeError);
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 }