Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(689)

Side by Side Diff: src/parser.cc

Issue 6101001: Don't let JSON parsed objects hit inherited setters. (Closed)
Patch Set: Address review comments. Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/bugs/bug-1015.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3662 matching lines...) Expand 10 before | Expand all | Expand 10 after
3673 return ReportUnexpectedToken(); 3673 return ReportUnexpectedToken();
3674 } 3674 }
3675 Handle<String> key = GetString(); 3675 Handle<String> key = GetString();
3676 if (scanner_.Next() != Token::COLON) { 3676 if (scanner_.Next() != Token::COLON) {
3677 return ReportUnexpectedToken(); 3677 return ReportUnexpectedToken();
3678 } 3678 }
3679 Handle<Object> value = ParseJsonValue(); 3679 Handle<Object> value = ParseJsonValue();
3680 if (value.is_null()) return Handle<Object>::null(); 3680 if (value.is_null()) return Handle<Object>::null();
3681 uint32_t index; 3681 uint32_t index;
3682 if (key->AsArrayIndex(&index)) { 3682 if (key->AsArrayIndex(&index)) {
3683 SetElement(json_object, index, value); 3683 CALL_HEAP_FUNCTION_INLINE(
3684 (*json_object)->SetElement(index, *value, true));
3684 } else { 3685 } else {
3685 SetProperty(json_object, key, value, NONE); 3686 CALL_HEAP_FUNCTION_INLINE(
3687 (*json_object)->SetPropertyPostInterceptor(*key, *value, NONE));
3686 } 3688 }
3687 } while (scanner_.Next() == Token::COMMA); 3689 } while (scanner_.Next() == Token::COMMA);
3688 if (scanner_.current_token() != Token::RBRACE) { 3690 if (scanner_.current_token() != Token::RBRACE) {
3689 return ReportUnexpectedToken(); 3691 return ReportUnexpectedToken();
3690 } 3692 }
3691 } 3693 }
3692 return json_object; 3694 return json_object;
3693 } 3695 }
3694 3696
3695 3697
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
4706 Handle<String> source = Handle<String>(String::cast(script->source())); 4708 Handle<String> source = Handle<String>(String::cast(script->source()));
4707 result = parser.ParseProgram(source, info->is_global()); 4709 result = parser.ParseProgram(source, info->is_global());
4708 } 4710 }
4709 } 4711 }
4710 4712
4711 info->SetFunction(result); 4713 info->SetFunction(result);
4712 return (result != NULL); 4714 return (result != NULL);
4713 } 4715 }
4714 4716
4715 } } // namespace v8::internal 4717 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/bugs/bug-1015.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698