@@ -36,7 +36,7 @@ var util = require('util');
3636
3737function MemoryCookieStore ( ) {
3838 Store . call ( this ) ;
39- this . idx = { } ;
39+ this . idx = Object . create ( null ) ;
4040}
4141util . inherits ( MemoryCookieStore , Store ) ;
4242exports . MemoryCookieStore = MemoryCookieStore ;
@@ -86,18 +86,18 @@ MemoryCookieStore.prototype.findCookies = function(domain, path, cb) {
8686
8787 } else {
8888 pathMatcher = function matchRFC ( domainIndex ) {
89- //NOTE: we should use path-match algorithm from S5.1.4 here
90- //(see : https://github.com/ChromiumWebApps/chromium/blob/b3d3b4da8bb94c1b2e061600df106d590fda3620/net/cookies/canonical_cookie.cc#L299)
91- Object . keys ( domainIndex ) . forEach ( function ( cookiePath ) {
92- if ( pathMatch ( path , cookiePath ) ) {
93- var pathIndex = domainIndex [ cookiePath ] ;
94-
95- for ( var key in pathIndex ) {
96- results . push ( pathIndex [ key ] ) ;
97- }
98- }
99- } ) ;
100- } ;
89+ //NOTE: we should use path-match algorithm from S5.1.4 here
90+ //(see : https://github.com/ChromiumWebApps/chromium/blob/b3d3b4da8bb94c1b2e061600df106d590fda3620/net/cookies/canonical_cookie.cc#L299)
91+ Object . keys ( domainIndex ) . forEach ( function ( cookiePath ) {
92+ if ( pathMatch ( path , cookiePath ) ) {
93+ var pathIndex = domainIndex [ cookiePath ] ;
94+
95+ for ( var key in pathIndex ) {
96+ results . push ( pathIndex [ key ] ) ;
97+ }
98+ }
99+ } ) ;
100+ } ;
101101 }
102102
103103 var domains = permuteDomain ( domain ) || [ domain ] ;
@@ -115,10 +115,10 @@ MemoryCookieStore.prototype.findCookies = function(domain, path, cb) {
115115
116116MemoryCookieStore . prototype . putCookie = function ( cookie , cb ) {
117117 if ( ! this . idx [ cookie . domain ] ) {
118- this . idx [ cookie . domain ] = { } ;
118+ this . idx [ cookie . domain ] = Object . create ( null ) ;
119119 }
120120 if ( ! this . idx [ cookie . domain ] [ cookie . path ] ) {
121- this . idx [ cookie . domain ] [ cookie . path ] = { } ;
121+ this . idx [ cookie . domain ] [ cookie . path ] = Object . create ( null ) ;
122122 }
123123 this . idx [ cookie . domain ] [ cookie . path ] [ cookie . key ] = cookie ;
124124 cb ( null ) ;
@@ -150,7 +150,7 @@ MemoryCookieStore.prototype.removeCookies = function(domain, path, cb) {
150150} ;
151151
152152MemoryCookieStore . prototype . removeAllCookies = function ( cb ) {
153- this . idx = { } ;
153+ this . idx = Object . create ( null ) ;
154154 return cb ( null ) ;
155155}
156156
0 commit comments