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

Side by Side Diff: src/builtins/builtins-api.cc

Issue 2702123002: Always early return from HandleApiCallHelper on access check failure. (Closed)
Patch Set: Return undefined for now Created 3 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
« no previous file with comments | « no previous file | test/unittests/BUILD.gn » ('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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/builtins/builtins.h" 5 #include "src/builtins/builtins.h"
6 6
7 #include "src/api-arguments.h" 7 #include "src/api-arguments.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/builtins/builtins-utils.h" 9 #include "src/builtins/builtins-utils.h"
10 #include "src/counters.h" 10 #include "src/counters.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 isolate, NewTypeError(MessageTemplate::kIllegalInvocation), Object); 74 isolate, NewTypeError(MessageTemplate::kIllegalInvocation), Object);
75 } 75 }
76 76
77 js_receiver = Handle<JSObject>::cast(receiver); 77 js_receiver = Handle<JSObject>::cast(receiver);
78 78
79 if (!fun_data->accept_any_receiver() && 79 if (!fun_data->accept_any_receiver() &&
80 js_receiver->IsAccessCheckNeeded() && 80 js_receiver->IsAccessCheckNeeded() &&
81 !isolate->MayAccess(handle(isolate->context()), js_receiver)) { 81 !isolate->MayAccess(handle(isolate->context()), js_receiver)) {
82 isolate->ReportFailedAccessCheck(js_receiver); 82 isolate->ReportFailedAccessCheck(js_receiver);
83 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); 83 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
84 return isolate->factory()->undefined_value();
84 } 85 }
85 86
86 raw_holder = GetCompatibleReceiver(isolate, *fun_data, *js_receiver); 87 raw_holder = GetCompatibleReceiver(isolate, *fun_data, *js_receiver);
87 88
88 if (raw_holder == nullptr) { 89 if (raw_holder == nullptr) {
89 // This function cannot be called with the given receiver. Abort! 90 // This function cannot be called with the given receiver. Abort!
90 THROW_NEW_ERROR( 91 THROW_NEW_ERROR(
91 isolate, NewTypeError(MessageTemplate::kIllegalInvocation), Object); 92 isolate, NewTypeError(MessageTemplate::kIllegalInvocation), Object);
92 } 93 }
93 } 94 }
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 } 287 }
287 288
288 // Handle calls to non-function objects created through the API. This delegate 289 // Handle calls to non-function objects created through the API. This delegate
289 // function is used when the call is a construct call. 290 // function is used when the call is a construct call.
290 BUILTIN(HandleApiCallAsConstructor) { 291 BUILTIN(HandleApiCallAsConstructor) {
291 return HandleApiCallAsFunctionOrConstructor(isolate, true, args); 292 return HandleApiCallAsFunctionOrConstructor(isolate, true, args);
292 } 293 }
293 294
294 } // namespace internal 295 } // namespace internal
295 } // namespace v8 296 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/unittests/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698