OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium 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 #ifndef WrapperCreationSecurityCheck_h | 5 #ifndef WrapperCreationSecurityCheck_h |
6 #define WrapperCreationSecurityCheck_h | 6 #define WrapperCreationSecurityCheck_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "platform/wtf/Allocator.h" | 9 #include "platform/wtf/Allocator.h" |
10 #include "v8/include/v8.h" | 10 #include "v8/include/v8.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 struct WrapperTypeInfo; | 14 struct WrapperTypeInfo; |
15 | 15 |
16 // This class holds pointers to functions that implement creation context access | 16 // This class holds pointers to functions that implement creation context access |
17 // and exception rethrowing logic required by V8WrapperInstantiationScope when | 17 // and exception rethrowing logic required by V8WrapperInstantiationScope when |
18 // creating wrappers. | 18 // creating wrappers. |
19 class CORE_EXPORT WrapperCreationSecurityCheck { | 19 class PLATFORM_EXPORT WrapperCreationSecurityCheck { |
20 STATIC_ONLY(WrapperCreationSecurityCheck); | 20 STATIC_ONLY(WrapperCreationSecurityCheck); |
21 | 21 |
22 public: | 22 public: |
23 using SecurityCheckFunction = bool (*)(v8::Local<v8::Context>, | 23 using SecurityCheckFunction = bool (*)(v8::Local<v8::Context>, |
24 const WrapperTypeInfo*); | 24 const WrapperTypeInfo*); |
25 using RethrowExceptionFunction = void (*)(v8::Local<v8::Context>, | 25 using RethrowExceptionFunction = void (*)(v8::Local<v8::Context>, |
26 const WrapperTypeInfo*, | 26 const WrapperTypeInfo*, |
27 v8::Local<v8::Value>); | 27 v8::Local<v8::Value>); |
28 | 28 |
29 static void SetSecurityCheckFunction(SecurityCheckFunction); | 29 static void SetSecurityCheckFunction(SecurityCheckFunction); |
30 static void SetRethrowExceptionFunction(RethrowExceptionFunction); | 30 static void SetRethrowExceptionFunction(RethrowExceptionFunction); |
31 | 31 |
32 static bool VerifyContextAccess(v8::Local<v8::Context> creation_context, | 32 static bool VerifyContextAccess(v8::Local<v8::Context> creation_context, |
33 const WrapperTypeInfo*); | 33 const WrapperTypeInfo*); |
34 static void RethrowCrossContextException( | 34 static void RethrowCrossContextException( |
35 v8::Local<v8::Context> creation_context, | 35 v8::Local<v8::Context> creation_context, |
36 const WrapperTypeInfo*, | 36 const WrapperTypeInfo*, |
37 v8::Local<v8::Value> cross_context_exception); | 37 v8::Local<v8::Value> cross_context_exception); |
38 | 38 |
39 private: | 39 private: |
40 static SecurityCheckFunction security_check_; | 40 static SecurityCheckFunction security_check_; |
41 static RethrowExceptionFunction rethrow_exception_; | 41 static RethrowExceptionFunction rethrow_exception_; |
42 }; | 42 }; |
43 | 43 |
44 } // namespace blink | 44 } // namespace blink |
45 | 45 |
46 #endif // WrapperCreationSecurityCheck_h | 46 #endif // WrapperCreationSecurityCheck_h |
OLD | NEW |