Skip to content

Commit 6c107c3

Browse files
HoonDongKangaduh95
authored andcommitted
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: #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>
1 parent b6e7935 commit 6c107c3

2 files changed

Lines changed: 2 additions & 14 deletions

File tree

lib/internal/blob.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,11 @@ class Blob {
255255

256256
start = converters['long long'](
257257
start,
258-
{ __proto__: null, context: 'start' },
258+
{ __proto__: null, context: 'start', clamp: true },
259259
);
260260
end = converters['long long'](
261261
end,
262-
{ __proto__: null, context: 'end' },
262+
{ __proto__: null, context: 'end', clamp: true },
263263
);
264264

265265
if (start < 0) {

test/wpt/status/FileAPI/blob.cjs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,4 @@ module.exports = {
3636
'Blob-in-worker.worker.js': {
3737
skip: 'Depends on Web Workers API',
3838
},
39-
'Blob-slice.any.js': {
40-
fail: {
41-
expected: [
42-
'Slicing test: slice (1,1).',
43-
'Slicing test: slice (1,3).',
44-
'Slicing test: slice (1,5).',
45-
'Slicing test: slice (1,7).',
46-
'Slicing test: slice (1,8).',
47-
'Slicing test: slice (1,9).',
48-
],
49-
},
50-
},
5139
};

0 commit comments

Comments
 (0)