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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/WrapperCreationSecurityCheck.h

Issue 2745313003: Move securityCheck out of V8WrapperInstantiationScope (Closed)
Patch Set: Add comments and DCHECKs Created 3 years, 8 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
OLDNEW
(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 #ifndef WrapperCreationSecurityCheck_h
6 #define WrapperCreationSecurityCheck_h
7
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::Isolate*,
24 v8::Local<v8::Context>,
25 const WrapperTypeInfo*);
26 using RethrowExceptionFunction = void (*)(v8::Isolate*,
27 v8::Local<v8::Context>,
28 const WrapperTypeInfo*,
29 v8::Local<v8::Value>);
30
31 static void setSecurityCheckFunction(SecurityCheckFunction);
32 static void setRethrowExceptionFunction(RethrowExceptionFunction);
33
34 static bool verifyContextAccess(v8::Isolate*,
35 v8::Local<v8::Context> creationContext,
36 const WrapperTypeInfo*);
37 static void rethrowCrossContextException(
38 v8::Isolate*,
39 v8::Local<v8::Context> creationContext,
40 const WrapperTypeInfo*,
41 v8::Local<v8::Value> crossContextException);
42
43 private:
44 static SecurityCheckFunction s_securityCheck;
45 static RethrowExceptionFunction s_rethrowException;
46 };
47
48 } // namespace blink
49
50 #endif // WrapperCreationSecurityCheck_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698