Commit e44882a
authored
ref(node): Stop custom-handling normalization of Domain/DomainEmitter (#21182)
We have custom code normalizing Domain and DomainEmitter, which are
node-only but deprecated and not widely used anymore. This would have
affected this being serialized in a nested object, e.g. extra, where it
would be something like:
```js
// The rule is shape-based, not identity-based: any EventEmitter under `domain` matches.
const emitter = new EventEmitter();
emitter.on('error', () => undefined);
expect(normalize({ domain: emitter })).toEqual({ domain: '[Domain]' });
```
or
```js
// The Node `domain` module stamps the originating EventEmitter onto caught errors
// under `domainEmitter`. The rule is unconditional on the key match — no shape check —
// so even non-emitter values under `domainEmitter` get replaced.
const realEmitter = new EventEmitter();
realEmitter.on('data', () => undefined);
expect(normalize({ domainEmitter: realEmitter })).toEqual({ domainEmitter: '[DomainEmitter]' });
```
(We don't really have tests for this, I added these to verify how this
looks today, they are not in the PR since they would be removed again
basically)
With this PR, they will be normalized "normally", meaning they'd look
something like this:
```diff
{
- "domain": "[Domain]",
+ "domain": {
+ "_events": {
+ "newListener": "[Function: updateExceptionCapture]",
+ "removeListener": "[Function: updateExceptionCapture]",
+ },
+ "_eventsCount": 2,
+ "_maxListeners": undefined,
+ "members": [],
+ },
}
```
or
```diff
{
- "domainEmitter": "[DomainEmitter]",
+ "domainEmitter": {
+ "_events": {
+ "data": "[Function: <anonymous>]",
+ },
+ "_eventsCount": 1,
+ "_maxListeners": undefined,
+ },
}
```
which is of course "worse" but IMHO this deprecated, not widely used
feature does not necessarily warranty special handling in core - this
code is also shipped to browsers.1 parent ed0c4cf commit e44882a
1 file changed
Lines changed: 0 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | 190 | | |
199 | 191 | | |
200 | 192 | | |
| |||
0 commit comments