Skip to content

Commit

Permalink
lib: make DOMException attributes configurable and enumerable
Browse files Browse the repository at this point in the history
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
  • Loading branch information
joyeecheung committed Sep 16, 2018
1 parent 90c9368 commit c4d3df8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/internal/domexception.js
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit c4d3df8

Please sign in to comment.