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

Side by Side Diff: src/runtime/runtime-object.cc

Issue 1242093002: Fix getPrototypeOf for access checked objects (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Return null rather than undefined Created 5 years, 5 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 | « 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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/debug.h" 9 #include "src/debug.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 MaybeHandle<Object> Runtime::GetPrototype(Isolate* isolate, 187 MaybeHandle<Object> Runtime::GetPrototype(Isolate* isolate,
188 Handle<Object> obj) { 188 Handle<Object> obj) {
189 // We don't expect access checks to be needed on JSProxy objects. 189 // We don't expect access checks to be needed on JSProxy objects.
190 DCHECK(!obj->IsAccessCheckNeeded() || obj->IsJSObject()); 190 DCHECK(!obj->IsAccessCheckNeeded() || obj->IsJSObject());
191 PrototypeIterator iter(isolate, obj, PrototypeIterator::START_AT_RECEIVER); 191 PrototypeIterator iter(isolate, obj, PrototypeIterator::START_AT_RECEIVER);
192 do { 192 do {
193 if (PrototypeIterator::GetCurrent(iter)->IsAccessCheckNeeded() && 193 if (PrototypeIterator::GetCurrent(iter)->IsAccessCheckNeeded() &&
194 !isolate->MayAccess( 194 !isolate->MayAccess(
195 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)))) { 195 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)))) {
196 isolate->ReportFailedAccessCheck( 196 return isolate->factory()->null_value();
197 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)));
198 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
199 return isolate->factory()->undefined_value();
200 } 197 }
201 iter.AdvanceIgnoringProxies(); 198 iter.AdvanceIgnoringProxies();
202 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { 199 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) {
203 return PrototypeIterator::GetCurrent(iter); 200 return PrototypeIterator::GetCurrent(iter);
204 } 201 }
205 } while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)); 202 } while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN));
206 return PrototypeIterator::GetCurrent(iter); 203 return PrototypeIterator::GetCurrent(iter);
207 } 204 }
208 205
209 206
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); 1470 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3);
1474 1471
1475 RETURN_FAILURE_ON_EXCEPTION( 1472 RETURN_FAILURE_ON_EXCEPTION(
1476 isolate, 1473 isolate,
1477 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), 1474 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(),
1478 setter, attrs)); 1475 setter, attrs));
1479 return isolate->heap()->undefined_value(); 1476 return isolate->heap()->undefined_value();
1480 } 1477 }
1481 } // namespace internal 1478 } // namespace internal
1482 } // namespace v8 1479 } // namespace v8
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