From c4d3df803e5ba5877f78634a2c12f2aff46903c0 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 --- lib/internal/domexception.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/internal/domexception.js b/lib/internal/domexception.js index fe371e099eb17f..bf6ae50f56192a 100644 --- a/lib/internal/domexception.js +++ b/lib/internal/domexception.js @@ -43,6 +43,12 @@ class DOMException extends Error { } } +Object.defineProperties(DOMException.prototype, { + name: { enumerable: true, configurable: true }, + message: { enumerable: true, configurable: true }, + code: { enumerable: true, configurable: true } +}); + for (const [name, codeName, value] of [ ['IndexSizeError', 'INDEX_SIZE_ERR', 1], ['DOMStringSizeError', 'DOMSTRING_SIZE_ERR', 2],