Commit 877adec
committed
[JSC] Account for user code to arguments in Array.from
https://bugs.webkit.org/show_bug.cgi?id=306000
rdar://168635038
Reviewed by Sosuke Suzuki and Yusuke Suzuki.
Arguments objects in JS are array-like, so there is no guarantee that .length
implies a backing store of that size, and that indexed getters won't be called,
even when the iterator protocol isn't user modified.
This PR makes the optimized version of Array.from for arguments robust to user
modification to fall back to generic get().
Test: JSTests/stress/array-from-arguments-overwritten-length.js
Canonical link: https://commits.webkit.org/306050@main1 parent 9e6af35 commit 877adec
2 files changed
Lines changed: 68 additions & 13 deletions
File tree
- JSTests/stress
- Source/JavaScriptCore/runtime
Lines changed: 41 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 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
270 | 288 | | |
271 | 289 | | |
272 | 290 | | |
| |||
279 | 297 | | |
280 | 298 | | |
281 | 299 | | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
| 300 | + | |
286 | 301 | | |
287 | | - | |
| 302 | + | |
| 303 | + | |
288 | 304 | | |
289 | 305 | | |
290 | 306 | | |
| |||
306 | 322 | | |
307 | 323 | | |
308 | 324 | | |
309 | | - | |
310 | | - | |
| 325 | + | |
311 | 326 | | |
312 | 327 | | |
313 | | - | |
| 328 | + | |
| 329 | + | |
314 | 330 | | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
| 331 | + | |
319 | 332 | | |
320 | | - | |
| 333 | + | |
| 334 | + | |
321 | 335 | | |
322 | 336 | | |
323 | 337 | | |
| |||
0 commit comments