Skip to content

Commit d342ccd

Browse files
committed
review
1 parent 4102de9 commit d342ccd

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/internal/per_context/domexception.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const {
44
Error,
55
ErrorPrototype,
6+
FunctionPrototype,
67
ObjectDefineProperties,
78
ObjectDefineProperty,
89
ObjectSetPrototypeOf,
@@ -49,10 +50,15 @@ const disusedNamesSet = new SafeSet()
4950
.add('NoDataAllowedError')
5051
.add('ValidationError');
5152

52-
class DOMException {
53+
// The DOMException class must not inherit from the Error class,
54+
// but its instance inherit from Error.prototype.
55+
// Make the runtime aware not to allocate `this` instance unnecessarily.
56+
class DOMException extends Error {
57+
static {
58+
ObjectSetPrototypeOf(DOMException, FunctionPrototype);
59+
}
60+
5361
constructor(message = '', options = 'Error') {
54-
// The DOMException class must not inherit from the Error class,
55-
// but its instance inherit from Error.prototype.
5662
// The stack property and [[ErrorData]] internal slot are given.
5763
const error = ReflectConstruct(Error, [], new.target);
5864

0 commit comments

Comments
 (0)