| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/isolate.h" | 5 #include "src/isolate.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include <fstream> // NOLINT(readability/streams) | 9 #include <fstream> // NOLINT(readability/streams) |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 | 874 |
| 875 if (Context::cast(receiver_context)->security_token() == | 875 if (Context::cast(receiver_context)->security_token() == |
| 876 native_context->security_token()) | 876 native_context->security_token()) |
| 877 return true; | 877 return true; |
| 878 } | 878 } |
| 879 } | 879 } |
| 880 | 880 |
| 881 HandleScope scope(this); | 881 HandleScope scope(this); |
| 882 Handle<Object> data; | 882 Handle<Object> data; |
| 883 v8::AccessCheckCallback callback = nullptr; | 883 v8::AccessCheckCallback callback = nullptr; |
| 884 v8::NamedSecurityCallback named_callback = nullptr; | |
| 885 { DisallowHeapAllocation no_gc; | 884 { DisallowHeapAllocation no_gc; |
| 886 AccessCheckInfo* access_check_info = GetAccessCheckInfo(this, receiver); | 885 AccessCheckInfo* access_check_info = GetAccessCheckInfo(this, receiver); |
| 887 if (!access_check_info) return false; | 886 if (!access_check_info) return false; |
| 888 Object* fun_obj = access_check_info->callback(); | 887 Object* fun_obj = access_check_info->callback(); |
| 889 callback = v8::ToCData<v8::AccessCheckCallback>(fun_obj); | 888 callback = v8::ToCData<v8::AccessCheckCallback>(fun_obj); |
| 890 data = handle(access_check_info->data(), this); | 889 data = handle(access_check_info->data(), this); |
| 891 if (!callback) { | |
| 892 fun_obj = access_check_info->named_callback(); | |
| 893 named_callback = v8::ToCData<v8::NamedSecurityCallback>(fun_obj); | |
| 894 if (!named_callback) return false; | |
| 895 } | |
| 896 } | 890 } |
| 897 | 891 |
| 898 LOG(this, ApiSecurityCheck()); | 892 LOG(this, ApiSecurityCheck()); |
| 899 | 893 |
| 900 { | 894 { |
| 901 // Leaving JavaScript. | 895 // Leaving JavaScript. |
| 902 VMState<EXTERNAL> state(this); | 896 VMState<EXTERNAL> state(this); |
| 903 if (callback) { | 897 return callback(v8::Utils::ToLocal(accessing_context), |
| 904 return callback(v8::Utils::ToLocal(accessing_context), | 898 v8::Utils::ToLocal(receiver), v8::Utils::ToLocal(data)); |
| 905 v8::Utils::ToLocal(receiver), v8::Utils::ToLocal(data)); | |
| 906 } | |
| 907 Handle<Object> key = factory()->undefined_value(); | |
| 908 return named_callback(v8::Utils::ToLocal(receiver), v8::Utils::ToLocal(key), | |
| 909 v8::ACCESS_HAS, v8::Utils::ToLocal(data)); | |
| 910 } | 899 } |
| 911 } | 900 } |
| 912 | 901 |
| 913 | 902 |
| 914 const char* const Isolate::kStackOverflowMessage = | 903 const char* const Isolate::kStackOverflowMessage = |
| 915 "Uncaught RangeError: Maximum call stack size exceeded"; | 904 "Uncaught RangeError: Maximum call stack size exceeded"; |
| 916 | 905 |
| 917 | 906 |
| 918 Object* Isolate::StackOverflow() { | 907 Object* Isolate::StackOverflow() { |
| 919 HandleScope scope(this); | 908 HandleScope scope(this); |
| (...skipping 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3065 // Then check whether this scope intercepts. | 3054 // Then check whether this scope intercepts. |
| 3066 if ((flag & intercept_mask_)) { | 3055 if ((flag & intercept_mask_)) { |
| 3067 intercepted_flags_ |= flag; | 3056 intercepted_flags_ |= flag; |
| 3068 return true; | 3057 return true; |
| 3069 } | 3058 } |
| 3070 return false; | 3059 return false; |
| 3071 } | 3060 } |
| 3072 | 3061 |
| 3073 } // namespace internal | 3062 } // namespace internal |
| 3074 } // namespace v8 | 3063 } // namespace v8 |
| OLD | NEW |