Index: third_party/WebKit/Source/bindings/core/v8/BindingSecurity.cpp |
diff --git a/third_party/WebKit/Source/bindings/core/v8/BindingSecurity.cpp b/third_party/WebKit/Source/bindings/core/v8/BindingSecurity.cpp |
index e79f6af8840253391420cfec41c14d750513f20c..45c83dd5917ca6982432dc4aaa82cde0e0d2577b 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/BindingSecurity.cpp |
+++ b/third_party/WebKit/Source/bindings/core/v8/BindingSecurity.cpp |
@@ -30,6 +30,7 @@ |
#include "bindings/core/v8/BindingSecurity.h" |
+#include "bindings/core/v8/ExceptionState.h" |
#include "bindings/core/v8/V8Binding.h" |
#include "core/dom/Document.h" |
#include "core/frame/LocalDOMWindow.h" |
@@ -222,4 +223,23 @@ bool BindingSecurity::shouldAllowAccessToDetachedWindow( |
exceptionState); |
} |
+void BindingSecurity::failedAccessCheckFor(v8::Isolate* isolate, |
+ const Frame* target) { |
+ // TODO(dcheng): See if this null check can be removed or hoisted to a |
+ // different location. |
+ if (!target) |
+ return; |
+ |
+ DOMWindow* targetWindow = target->domWindow(); |
+ |
+ // TODO(dcheng): Add ContextType, interface name, and property name as |
+ // arguments, so the generated exception can be more descriptive. |
+ ExceptionState exceptionState(isolate, ExceptionState::UnknownContext, |
+ nullptr, nullptr); |
+ exceptionState.throwSecurityError( |
+ targetWindow->sanitizedCrossDomainAccessErrorMessage( |
+ currentDOMWindow(isolate)), |
+ targetWindow->crossDomainAccessErrorMessage(currentDOMWindow(isolate))); |
+} |
+ |
} // namespace blink |