Commit ef8dbea
authored
feat(engine): add
This Pull Request fixes/closes #4974.
It changes the following:
- Add `JsArrayBuffer::to_vec(&self) -> Option<Vec<u8>>` helper to copy
buffer contents into a fresh `Vec<u8>` while returning `None` when the
buffer has been detached
- Add a doc comment and example for `JsArrayBuffer::to_vec`, including
both normal and detached cases
- Add small unit tests (`array_buffer_to_vec_roundtrip_and_detach` and
`array_buffer_to_vec_empty`) to cover round-trip, detach, and
empty-buffer behavior
Testing:
- `cargo test -p boa_engine` (including the new unit tests and doctest)JsArrayBuffer::to_vec for copying bytes (#4976)1 parent 683d483 commit ef8dbea
1 file changed
+58
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
260 | 289 | | |
261 | 290 | | |
262 | 291 | | |
| |||
325 | 354 | | |
326 | 355 | | |
327 | 356 | | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
0 commit comments