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

Unified Diff: Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp

Issue 1042853004: [DevTools] Event Listeners Sidebar shows window listeners (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Extracted eventListenersTreeOutline.css Created 5 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
« no previous file with comments | « Source/bindings/core/v8/ScriptEventListener.cpp ('k') | Source/core/core.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp
diff --git a/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp b/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp
index 91ce8b8bfea0cb01c69d9956479c9dc6e640d601..a64d92af4eeaad96b541ecc97bf3c68ef0bb58d5 100644
--- a/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -54,6 +54,7 @@
#include "bindings/core/v8/V8ScriptRunner.h"
#include "core/events/EventTarget.h"
#include "core/frame/LocalDOMWindow.h"
+#include "core/inspector/EventListenerInfo.h"
#include "core/inspector/InjectedScript.h"
#include "core/inspector/InjectedScriptHost.h"
#include "core/inspector/InspectorDOMAgent.h"
@@ -80,6 +81,23 @@ ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* scriptState, Node
return ScriptValue(scriptState, toV8(node, scriptState->context()->Global(), isolate));
}
+EventTarget* InjectedScriptHost::scriptValueAsEventTarget(ScriptState* scriptState, ScriptValue value)
+{
+ ScriptState::Scope scope(scriptState);
+ if (!value.isObject() || value.isNull())
+ return nullptr;
+ v8::Isolate* isolate = scriptState->isolate();
+ EventTarget* target = V8EventTarget::toImplWithTypeCheck(isolate, v8::Local<v8::Object>::Cast(value.v8Value()));
+
+ // We need to handle a LocalDOMWindow specially, because a LocalDOMWindow wrapper exists on a prototype chain.
+ if (!target)
+ target = toDOMWindow(isolate, v8::Local<v8::Object>::Cast(value.v8Value()));
+
+ if (!target || !target->executionContext())
+ return nullptr;
+ return target;
+}
+
void V8InjectedScriptHost::inspectedObjectMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
if (info.Length() < 1)
« no previous file with comments | « Source/bindings/core/v8/ScriptEventListener.cpp ('k') | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698