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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/WrapperCreationSecurityCheck.cpp

Issue 2745313003: Move securityCheck out of V8WrapperInstantiationScope (Closed)
Patch Set: Code review changes 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/WrapperCreationSecurityCheck.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/WrapperCreationSecurityCheck.cpp b/third_party/WebKit/Source/bindings/core/v8/WrapperCreationSecurityCheck.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d820cc761bae00926d9f21274171c17ecd0f8986
--- /dev/null
+++ b/third_party/WebKit/Source/bindings/core/v8/WrapperCreationSecurityCheck.cpp
@@ -0,0 +1,41 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "bindings/core/v8/WrapperCreationSecurityCheck.h"
+
+#include "bindings/core/v8/WrapperTypeInfo.h"
+
+namespace blink {
+
+WrapperCreationSecurityCheck::SecurityCheckFunction
+ WrapperCreationSecurityCheck::s_securityCheck = nullptr;
+WrapperCreationSecurityCheck::RethrowExceptionFunction
+ WrapperCreationSecurityCheck::s_rethrowException = nullptr;
+
+void WrapperCreationSecurityCheck::setSecurityCheckFunction(
+ SecurityCheckFunction func) {
+ s_securityCheck = func;
haraken 2017/04/07 04:23:36 Add DCHECK(!s_securityCheck).
adithyas 2017/04/07 18:42:53 Added DCHECK here and below.
+}
+
+void WrapperCreationSecurityCheck::setRethrowExceptionFunction(
+ RethrowExceptionFunction func) {
+ s_rethrowException = func;
haraken 2017/04/07 04:23:36 Ditto.
+}
+
+bool WrapperCreationSecurityCheck::verifyContextAccess(
+ v8::Isolate* isolate,
+ v8::Local<v8::Context> creationContext,
+ const WrapperTypeInfo* type) {
+ return (*s_securityCheck)(isolate, creationContext, type);
+}
+
+void WrapperCreationSecurityCheck::rethrowCrossContextException(
+ v8::Isolate* isolate,
+ v8::Local<v8::Context> creationContext,
+ const WrapperTypeInfo* type,
+ v8::Local<v8::Value> crossContextException) {
+ (*s_rethrowException)(isolate, creationContext, type, crossContextException);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698