From 0140a98e055f592f504adae9e44ddf8a0b6f6085 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Mon, 27 Aug 2018 17:00:54 +0800 Subject: [PATCH] lib: make DOMException attributes configurable and enumerable The `name`, `message` and `code` attributes of the DOMException interface should be enumerable and configurable. Aligning the definition with the Web allows us to use it when running the Web Platform Tests. Refs: https://heycam.github.io/webidl/#idl-DOMException PR-URL: https://github.com/nodejs/node/pull/22550 Refs: https://github.com/web-platform-tests/wpt/commit/125950d10a346482075c55d27f61a1021ca68d68 Reviewed-By: Gus Caplan Reviewed-By: Anna Henningsen Reviewed-By: Tiancheng "Timothy" Gu Reviewed-By: Ruben Bridgewater Reviewed-By: John-David Dalton Reviewed-By: James M Snell --- lib/internal/domexception.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/internal/domexception.js b/lib/internal/domexception.js index bd2ad958ae4c1b..586d954dc4912b 100644 --- a/lib/internal/domexception.js +++ b/lib/internal/domexception.js @@ -44,7 +44,10 @@ class DOMException extends Error { } Object.defineProperties(DOMException.prototype, { - [Symbol.toStringTag]: { configurable: true, value: 'DOMException' } + [Symbol.toStringTag]: { configurable: true, value: 'DOMException' }, + name: { enumerable: true, configurable: true }, + message: { enumerable: true, configurable: true }, + code: { enumerable: true, configurable: true } }); for (const [name, codeName, value] of [