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

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: Fixed the assertion condition. 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 58528e582143bf48b4546ba67bc2c61159f8776c..2f0b950526e2645f706ef25cfd9f04bd23042c55 100644
--- a/third_party/WebKit/Source/bindings/core/v8/custom/V8EventTargetCustom.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8EventTargetCustom.cpp
@@ -78,13 +78,9 @@ void V8EventTarget::addEventListenerMethodCustom(const v8::FunctionCallbackInfo<
return;
}
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())
- return;
+ if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindow(info.GetIsolate()), impl, exceptionState)) {
+ exceptionState.throwIfNeeded();
+ return;
}
V8StringResource<> type;
RefPtrWillBeRawPtr<EventListener> listener;
@@ -121,13 +117,9 @@ void V8EventTarget::removeEventListenerMethodCustom(const v8::FunctionCallbackIn
return;
}
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())
- return;
+ if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindow(info.GetIsolate()), impl, exceptionState)) {
+ exceptionState.throwIfNeeded();
+ return;
}
V8StringResource<> type;
RefPtrWillBeRawPtr<EventListener> listener;

Powered by Google App Engine
This is Rietveld 408576698