mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
573 B
21 lines
573 B
9 years ago
|
/*
|
||
|
* Ensure Error .fileName, .lineNumber, and .stack are not directly writable,
|
||
|
* but can be written using Object.defineProperty(). This matches Duktape
|
||
|
* 1.3.0 and prior.
|
||
|
*
|
||
|
* See: https://github.com/svaarala/duktape/pull/390.
|
||
|
*/
|
||
|
|
||
|
(function () {
|
||
|
var err = new Error('test');
|
||
|
err.fileName = 999;
|
||
|
if (err.fileName !== 999) { return; } // already non-writable
|
||
|
|
||
|
var fn = new Function(''); // nop
|
||
|
Object.defineProperties(Error.prototype, {
|
||
|
fileName: { set: fn },
|
||
|
lineNumber: { set: fn },
|
||
|
stack: { set: fn }
|
||
|
});
|
||
|
})();
|