@@ -287,3 +287,32 @@ assert.throws(() => new Blob({}), {
287287 assert . strictEqual ( blob . size , 28 ) ;
288288 assert . strictEqual ( blob . type , '' ) ;
289289} ) ( ) . then ( common . mustCall ( ) ) ;
290+
291+ {
292+ // Testing the defaults
293+ [ undefined , null , Object . create ( null ) , { type : undefined } , {
294+ get type ( ) { } , // eslint-disable-line getter-return
295+ } ] . forEach ( ( options ) => {
296+ assert . strictEqual (
297+ new Blob ( [ ] , options ) . type ,
298+ new Blob ( [ ] ) . type ,
299+ ) ;
300+ } ) ;
301+
302+ Reflect . defineProperty ( Object . prototype , 'type' , {
303+ __proto__ : null ,
304+ configurable : true ,
305+ get : common . mustCall ( ( ) => 3 , 7 ) ,
306+ } ) ;
307+
308+ [ { } , [ ] , ( ) => { } , Number , new Number ( ) , new String ( ) , new Boolean ( ) ] . forEach (
309+ ( options ) => {
310+ assert . strictEqual ( new Blob ( [ ] , options ) . type , '3' ) ;
311+ } ,
312+ ) ;
313+ [ 0 , '' , true , Symbol ( ) , 0n ] . forEach ( ( options ) => {
314+ assert . throws ( ( ) => new Blob ( [ ] , options ) , { code : 'ERR_INVALID_ARG_TYPE' } ) ;
315+ } ) ;
316+
317+ delete Object . prototype . type ;
318+ }
0 commit comments