Commit 2cd5aac
fix(ext/node): reject structuredClone for file-backed Blobs (#34075)
`parallel/test-blob-file-backed.js` in the Node compatibility suite
expects `structuredClone(await fs.openAsBlob(path))` to throw a
`DOMException`/`DataCloneError`. Deno currently implements
`node:fs.openAsBlob()` by reading the file into an in-memory `Blob`, so
the Blob is treated as serializable and `structuredClone()` succeeds.
That diverges from Node behavior for file-backed Blobs.
## Summary
- mark `node:fs.openAsBlob()` results as file-backed in the Blob
internals
- propagate that marker through Blob construction and slicing
- reject structured clone serialization for marked Blobs so
`structuredClone()` surfaces `DataCloneError`
- add a node fs regression covering direct and sliced openAsBlob Blobs
Co-authored-by: divybot <divybot@users.noreply.github.com>
Co-authored-by: Divy Srivastava <me@littledivy.com>1 parent 2aeca4a commit 2cd5aac
3 files changed
Lines changed: 60 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
203 | 206 | | |
204 | 207 | | |
205 | 208 | | |
| |||
2360 | 2363 | | |
2361 | 2364 | | |
2362 | 2365 | | |
2363 | | - | |
| 2366 | + | |
2364 | 2367 | | |
2365 | 2368 | | |
2366 | 2369 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
221 | 235 | | |
222 | 236 | | |
223 | 237 | | |
224 | 238 | | |
225 | 239 | | |
| 240 | + | |
226 | 241 | | |
227 | 242 | | |
228 | 243 | | |
| |||
251 | 266 | | |
252 | 267 | | |
253 | 268 | | |
| 269 | + | |
254 | 270 | | |
255 | 271 | | |
256 | 272 | | |
| |||
360 | 376 | | |
361 | 377 | | |
362 | 378 | | |
| 379 | + | |
363 | 380 | | |
364 | 381 | | |
365 | 382 | | |
| |||
684 | 701 | | |
685 | 702 | | |
686 | 703 | | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
687 | 707 | | |
688 | 708 | | |
689 | 709 | | |
| |||
720 | 740 | | |
721 | 741 | | |
722 | 742 | | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
723 | 755 | | |
724 | 756 | | |
725 | 757 | | |
| |||
834 | 866 | | |
835 | 867 | | |
836 | 868 | | |
| 869 | + | |
837 | 870 | | |
838 | 871 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
614 | 614 | | |
615 | 615 | | |
616 | 616 | | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
617 | 640 | | |
618 | 641 | | |
619 | 642 | | |
| |||
0 commit comments