michael@0: // Test that you can't call the SavedFrame constructor and can only use michael@0: // SavedFrame's getters on SavedFrame instances. michael@0: michael@0: load(libdir + "asserts.js"); michael@0: michael@0: let proto = Object.getPrototypeOf(saveStack()); michael@0: michael@0: // Can't create new SavedFrame instances by hand. michael@0: assertThrowsInstanceOf(() => { michael@0: new proto.constructor(); michael@0: }, TypeError); michael@0: michael@0: for (let p of ["source", "line", "column", "functionDisplayName", "parent"]) { michael@0: // The getters shouldn't work on the prototype. michael@0: assertThrowsInstanceOf(() => proto[p], TypeError); michael@0: michael@0: // Nor should they work on random objects. michael@0: let o = {}; michael@0: Object.defineProperty(o, p, Object.getOwnPropertyDescriptor(proto, p)); michael@0: assertThrowsInstanceOf(() => o[p], TypeError); michael@0: }