Repository navigation
Commit c2da175
Validate PerformanceObserver callbacks (#58239)
Summary:
`PerformanceObserver` currently accepts missing and non-function callbacks, creating invalid instances that fail only when native delivery tries to invoke the stored value. Validate construction synchronously, distinguish an omitted required argument from an explicitly supplied non-function, and cover both error paths.
Fixes #58238.
## Changelog:
[GENERAL] [FIXED] - Reject missing and non-function PerformanceObserver callbacks during construction.
Pull Request resolved: #58239
Test Plan:
- Exact upstream focused regression: both new constructor assertions failed.
- Fixed Fantom suite: 5 passed with one pre-existing skip.
- Fresh Flow check: 0 errors.
- Targeted no-ignore ESLint, Prettier, and `git diff --check` passed.
Invalid constructor calls now throw synchronously as required; valid callers and UI behavior are unchanged.
Reviewed By: christophpurrer
Differential Revision: D123889539
Pulled By: rubennorte
fbshipit-source-id: 8ee2f483bfa3aa3bc764efb7c8505ec7f69a349b1 parent 99aefad commit c2da175
2 files changed
Lines changed: 38 additions & 0 deletions
File tree
- packages/react-native/src/private/webapis/performance
- __tests__
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
124 | 136 | | |
125 | 137 | | |
126 | 138 | | |
| |||
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
17 | 43 | | |
18 | 44 | | |
19 | 45 | | |
| |||
0 commit comments