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

Side by Side Diff: src/objects.cc

Issue 6534019: Add access checks to Object.preventExtensions + add regression test for 1027.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 10 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 | src/runtime.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 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 2795 matching lines...) Expand 10 before | Expand all | Expand 10 after
2806 return context->extension()->ReferencesObject(obj); 2806 return context->extension()->ReferencesObject(obj);
2807 } 2807 }
2808 } 2808 }
2809 2809
2810 // No references to object. 2810 // No references to object.
2811 return false; 2811 return false;
2812 } 2812 }
2813 2813
2814 2814
2815 MaybeObject* JSObject::PreventExtensions() { 2815 MaybeObject* JSObject::PreventExtensions() {
2816 if (IsAccessCheckNeeded() &&
2817 !Top::MayNamedAccess(this, Heap::undefined_value(), v8::ACCESS_KEYS)) {
2818 Top::ReportFailedAccessCheck(this, v8::ACCESS_KEYS);
2819 return Heap::false_value();
2820 }
2821
2816 if (IsJSGlobalProxy()) { 2822 if (IsJSGlobalProxy()) {
2817 Object* proto = GetPrototype(); 2823 Object* proto = GetPrototype();
2818 if (proto->IsNull()) return this; 2824 if (proto->IsNull()) return this;
2819 ASSERT(proto->IsJSGlobalObject()); 2825 ASSERT(proto->IsJSGlobalObject());
2820 return JSObject::cast(proto)->PreventExtensions(); 2826 return JSObject::cast(proto)->PreventExtensions();
2821 } 2827 }
2822 2828
2823 // If there are fast elements we normalize. 2829 // If there are fast elements we normalize.
2824 if (HasFastElements()) { 2830 if (HasFastElements()) {
2825 Object* ok; 2831 Object* ok;
(...skipping 7159 matching lines...) Expand 10 before | Expand all | Expand 10 after
9985 if (break_point_objects()->IsUndefined()) return 0; 9991 if (break_point_objects()->IsUndefined()) return 0;
9986 // Single beak point. 9992 // Single beak point.
9987 if (!break_point_objects()->IsFixedArray()) return 1; 9993 if (!break_point_objects()->IsFixedArray()) return 1;
9988 // Multiple break points. 9994 // Multiple break points.
9989 return FixedArray::cast(break_point_objects())->length(); 9995 return FixedArray::cast(break_point_objects())->length();
9990 } 9996 }
9991 #endif 9997 #endif
9992 9998
9993 9999
9994 } } // namespace v8::internal 10000 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/runtime.cc » ('j') | test/cctest/test-api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698