summaryrefslogtreecommitdiffstats
path: root/src/civetweb/src/third_party/duktape-1.5.2/polyfills/duktape-error-setter-nonwritable.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/civetweb/src/third_party/duktape-1.5.2/polyfills/duktape-error-setter-nonwritable.js
parentInitial commit. (diff)
downloadceph-upstream.tar.xz
ceph-upstream.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/civetweb/src/third_party/duktape-1.5.2/polyfills/duktape-error-setter-nonwritable.js')
-rw-r--r--src/civetweb/src/third_party/duktape-1.5.2/polyfills/duktape-error-setter-nonwritable.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/civetweb/src/third_party/duktape-1.5.2/polyfills/duktape-error-setter-nonwritable.js b/src/civetweb/src/third_party/duktape-1.5.2/polyfills/duktape-error-setter-nonwritable.js
new file mode 100644
index 00000000..236c706b
--- /dev/null
+++ b/src/civetweb/src/third_party/duktape-1.5.2/polyfills/duktape-error-setter-nonwritable.js
@@ -0,0 +1,20 @@
+/*
+ * 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 }
+ });
+})();