Repository navigation
Commit e0224fd
fix: validate PerformanceObserver observe options
Summary:
Harden `PerformanceObserver.observe()` option validation so invalid observer configurations fail deterministically before we register a native observer.
This fixes a few user-facing gaps in the current implementation:
- calling `observe()` with no options now throws the expected argument error instead of destructuring `undefined`
- the `entryTypes` / `type` validation messages now match the actual invalid condition
- empty `entryTypes: []` is rejected instead of silently creating an observer that observes nothing
- `entryTypes` combined with `buffered` is rejected before native registration, matching the existing `durationThreshold` guard
The goal is to prevent malformed performance observer setup from silently succeeding or failing with misleading errors in apps and performance tooling.
## Changelog:
[GENERAL] [FIXED] - Validate invalid PerformanceObserver observe option combinations before native registration
X-link: #57030
Reviewed By: javache
Differential Revision: D107361950
Pulled By: rubennorte
fbshipit-source-id: eb0614fc20541f3cc2a7acacbbef63394ffcd0a11 parent ca2e11a commit e0224fd
2 files changed
Lines changed: 41 additions & 4 deletions
File tree
- packages/react-native/src/private/webapis/performance
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
205 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
206 | 212 | | |
207 | 213 | | |
208 | 214 | | |
209 | | - | |
| 215 | + | |
210 | 216 | | |
211 | 217 | | |
212 | 218 | | |
213 | 219 | | |
214 | 220 | | |
215 | | - | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
216 | 228 | | |
217 | 229 | | |
218 | 230 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
99 | 124 | | |
100 | 125 | | |
101 | 126 | | |
| |||
0 commit comments