@@ -39,7 +39,7 @@ class MemoryCookieStore extends Store {
39
39
constructor() {
40
40
super();
41
41
this.synchronous = true;
42
- this.idx = {} ;
42
+ this.idx = Object.create(null) ;
43
43
const customInspectSymbol = getCustomInspectSymbol();
44
44
if (customInspectSymbol) {
45
45
this[customInspectSymbol] = this.inspect;
@@ -111,10 +111,10 @@ class MemoryCookieStore extends Store {
111
111
112
112
putCookie(cookie, cb) {
113
113
if (!this.idx[cookie.domain]) {
114
- this.idx[cookie.domain] = {} ;
114
+ this.idx[cookie.domain] = Object.create(null) ;
115
115
}
116
116
if (!this.idx[cookie.domain][cookie.path]) {
117
- this.idx[cookie.domain][cookie.path] = {} ;
117
+ this.idx[cookie.domain][cookie.path] = Object.create(null) ;
118
118
}
119
119
this.idx[cookie.domain][cookie.path][cookie.key] = cookie;
120
120
cb(null);
@@ -146,7 +146,7 @@ class MemoryCookieStore extends Store {
146
146
return cb(null);
147
147
}
148
148
removeAllCookies(cb) {
149
- this.idx = {} ;
149
+ this.idx = Object.create(null) ;
150
150
return cb(null);
151
151
}
152
152
getAllCookies(cb) {
@@ -196,9 +196,9 @@ exports.MemoryCookieStore = MemoryCookieStore;
196
196
function inspectFallback(val) {
197
197
const domains = Object.keys(val);
198
198
if (domains.length === 0) {
199
- return "{}";
199
+ return "[Object: null prototype] {}";
200
200
}
201
- let result = "{\n";
201
+ let result = "[Object: null prototype] {\n";
202
202
Object.keys(val).forEach((domain, i) => {
203
203
result += formatDomain(domain, val[domain]);
204
204
if (i < domains.length - 1) {
@@ -212,7 +212,7 @@ function inspectFallback(val) {
212
212
213
213
function formatDomain(domainName, domainValue) {
214
214
const indent = " ";
215
- let result = `${indent}'${domainName}': {\n`;
215
+ let result = `${indent}'${domainName}': [Object: null prototype] {\n`;
216
216
Object.keys(domainValue).forEach((path, i, paths) => {
217
217
result += formatPath(path, domainValue[path]);
218
218
if (i < paths.length - 1) {
@@ -226,7 +226,7 @@ function formatDomain(domainName, domainValue) {
226
226
227
227
function formatPath(pathName, pathValue) {
228
228
const indent = " ";
229
- let result = `${indent}'${pathName}': {\n`;
229
+ let result = `${indent}'${pathName}': [Object: null prototype] {\n`;
230
230
Object.keys(pathValue).forEach((cookieName, i, cookieNames) => {
231
231
const cookie = pathValue[cookieName];
232
232
result += ` ${cookieName}: ${cookie.inspect()}`;
0 commit comments