buffer: use Clamp conversion in Blob slice

Align Blob.prototype.slice() with the File API Web IDL definition by
using [Clamp] conversion for the start and end arguments.

This fixes the Blob-slice.any.js WPT expected failures for fractional
start and end values.

Refs: https://www.w3.org/TR/FileAPI/#dfn-Blob
Signed-off-by: HoonDongKang <d159123@naver.com>
PR-URL: https://github.com/nodejs/node/pull/64739
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jason Zhang <xzha4350@gmail.com>
This commit is contained in:
Donghoon Kang authored and Antoine du Hamel committed 2026-08-06 16:00:17 +02:00
1 parent 093098ad7f
commit 465f2bfb74
2 files changed
+2 -14

No files matched your search

+2 -2
View File
@@ -255,11 +255,11 @@ class Blob {
start = converters['long long'](
start,
{ __proto__: null, context: 'start' },
{ __proto__: null, context: 'start', clamp: true },
);
end = converters['long long'](
end,
{ __proto__: null, context: 'end' },
{ __proto__: null, context: 'end', clamp: true },
);
if (start < 0) {
-12
View File
@@ -36,16 +36,4 @@ module.exports = {
'Blob-in-worker.worker.js': {
skip: 'Depends on Web Workers API',
},
'Blob-slice.any.js': {
fail: {
expected: [
'Slicing test: slice (1,1).',
'Slicing test: slice (1,3).',
'Slicing test: slice (1,5).',
'Slicing test: slice (1,7).',
'Slicing test: slice (1,8).',
'Slicing test: slice (1,9).',
],
},
},
};