Commit 790289c
Fix EventEmitter prototype-key event types (#58229)
Summary:
The shared EventEmitter uses an ordinary object registry, so event types such as `constructor` and `__proto__` resolve inherited values and throw during registration. Initialize and reset the internal registry without a prototype, and cover registration, emission, counting, and full reset for both keys.
Fixes #58228.
## Changelog:
[GENERAL] [FIXED] - Support EventEmitter event names that overlap Object prototype properties.
Pull Request resolved: #58229
Test Plan:
- Exact upstream regression: 20 passed / 1 failed at `registrations.add`.
- Fixed Fantom suite: 21/21 passed.
- Fresh `yarn flow-check`: 0 errors.
- Targeted no-ignore ESLint, Prettier, and `git diff --check` passed.
No UI change; screenshots are not applicable.
Reviewed By: cortinico
Differential Revision: D118267117
Pulled By: javache
fbshipit-source-id: 12c3aab577ec13dabe475409ae6e21f5e68531351 parent 621ced7 commit 790289c
2 files changed
Lines changed: 23 additions & 2 deletions
File tree
- packages/react-native/Libraries/vendor/emitter
- __tests__
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| |||
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
60 | 81 | | |
61 | 82 | | |
62 | 83 | | |
| |||
0 commit comments