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

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

Issue 1417023006: bindings: Refactors BindingSecurity::shouldAllowAccessToXXX. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Synced. Created 5 years, 1 month 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/custom/V8EventTargetCustom.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8EventTargetCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8EventTargetCustom.cpp
index 5852d683bb8b00753f17cc6b1823dba7353127ca..152837e8918314a11f64f719f2e53cc989387757 100644
--- a/third_party/WebKit/Source/bindings/core/v8/custom/V8EventTargetCustom.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8EventTargetCustom.cpp
@@ -81,13 +81,9 @@ void V8EventTarget::addEventListenerMethodCustom(const v8::FunctionCallbackInfo<
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "addEventListener", "EventTarget", info.Holder(), info.GetIsolate());
EventTarget* impl = V8EventTarget::toImpl(info.Holder());
- if (LocalDOMWindow* window = impl->toDOMWindow()) {
- if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), callingDOMWindow(info.GetIsolate()), window->frame(), exceptionState)) {
- exceptionState.throwIfNeeded();
- return;
- }
- if (!window->document())
haraken 2015/11/16 11:34:21 Is it ok to remove this check?
Yuki 2015/11/20 12:27:52 Yes, it's okay because if |window| does not have t
- return;
+ if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindow(info.GetIsolate()), impl, exceptionState)) {
+ exceptionState.throwIfNeeded();
+ return;
}
V8StringResource<TreatNullAsNullString> type;
RefPtrWillBeRawPtr<EventListener> listener;
@@ -127,13 +123,9 @@ void V8EventTarget::removeEventListenerMethodCustom(const v8::FunctionCallbackIn
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "removeEventListener", "EventTarget", info.Holder(), info.GetIsolate());
EventTarget* impl = V8EventTarget::toImpl(info.Holder());
- if (LocalDOMWindow* window = impl->toDOMWindow()) {
- if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), callingDOMWindow(info.GetIsolate()), window->frame(), exceptionState)) {
- exceptionState.throwIfNeeded();
- return;
- }
- if (!window->document())
haraken 2015/11/16 11:34:20 Ditto.
Yuki 2015/11/20 12:27:52 Ditto.
- return;
+ if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindow(info.GetIsolate()), impl, exceptionState)) {
+ exceptionState.throwIfNeeded();
+ return;
}
V8StringResource<TreatNullAsNullString> type;
RefPtrWillBeRawPtr<EventListener> listener;

Powered by Google App Engine
This is Rietveld 408576698