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

Side by Side Diff: src/objects.cc

Issue 8041020: Make sure that we can't access hidden properties by installing accessors on Object.prototype. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | test/cctest/test-api.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 3249 matching lines...) Expand 10 before | Expand all | Expand 10 after
3260 // in the prototype chain. 3260 // in the prototype chain.
3261 if (!obj->HasHiddenPropertiesObject()) { 3261 if (!obj->HasHiddenPropertiesObject()) {
3262 // Hidden properties object not found. Allocate a new hidden properties 3262 // Hidden properties object not found. Allocate a new hidden properties
3263 // object if requested. Otherwise return the undefined value. 3263 // object if requested. Otherwise return the undefined value.
3264 if (flag == ALLOW_CREATION) { 3264 if (flag == ALLOW_CREATION) {
3265 Object* hidden_obj; 3265 Object* hidden_obj;
3266 { MaybeObject* maybe_obj = heap->AllocateJSObject( 3266 { MaybeObject* maybe_obj = heap->AllocateJSObject(
3267 isolate->context()->global_context()->object_function()); 3267 isolate->context()->global_context()->object_function());
3268 if (!maybe_obj->ToObject(&hidden_obj)) return maybe_obj; 3268 if (!maybe_obj->ToObject(&hidden_obj)) return maybe_obj;
3269 } 3269 }
3270 // Don't allow leakage of the hidden object through accessors
3271 // on Object.prototype.
3272 {
3273 MaybeObject* maybe_obj =
3274 JSObject::cast(hidden_obj)->SetPrototype(heap->null_value(), false);
3275 if (maybe_obj->IsFailure()) return maybe_obj;
3276 }
3270 return obj->SetHiddenPropertiesObject(hidden_obj); 3277 return obj->SetHiddenPropertiesObject(hidden_obj);
3271 } else { 3278 } else {
3272 return heap->undefined_value(); 3279 return heap->undefined_value();
3273 } 3280 }
3274 } 3281 }
3275 return obj->GetHiddenPropertiesObject(); 3282 return obj->GetHiddenPropertiesObject();
3276 } 3283 }
3277 3284
3278 3285
3279 Smi* JSReceiver::GenerateIdentityHash() { 3286 Smi* JSReceiver::GenerateIdentityHash() {
(...skipping 8738 matching lines...) Expand 10 before | Expand all | Expand 10 after
12018 if (break_point_objects()->IsUndefined()) return 0; 12025 if (break_point_objects()->IsUndefined()) return 0;
12019 // Single break point. 12026 // Single break point.
12020 if (!break_point_objects()->IsFixedArray()) return 1; 12027 if (!break_point_objects()->IsFixedArray()) return 1;
12021 // Multiple break points. 12028 // Multiple break points.
12022 return FixedArray::cast(break_point_objects())->length(); 12029 return FixedArray::cast(break_point_objects())->length();
12023 } 12030 }
12024 #endif 12031 #endif
12025 12032
12026 12033
12027 } } // namespace v8::internal 12034 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | test/cctest/test-api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698