2929 * POSSIBILITY OF SUCH DAMAGE.
3030 */
3131"use strict" ;
32- import { Callback , Cookie , createPromiseCallback , pathMatch , permuteDomain } from "./cookie" ;
33- import { Store } from ' ./store'
34- import { getCustomInspectSymbol , getUtilInspect } from ' ./utilHelper'
32+ import { Callback , Cookie , createPromiseCallback , pathMatch , permuteDomain } from "./cookie" ;
33+ import { Store } from " ./store" ;
34+ import { getCustomInspectSymbol , getUtilInspect } from " ./utilHelper" ;
3535
3636export class MemoryCookieStore extends Store {
3737 override synchronous : boolean ;
@@ -46,7 +46,7 @@ export class MemoryCookieStore extends Store {
4646 constructor ( ) {
4747 super ( ) ;
4848 this . synchronous = true ;
49- this . idx = { } ;
49+ this . idx = Object . create ( null ) ;
5050 const customInspectSymbol = getCustomInspectSymbol ( ) ;
5151 if ( customInspectSymbol ) {
5252 // @ts -ignore
@@ -154,10 +154,10 @@ export class MemoryCookieStore extends Store {
154154 return promiseCallback . promise
155155 }
156156
157- const domainEntry : { [ key : string ] : any } = this . idx [ domain ] ?? { }
157+ const domainEntry : { [ key : string ] : any } = this . idx [ domain ] ?? Object . create ( null )
158158 this . idx [ domain ] = domainEntry
159159
160- const pathEntry : { [ key : string ] : any } = domainEntry [ path ] ?? { }
160+ const pathEntry : { [ key : string ] : any } = domainEntry [ path ] ?? Object . create ( null )
161161 domainEntry [ path ] = pathEntry
162162
163163 pathEntry [ key ] = cookie
@@ -225,7 +225,7 @@ export class MemoryCookieStore extends Store {
225225 const promiseCallback = createPromiseCallback < void > ( arguments )
226226 const cb = promiseCallback . callback
227227
228- this . idx = { } ;
228+ this . idx = Object . create ( null ) ;
229229
230230 cb ( null ) ;
231231 return promiseCallback . promise
@@ -270,9 +270,9 @@ export class MemoryCookieStore extends Store {
270270export function inspectFallback ( val : { [ x : string ] : any ; } ) {
271271 const domains = Object . keys ( val ) ;
272272 if ( domains . length === 0 ) {
273- return "{}" ;
273+ return "[Object: null prototype] {}" ;
274274 }
275- let result = "{\n" ;
275+ let result = "[Object: null prototype] {\n" ;
276276 Object . keys ( val ) . forEach ( ( domain , i ) => {
277277 result += formatDomain ( domain , val [ domain ] ) ;
278278 if ( i < domains . length - 1 ) {
@@ -286,7 +286,7 @@ export function inspectFallback(val: { [x: string]: any; }) {
286286
287287function formatDomain ( domainName : string , domainValue : { [ x : string ] : any ; } ) {
288288 const indent = " " ;
289- let result = `${ indent } '${ domainName } ': {\n` ;
289+ let result = `${ indent } '${ domainName } ': [Object: null prototype] {\n` ;
290290 Object . keys ( domainValue ) . forEach ( ( path , i , paths ) => {
291291 result += formatPath ( path , domainValue [ path ] ) ;
292292 if ( i < paths . length - 1 ) {
@@ -300,7 +300,7 @@ function formatDomain(domainName: string, domainValue: { [x: string]: any; }) {
300300
301301function formatPath ( pathName : string , pathValue : { [ x : string ] : any ; } ) {
302302 const indent = " " ;
303- let result = `${ indent } '${ pathName } ': {\n` ;
303+ let result = `${ indent } '${ pathName } ': [Object: null prototype] {\n` ;
304304 Object . keys ( pathValue ) . forEach ( ( cookieName , i , cookieNames ) => {
305305 const cookie = pathValue [ cookieName ] ;
306306 result += ` ${ cookieName } : ${ cookie . inspect ( ) } ` ;
0 commit comments