Commit f5e88de
authored
fix(built-ins): modify
<!---
Thank you for contributing to Boa! Please fill out the template below,
and remove or add any
information as you feel necessary.
--->
This Pull Request fixes/closes #5256.
As required by ecma262, `Object.preventExtensions` may be applied to
typed arrays without error if the `IsTypedArrayFixedLength` is not
false. Prior to this commit, this check was incorrectly implemented via
`ArrayBuffer::is_fixed_len` which does not/can not include an AUTO
length check. This discrepancy lies in that the requirements of a
fixed-length `TypedArray` slightly differ from a fixed-length
arraybuffer.
It adds and replaces the checks as specified by
[`sec-istypedarrayfixedlength`](https://tc39.es/ecma262/#sec-istypedarrayfixedlength).
Now,
[typed_array_exotic_prevent_extensions](https://github.com/boa-dev/boa/blob/main/core/engine/src/builtins/typed_array/object.rs#L289)
should
- return `Ok(false)` when the `TypedArray` is auto length or when the
backing `ArrayBuffer` is resizable.
- failing the above, call `ordinary_prevent_extensions` if the backing
array is a `SharedArrayBuffer`.
This PR also adds a test to ensure what the title of this issue says. In
addition, test262's `test/staging/built-ins/preventExtensions` should
now pass completely.IsTypedArrayFixedLength implementation to match spec (#5262)1 parent cd1a386 commit f5e88de
2 files changed
Lines changed: 45 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
282 | 302 | | |
283 | 303 | | |
284 | 304 | | |
| |||
295 | 315 | | |
296 | 316 | | |
297 | 317 | | |
298 | | - | |
299 | | - | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
300 | 321 | | |
301 | 322 | | |
302 | 323 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
0 commit comments