-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: make event static properties non writable and configurable
The idl definition for Event makes the properties constant this means that they shouldn't be configurable and writable. However, they were, and this commit fixes that. Fixes: #50417 PR-URL: #50425 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
- Loading branch information
1 parent
2eeda3f
commit 5fa40be
Showing
2 changed files
with
38 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
const assert = require('assert'); | ||
|
||
const eventPhases = { | ||
'NONE': 0, | ||
'CAPTURING_PHASE': 1, | ||
'AT_TARGET': 2, | ||
'BUBBLING_PHASE': 3 | ||
}; | ||
|
||
for (const [prop, value] of Object.entries(eventPhases)) { | ||
// Check if the value of the property matches the expected value | ||
assert.strictEqual(Event[prop], value, `Expected Event.${prop} to be ${value}, but got ${Event[prop]}`); | ||
|
||
const desc = Object.getOwnPropertyDescriptor(Event, prop); | ||
assert.strictEqual(desc.writable, false, `${prop} should not be writable`); | ||
assert.strictEqual(desc.configurable, false, `${prop} should not be configurable`); | ||
assert.strictEqual(desc.enumerable, true, `${prop} should be enumerable`); | ||
} |