Skip to content

buffer: align Blob and File with Web IDL - #66776

Open
panva wants to merge 3 commits into
nodejs:mainfrom
panva:fix-blob-detached-buffer
Open

panva wants to merge 3 commits into
nodejs:mainfrom
panva:fix-blob-detached-buffer

Conversation

@panva

@panva panva commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Convert Blob and File constructor arguments before processing blob parts, preserving Web IDL argument and dictionary conversion order. Apply long long conversion to File.lastModified and reject an explicitly undefined fileBits argument.

Copy bytes using internal buffer slots without invoking user getters, slice methods, or species constructors. Treat detached parts as empty and check Blob brands without invoking user getters or accepting proxy wrappers.

Keep rejecting bare SharedArrayBuffers and shared-memory views for browser compatibility. String conversion for bare SharedArrayBuffers remains an unresolved specification discrepancy: whatwg/webidl#1491.

I'd treat Web API fixes as patches but since the impact of this is unclear to me -> semver-major PRs that contain breaking changes and should be released in the next major version.

@panva panva added semver-major PRs that contain breaking changes and should be released in the next major version. commit-queue-rebase PRs the Commit Queue should land as multiple self-contained commits. labels Oct 15, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/web-standards

@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Oct 15, 2026
@panva

panva commented Oct 15, 2026

Copy link
Copy Markdown
Member Author

Also supersedes #66772

panva and others added 3 commits October 15, 2026 22:08
Convert constructor arguments in Web IDL order before processing blob
parts, including inherited dictionary members and File.lastModified's
long long conversion.

Read buffer slots and copy bytes without invoking user getters, slice
methods, or species constructors. Treat detached parts as empty and
track Blob brands without invoking user getters or accepting proxies.

Keep rejecting bare SharedArrayBuffers and shared-memory views for
browser compatibility pending resolution of the union conversion rules.

Refs: whatwg/webidl#1491
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Assisted-by: Codex
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Assisted-by: Codex
@panva
panva force-pushed the fix-blob-detached-buffer branch from 7d0d4ec to 880a300 Compare October 15, 2026 20:08
@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.49%. Comparing base (1c90519) to head (880a300).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66776      +/-   ##
==========================================
- Coverage   90.49%   90.49%   -0.01%     
==========================================
  Files         797      797              
  Lines      277598   277639      +41     
  Branches    53336    53333       -3     
==========================================
+ Hits       251220   251246      +26     
- Misses      16790    16794       +4     
- Partials     9588     9599      +11     
Files with missing lines Coverage Δ
lib/internal/blob.js 99.20% <100.00%> (+0.04%) ⬆️
lib/internal/file.js 97.40% <100.00%> (+0.03%) ⬆️

... and 29 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@panva panva added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit-queue-rebase PRs the Commit Queue should land as multiple self-contained commits. needs-ci PRs that need a full CI run. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. semver-major PRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants