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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8InjectedScriptHost.cpp

Issue 1950403002: Add the ability to return descedant event listeners. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/v8_inspector/V8InjectedScriptHost.h" 5 #include "platform/v8_inspector/V8InjectedScriptHost.h"
6 6
7 #include "platform/inspector_protocol/String16.h" 7 #include "platform/inspector_protocol/String16.h"
8 #include "platform/v8_inspector/InjectedScriptNative.h" 8 #include "platform/v8_inspector/InjectedScriptNative.h"
9 #include "platform/v8_inspector/V8Compat.h" 9 #include "platform/v8_inspector/V8Compat.h"
10 #include "platform/v8_inspector/V8DebuggerImpl.h" 10 #include "platform/v8_inspector/V8DebuggerImpl.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 result->Set(v8::Number::New(isolate, outputIndex++), listenerEntry); 160 result->Set(v8::Number::New(isolate, outputIndex++), listenerEntry);
161 } 161 }
162 return result; 162 return result;
163 } 163 }
164 164
165 void V8InjectedScriptHost::getEventListenersCallback(const v8::FunctionCallbackI nfo<v8::Value>& info) 165 void V8InjectedScriptHost::getEventListenersCallback(const v8::FunctionCallbackI nfo<v8::Value>& info)
166 { 166 {
167 if (info.Length() < 1) 167 if (info.Length() < 1)
168 return; 168 return;
169 169
170 unsigned filterMask = V8EventListenerInfo::EventListenerFilterShowPassive | V8EventListenerInfo::EventListenerFilterShowBlocking;
171 if (info.Length() > 1 && info[1]->IsTrue())
172 filterMask |= V8EventListenerInfo::EventListenerFilterShowDescendants;
173
174 if (info.Length() > 2 && info[2]->IsFalse())
175 filterMask &= ~V8EventListenerInfo::EventListenerFilterShowPassive;
176
177 if (info.Length() > 3 && info[3]->IsFalse())
178 filterMask &= ~V8EventListenerInfo::EventListenerFilterShowBlocking;
179
170 V8DebuggerClient* client = unwrapDebugger(info)->client(); 180 V8DebuggerClient* client = unwrapDebugger(info)->client();
171 V8EventListenerInfoList listenerInfo; 181 V8EventListenerInfoList listenerInfo;
172 // eventListeners call can produce message on ErrorEvent during lazy event l istener compilation. 182 // eventListeners call can produce message on ErrorEvent during lazy event l istener compilation.
173 client->muteWarningsAndDeprecations(); 183 client->muteWarningsAndDeprecations();
174 client->eventListeners(info[0], listenerInfo); 184 client->eventListeners(info[0], filterMask, listenerInfo);
175 client->unmuteWarningsAndDeprecations(); 185 client->unmuteWarningsAndDeprecations();
176 186
177 v8::Local<v8::Object> result = v8::Object::New(info.GetIsolate()); 187 v8::Local<v8::Object> result = v8::Object::New(info.GetIsolate());
178 protocol::HashSet<String16> types; 188 protocol::HashSet<String16> types;
179 for (auto& info : listenerInfo) 189 for (auto& info : listenerInfo)
180 types.add(info.eventType); 190 types.add(info.eventType);
181 for (const auto& it : types) { 191 for (const auto& it : types) {
182 v8::Local<v8::Array> listeners = wrapListenerFunctions(info.GetIsolate() , listenerInfo, it.first); 192 v8::Local<v8::Array> listeners = wrapListenerFunctions(info.GetIsolate() , listenerInfo, it.first);
183 if (!listeners->Length()) 193 if (!listeners->Length())
184 continue; 194 continue;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 { 342 {
333 return v8::Private::ForApi(isolate, toV8StringInternalized(isolate, "V8Debug ger#scopeExtension")); 343 return v8::Private::ForApi(isolate, toV8StringInternalized(isolate, "V8Debug ger#scopeExtension"));
334 } 344 }
335 345
336 bool V8Debugger::isRemoteObjectAPIMethod(const String16& name) 346 bool V8Debugger::isRemoteObjectAPIMethod(const String16& name)
337 { 347 {
338 return name == "bindRemoteObject"; 348 return name == "bindRemoteObject";
339 } 349 }
340 350
341 } // namespace blink 351 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698