File tree 2 files changed +8
-0
lines changed
2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ const {
54
54
lazyDOMException,
55
55
} = require ( 'internal/util' ) ;
56
56
const { inspect } = require ( 'internal/util/inspect' ) ;
57
+ const { convertToInt } = require ( 'internal/webidl' ) ;
57
58
58
59
const {
59
60
codes : {
@@ -239,6 +240,12 @@ class Blob {
239
240
slice ( start = 0 , end = this [ kLength ] , contentType = '' ) {
240
241
if ( ! isBlob ( this ) )
241
242
throw new ERR_INVALID_THIS ( 'Blob' ) ;
243
+
244
+ // Coerce values to int
245
+ const opts = { __proto__ : null , signed : true } ;
246
+ start = convertToInt ( 'start' , start , 64 , opts ) ;
247
+ end = convertToInt ( 'end' , end , 64 , opts ) ;
248
+
242
249
if ( start < 0 ) {
243
250
start = MathMax ( this [ kLength ] + start , 0 ) ;
244
251
} else {
Original file line number Diff line number Diff line change @@ -483,6 +483,7 @@ assert.throws(() => new Blob({}), {
483
483
484
484
assert . ok ( blob . slice ( 0 , 1 ) . constructor === Blob ) ;
485
485
assert . ok ( blob . slice ( 0 , 1 ) instanceof Blob ) ;
486
+ assert . ok ( blob . slice ( 0 , 1.5 ) instanceof Blob ) ;
486
487
}
487
488
488
489
( async ( ) => {
You can’t perform that action at this time.
0 commit comments