File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ const {
5454  lazyDOMException, 
5555}  =  require ( 'internal/util' ) ; 
5656const  {  inspect }  =  require ( 'internal/util/inspect' ) ; 
57+ const  {  convertToInt }  =  require ( 'internal/webidl' ) ; 
5758
5859const  { 
5960  codes : { 
@@ -239,6 +240,12 @@ class Blob {
239240  slice ( start  =  0 ,  end  =  this [ kLength ] ,  contentType  =  '' )  { 
240241    if  ( ! isBlob ( this ) ) 
241242      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+ 
242249    if  ( start  <  0 )  { 
243250      start  =  MathMax ( this [ kLength ]  +  start ,  0 ) ; 
244251    }  else  { 
Original file line number Diff line number Diff line change @@ -483,6 +483,7 @@ assert.throws(() => new Blob({}), {
483483
484484  assert . ok ( blob . slice ( 0 ,  1 ) . constructor  ===  Blob ) ; 
485485  assert . ok ( blob . slice ( 0 ,  1 )  instanceof  Blob ) ; 
486+   assert . ok ( blob . slice ( 0 ,  1.5 )  instanceof  Blob ) ; 
486487} 
487488
488489( async  ( )  =>  { 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments