File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -629,10 +629,14 @@ test('non-object target', function (t) {
629629
630630test ( '__proto__ is merged as an own property' , function ( t ) {
631631 var malicious = JSON . parse ( '{ "fred": 1, "__proto__": { "george": 1 } }' ) ;
632- var target = { } ;
633- extend ( true , target , malicious ) ;
634- t . notOk ( target . george ) ;
635- t . ok ( Object . prototype . hasOwnProperty . call ( target , '__proto__' ) ) ;
636- t . deepEqual ( target . __proto__ , { george : 1 } ) ; // eslint-disable-line no-proto
632+ // this test isn't valid for earlier versions of V8, which strip __proto__ during JSON.parse()
633+ if ( Object . prototype . hasOwnProperty . call ( malicious , '__proto__' ) ) {
634+ var target = { } ;
635+ extend ( true , target , malicious ) ;
636+ t . notOk ( target . george ) ;
637+ t . ok ( Object . prototype . hasOwnProperty . call ( target , '__proto__' ) ) ;
638+ t . deepEqual ( target . __proto__ , { george : 1 } ) ; // eslint-disable-line no-proto
639+ }
640+
637641 t . end ( ) ;
638642} ) ;
You can’t perform that action at this time.
0 commit comments