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

Side by Side Diff: src/runtime.cc

Issue 6499013: Add access check when Object.keys is called on the global js proxy (fixes iss... (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 | test/cctest/test-api.cc » ('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 4199 matching lines...) Expand 10 before | Expand all | Expand 10 after
4210 } 4210 }
4211 4211
4212 4212
4213 static MaybeObject* Runtime_LocalKeys(Arguments args) { 4213 static MaybeObject* Runtime_LocalKeys(Arguments args) {
4214 ASSERT_EQ(args.length(), 1); 4214 ASSERT_EQ(args.length(), 1);
4215 CONVERT_CHECKED(JSObject, raw_object, args[0]); 4215 CONVERT_CHECKED(JSObject, raw_object, args[0]);
4216 HandleScope scope; 4216 HandleScope scope;
4217 Handle<JSObject> object(raw_object); 4217 Handle<JSObject> object(raw_object);
4218 4218
4219 if (object->IsJSGlobalProxy()) { 4219 if (object->IsJSGlobalProxy()) {
4220 // Do access checks before going to the global object.
4221 if (object->IsAccessCheckNeeded() &&
4222 !Top::MayNamedAccess(*object, Heap::undefined_value(),
4223 v8::ACCESS_KEYS)) {
4224 Top::ReportFailedAccessCheck(*object, v8::ACCESS_KEYS);
4225 return *Factory::NewJSArray(0);
4226 }
4227
4220 Handle<Object> proto(object->GetPrototype()); 4228 Handle<Object> proto(object->GetPrototype());
4221 // If proxy is detached we simply return an empty array. 4229 // If proxy is detached we simply return an empty array.
4222 if (proto->IsNull()) return *Factory::NewJSArray(0); 4230 if (proto->IsNull()) return *Factory::NewJSArray(0);
4223 object = Handle<JSObject>::cast(proto); 4231 object = Handle<JSObject>::cast(proto);
4224 } 4232 }
4225 4233
4226 Handle<FixedArray> contents = GetKeysInFixedArrayFor(object, 4234 Handle<FixedArray> contents = GetKeysInFixedArrayFor(object,
4227 LOCAL_ONLY); 4235 LOCAL_ONLY);
4228 // Some fast paths through GetKeysInFixedArrayFor reuse a cached 4236 // Some fast paths through GetKeysInFixedArrayFor reuse a cached
4229 // property array and since the result is mutable we have to create 4237 // property array and since the result is mutable we have to create
(...skipping 6957 matching lines...) Expand 10 before | Expand all | Expand 10 after
11187 } else { 11195 } else {
11188 // Handle last resort GC and make sure to allow future allocations 11196 // Handle last resort GC and make sure to allow future allocations
11189 // to grow the heap without causing GCs (if possible). 11197 // to grow the heap without causing GCs (if possible).
11190 Counters::gc_last_resort_from_js.Increment(); 11198 Counters::gc_last_resort_from_js.Increment();
11191 Heap::CollectAllGarbage(false); 11199 Heap::CollectAllGarbage(false);
11192 } 11200 }
11193 } 11201 }
11194 11202
11195 11203
11196 } } // namespace v8::internal 11204 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698