From 465f2bfb749617e87c216c0dc6fd6064b6424cce Mon Sep 17 00:00:00 2001 From: Donghoon Kang Date: Wed, 29 Jul 2026 09:54:37 +0900 Subject: [PATCH] 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 PR-URL: https://github.com/nodejs/node/pull/64739 Reviewed-By: Filip Skokan Reviewed-By: Matthew Aitken Reviewed-By: Aviv Keller Reviewed-By: Luigi Pinca Reviewed-By: Jason Zhang --- lib/internal/blob.js | 4 ++-- test/wpt/status/FileAPI/blob.cjs | 12 ------------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/lib/internal/blob.js b/lib/internal/blob.js index 64fac9fdf02..bdf01e2f31c 100644 --- a/lib/internal/blob.js +++ b/lib/internal/blob.js @@ -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) { diff --git a/test/wpt/status/FileAPI/blob.cjs b/test/wpt/status/FileAPI/blob.cjs index 99ec7dd22ce..bf40df1b842 100644 --- a/test/wpt/status/FileAPI/blob.cjs +++ b/test/wpt/status/FileAPI/blob.cjs @@ -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).', - ], - }, - }, };