File tree 2 files changed +17
-2
lines changed
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) {
33
33
} else if ( typeof data === "object" && ! ( data instanceof Date ) ) {
34
34
const newData = { } ;
35
35
for ( const key in data ) {
36
- if ( data . hasOwnProperty ( key ) ) {
36
+ if ( Object . prototype . hasOwnProperty . call ( data , key ) ) {
37
37
newData [ key ] = _deconstructPacket ( data [ key ] , buffers ) ;
38
38
}
39
39
}
@@ -68,7 +68,7 @@ function _reconstructPacket(data, buffers) {
68
68
}
69
69
} else if ( typeof data === "object" ) {
70
70
for ( const key in data ) {
71
- if ( data . hasOwnProperty ( key ) ) {
71
+ if ( Object . prototype . hasOwnProperty . call ( data , key ) ) {
72
72
data [ key ] = _reconstructPacket ( data [ key ] , buffers ) ;
73
73
}
74
74
}
Original file line number Diff line number Diff line change @@ -14,6 +14,21 @@ describe("parser", () => {
14
14
helpers . test_bin ( packet , done ) ;
15
15
} ) ;
16
16
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
+
17
32
it ( "encodes a TypedArray" , ( done ) => {
18
33
const array = new Uint8Array ( 5 ) ;
19
34
for ( let i = 0 ; i < array . length ; i ++ ) array [ i ] = i ;
You can’t perform that action at this time.
0 commit comments