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

Side by Side Diff: src/objects.cc

Issue 2707263002: [api] Fix DescriptorInterceptor with access check. (Closed)
Patch Set: 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/cctest/test-api-interceptors.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <memory> 9 #include <memory>
10 #include <sstream> 10 #include <sstream>
(...skipping 6875 matching lines...) Expand 10 before | Expand all | Expand 10 after
6886 LookupIterator it = LookupIterator::PropertyOrElement( 6886 LookupIterator it = LookupIterator::PropertyOrElement(
6887 isolate, object, key, &success, LookupIterator::OWN); 6887 isolate, object, key, &success, LookupIterator::OWN);
6888 DCHECK(success); // ...so creating a LookupIterator can't fail. 6888 DCHECK(success); // ...so creating a LookupIterator can't fail.
6889 return GetOwnPropertyDescriptor(&it, desc); 6889 return GetOwnPropertyDescriptor(&it, desc);
6890 } 6890 }
6891 6891
6892 namespace { 6892 namespace {
6893 6893
6894 Maybe<bool> GetPropertyDescriptorWithInterceptor(LookupIterator* it, 6894 Maybe<bool> GetPropertyDescriptorWithInterceptor(LookupIterator* it,
6895 PropertyDescriptor* desc) { 6895 PropertyDescriptor* desc) {
6896 if (it->state() == LookupIterator::ACCESS_CHECK) {
jochen (gone - plz use gerrit) 2017/02/22 11:02:41 hum, if the state is ACCESS_CHECK we should do an
Franzi 2017/02/22 17:38:51 I wrongly assumed the interceptor would overrule t
6897 it->Next();
6898 }
6899
6896 if (it->state() == LookupIterator::INTERCEPTOR) { 6900 if (it->state() == LookupIterator::INTERCEPTOR) {
6897 Isolate* isolate = it->isolate(); 6901 Isolate* isolate = it->isolate();
6898 Handle<InterceptorInfo> interceptor = it->GetInterceptor(); 6902 Handle<InterceptorInfo> interceptor = it->GetInterceptor();
6899 if (!interceptor->descriptor()->IsUndefined(isolate)) { 6903 if (!interceptor->descriptor()->IsUndefined(isolate)) {
6900 Handle<Object> result; 6904 Handle<Object> result;
6901 Handle<JSObject> holder = it->GetHolder<JSObject>(); 6905 Handle<JSObject> holder = it->GetHolder<JSObject>();
6902 6906
6903 Handle<Object> receiver = it->GetReceiver(); 6907 Handle<Object> receiver = it->GetReceiver();
6904 if (!receiver->IsJSReceiver()) { 6908 if (!receiver->IsJSReceiver()) {
6905 ASSIGN_RETURN_ON_EXCEPTION_VALUE( 6909 ASSIGN_RETURN_ON_EXCEPTION_VALUE(
(...skipping 24 matching lines...) Expand all
6930 Utils::ApiCheck( 6934 Utils::ApiCheck(
6931 PropertyDescriptor::ToPropertyDescriptor(isolate, result, desc), 6935 PropertyDescriptor::ToPropertyDescriptor(isolate, result, desc),
6932 it->IsElement() ? "v8::IndexedPropertyDescriptorCallback" 6936 it->IsElement() ? "v8::IndexedPropertyDescriptorCallback"
6933 : "v8::NamedPropertyDescriptorCallback", 6937 : "v8::NamedPropertyDescriptorCallback",
6934 "Invalid property descriptor."); 6938 "Invalid property descriptor.");
6935 6939
6936 return Just(true); 6940 return Just(true);
6937 } 6941 }
6938 } 6942 }
6939 } 6943 }
6944 it->Restart();
6940 return Just(false); 6945 return Just(false);
6941 } 6946 }
6942 } // namespace 6947 } // namespace
6943 6948
6944 // ES6 9.1.5.1 6949 // ES6 9.1.5.1
6945 // Returns true on success, false if the property didn't exist, nothing if 6950 // Returns true on success, false if the property didn't exist, nothing if
6946 // an exception was thrown. 6951 // an exception was thrown.
6947 // static 6952 // static
6948 Maybe<bool> JSReceiver::GetOwnPropertyDescriptor(LookupIterator* it, 6953 Maybe<bool> JSReceiver::GetOwnPropertyDescriptor(LookupIterator* it,
6949 PropertyDescriptor* desc) { 6954 PropertyDescriptor* desc) {
(...skipping 13132 matching lines...) Expand 10 before | Expand all | Expand 10 after
20082 // depend on this. 20087 // depend on this.
20083 return DICTIONARY_ELEMENTS; 20088 return DICTIONARY_ELEMENTS;
20084 } 20089 }
20085 DCHECK_LE(kind, LAST_ELEMENTS_KIND); 20090 DCHECK_LE(kind, LAST_ELEMENTS_KIND);
20086 return kind; 20091 return kind;
20087 } 20092 }
20088 } 20093 }
20089 20094
20090 } // namespace internal 20095 } // namespace internal
20091 } // namespace v8 20096 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api-interceptors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698