Skip to content

Commit e284bd7

Browse files
committed
blob: 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>
1 parent 0618e9f commit e284bd7

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
@@ -261,11 +261,11 @@ class Blob {
261261

262262
start = converters['long long'](
263263
start,
264-
{ __proto__: null, context: 'start' },
264+
{ __proto__: null, context: 'start', clamp: true },
265265
);
266266
end = converters['long long'](
267267
end,
268-
{ __proto__: null, context: 'end' },
268+
{ __proto__: null, context: 'end', clamp: true },
269269
);
270270

271271
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)