File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ function _deconstructPacket(data, buffers) {
3333 } else if ( typeof data === "object" && ! ( data instanceof Date ) ) {
3434 const newData = { } ;
3535 for ( const key in data ) {
36- if ( data . hasOwnProperty ( key ) ) {
36+ if ( Object . prototype . hasOwnProperty . call ( data , key ) ) {
3737 newData [ key ] = _deconstructPacket ( data [ key ] , buffers ) ;
3838 }
3939 }
@@ -68,7 +68,7 @@ function _reconstructPacket(data, buffers) {
6868 }
6969 } else if ( typeof data === "object" ) {
7070 for ( const key in data ) {
71- if ( data . hasOwnProperty ( key ) ) {
71+ if ( Object . prototype . hasOwnProperty . call ( data , key ) ) {
7272 data [ key ] = _reconstructPacket ( data [ key ] , buffers ) ;
7373 }
7474 }
Original file line number Diff line number Diff line change @@ -14,6 +14,21 @@ describe("parser", () => {
1414 helpers . test_bin ( packet , done ) ;
1515 } ) ;
1616
17+ it ( "encodes an ArrayBuffer into an object with a null prototype" , ( done ) => {
18+ const packet = {
19+ type : PacketType . EVENT ,
20+ data : [
21+ "a" ,
22+ Object . create ( null , {
23+ array : { value : new ArrayBuffer ( 2 ) , enumerable : true } ,
24+ } ) ,
25+ ] ,
26+ id : 0 ,
27+ nsp : "/" ,
28+ } ;
29+ helpers . test_bin ( packet , done ) ;
30+ } ) ;
31+
1732 it ( "encodes a TypedArray" , ( done ) => {
1833 const array = new Uint8Array ( 5 ) ;
1934 for ( let i = 0 ; i < array . length ; i ++ ) array [ i ] = i ;
You can’t perform that action at this time.
0 commit comments