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