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

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

Issue 2439013002: Implement cross-origin attributes using access check interceptors. (Closed)
Patch Set: Clean up named enumerator interceptor. Created 4 years 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/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..6edc185e54b752afb9a33263d240a2c40c610a32 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,24 @@ 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();
+
+ // FIXME: We should modify V8 to pass in more contextual information (context,
+ // property, and object).
+ ExceptionState exceptionState(ExceptionState::UnknownContext, 0, 0,
Yuki 2016/12/07 12:03:40 ExceptionState should be created in the call sites
haraken 2016/12/08 08:21:02 What do you mean? Note that BindingSecurity::faile
dcheng 2016/12/08 09:04:10 I moved this around to make it so the interceptors
Yuki 2016/12/09 07:02:49 Both of failedAccessCheckCallbackInMainThread and
dcheng 2016/12/09 07:35:20 That's correct. However, if an interceptor is inst
+ isolate->GetCurrentContext()->Global(),
+ isolate);
+ exceptionState.throwSecurityError(
+ targetWindow->sanitizedCrossDomainAccessErrorMessage(
+ currentDOMWindow(isolate)),
+ targetWindow->crossDomainAccessErrorMessage(currentDOMWindow(isolate)));
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698