@@ -136,4 +136,49 @@ var c = {}
136136jsonpointer . set ( { } , '/__proto__/boo' , 'polluted' )
137137assert ( ! c . boo , 'should not boo' )
138138
139+ var d = { }
140+ jsonpointer . set ( { } , '/foo/__proto__/boo' , 'polluted' )
141+ assert ( ! d . boo , 'should not boo' )
142+
143+ jsonpointer . set ( { } , '/foo/__proto__/__proto__/boo' , 'polluted' )
144+ assert ( ! d . boo , 'should not boo' )
145+
146+ var e = { }
147+ jsonpointer . set ( { } , '/constructor/prototype/boo' , 'polluted' )
148+ assert ( ! e . boo , 'should not boo' )
149+
150+ jsonpointer . set ( { } , '/foo/constructor/prototype/boo' , 'polluted' )
151+ assert ( ! e . boo , 'should not boo' )
152+
153+ jsonpointer . set ( { } , '/foo/constructor/constructor/prototype/boo' , 'polluted' )
154+ assert ( ! e . boo , 'should not boo' )
155+
156+ var f = { }
157+ jsonpointer . set ( { } , [ [ '__proto__' ] , 'boo' ] , 'polluted' )
158+ assert ( ! f . boo , 'should not f.boo' )
159+
160+ jsonpointer . set ( { } , [ [ [ '__proto__' ] ] , 'boo' ] , 'polluted' )
161+ assert ( ! f . boo , 'should not f.boo' )
162+
163+ jsonpointer . set ( { } , [ [ '__proto__' ] , [ '__proto__' ] , 'boo' ] , 'polluted' )
164+ assert ( ! f . boo , 'should not f.boo' )
165+
166+ jsonpointer . set ( { } , [ [ [ '__proto__' ] ] , [ [ '__proto__' ] ] , 'boo' ] , 'polluted' )
167+ assert ( ! f . boo , 'should not f.boo' )
168+
169+ jsonpointer . set ( { } , [ [ '__proto__' ] , [ '__proto__' ] , [ '__proto__' ] , 'boo' ] , 'polluted' )
170+ assert ( ! f . boo , 'should not f.boo' )
171+
172+ jsonpointer . set ( { } , [ [ 'foo' ] , [ '__proto__' ] , 'boo' ] , 'polluted' )
173+ assert ( ! f . boo , 'should not boo' )
174+
175+ jsonpointer . set ( { } , [ [ 'foo' ] , [ '__proto__' ] , [ '__proto__' ] , 'boo' ] , 'polluted' )
176+ assert ( ! f . boo , 'should not boo' )
177+
178+ jsonpointer . set ( { } , [ [ 'constructor' ] , [ 'prototype' ] , 'boo' ] , 'polluted' )
179+ assert ( ! f . boo , 'should not boo' )
180+
181+ jsonpointer . set ( { } , [ [ 'constructor' ] , [ 'constructor' ] , [ 'prototype' ] , 'boo' ] , 'polluted' )
182+ assert ( ! f . boo , 'should not boo' )
183+
139184console . log ( 'All tests pass.' )
0 commit comments