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

Side by Side Diff: src/parser.cc

Issue 6101001: Don't let JSON parsed objects hit inherited setters. (Closed)
Patch Set: 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
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 3654 matching lines...) Expand 10 before | Expand all | Expand 10 after
3665 return ReportUnexpectedToken(); 3665 return ReportUnexpectedToken();
3666 } 3666 }
3667 Handle<String> key = GetString(); 3667 Handle<String> key = GetString();
3668 if (scanner_.Next() != Token::COLON) { 3668 if (scanner_.Next() != Token::COLON) {
3669 return ReportUnexpectedToken(); 3669 return ReportUnexpectedToken();
3670 } 3670 }
3671 Handle<Object> value = ParseJsonValue(); 3671 Handle<Object> value = ParseJsonValue();
3672 if (value.is_null()) return Handle<Object>::null(); 3672 if (value.is_null()) return Handle<Object>::null();
3673 uint32_t index; 3673 uint32_t index;
3674 if (key->AsArrayIndex(&index)) { 3674 if (key->AsArrayIndex(&index)) {
3675 SetElement(json_object, index, value); 3675 CALL_HEAP_FUNCTION_INLINE(
3676 (*json_object)->SetElement(index, *value, true));
3676 } else { 3677 } else {
3677 SetProperty(json_object, key, value, NONE); 3678 CALL_HEAP_FUNCTION_INLINE(
3679 (*json_object)->SetPropertyPostInterceptor(*key, *value, NONE));
3678 } 3680 }
3679 } while (scanner_.Next() == Token::COMMA); 3681 } while (scanner_.Next() == Token::COMMA);
3680 if (scanner_.current_token() != Token::RBRACE) { 3682 if (scanner_.current_token() != Token::RBRACE) {
3681 return ReportUnexpectedToken(); 3683 return ReportUnexpectedToken();
3682 } 3684 }
3683 } 3685 }
3684 return json_object; 3686 return json_object;
3685 } 3687 }
3686 3688
3687 3689
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
4698 Handle<String> source = Handle<String>(String::cast(script->source())); 4700 Handle<String> source = Handle<String>(String::cast(script->source()));
4699 result = parser.ParseProgram(source, info->is_global()); 4701 result = parser.ParseProgram(source, info->is_global());
4700 } 4702 }
4701 } 4703 }
4702 4704
4703 info->SetFunction(result); 4705 info->SetFunction(result);
4704 return (result != NULL); 4706 return (result != NULL);
4705 } 4707 }
4706 4708
4707 } } // namespace v8::internal 4709 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698