Commit 621ced7
Make native event type cache prototype-safe (#58203)
Summary:
The EventTarget declarative-prop cache is an ordinary object, so event names such as `constructor` resolve inherited Object properties as cached entries and silently skip their registered handler. Use a typed `Map` for exact event-name keys and add a custom native direct-event regression.
Fixes #58202.
## Changelog:
[GENERAL] [FIXED] - Resolve native EventTarget names that overlap Object prototype properties.
Pull Request resolved: #58203
Test Plan:
- Exact baseline regression expected `onConstructor` and received `undefined`; fixed test passes 1/1.
- Focused Jest suite passed.
- Fresh `yarn flow-check`: 0 errors.
- Targeted ESLint, Prettier, and `git diff --check` passed.
No UI change; screenshots are not applicable.
Reviewed By: cortinico
Differential Revision: D118266208
Pulled By: javache
fbshipit-source-id: 5ab561865383cd363e9c3f6845ed5977838741191 parent a344b4b commit 621ced7
2 files changed
Lines changed: 30 additions & 3 deletions
File tree
- packages/react-native/src/private/renderer/events
- __tests__
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
0 commit comments