OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "bindings/core/v8/WrapperCreationSecurityCheck.h" | |
6 | |
7 #include "bindings/core/v8/WrapperTypeInfo.h" | |
8 | |
9 namespace blink { | |
10 | |
11 WrapperCreationSecurityCheck::SecurityCheckFunction | |
12 WrapperCreationSecurityCheck::security_check_ = nullptr; | |
13 WrapperCreationSecurityCheck::RethrowExceptionFunction | |
14 WrapperCreationSecurityCheck::rethrow_exception_ = nullptr; | |
15 | |
16 void WrapperCreationSecurityCheck::SetSecurityCheckFunction( | |
17 SecurityCheckFunction func) { | |
18 DCHECK(!security_check_); | |
19 security_check_ = func; | |
20 } | |
21 | |
22 void WrapperCreationSecurityCheck::SetRethrowExceptionFunction( | |
23 RethrowExceptionFunction func) { | |
24 DCHECK(!rethrow_exception_); | |
25 rethrow_exception_ = func; | |
26 } | |
27 | |
28 bool WrapperCreationSecurityCheck::VerifyContextAccess( | |
29 v8::Local<v8::Context> creation_context, | |
30 const WrapperTypeInfo* type) { | |
31 return (*security_check_)(creation_context, type); | |
32 } | |
33 | |
34 void WrapperCreationSecurityCheck::RethrowCrossContextException( | |
35 v8::Local<v8::Context> creation_context, | |
36 const WrapperTypeInfo* type, | |
37 v8::Local<v8::Value> cross_context_exception) { | |
38 (*rethrow_exception_)(creation_context, type, cross_context_exception); | |
39 } | |
40 | |
41 } // namespace blink | |
OLD | NEW |