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

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: Rebase 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 result->Set(v8::Number::New(isolate, outputIndex++), listenerEntry); 168 result->Set(v8::Number::New(isolate, outputIndex++), listenerEntry);
169 } 169 }
170 return result; 170 return result;
171 } 171 }
172 172
173 void V8InjectedScriptHost::getEventListenersCallback(const v8::FunctionCallbackI nfo<v8::Value>& info) 173 void V8InjectedScriptHost::getEventListenersCallback(const v8::FunctionCallbackI nfo<v8::Value>& info)
174 { 174 {
175 if (info.Length() < 1) 175 if (info.Length() < 1)
176 return; 176 return;
177 177
178 unsigned filterMask = V8EventListenerInfo::EventListenerFilterShowPassive | V8EventListenerInfo::EventListenerFilterShowBlocking;
179 if (info.Length() > 1 && info[1]->IsTrue())
180 filterMask |= V8EventListenerInfo::EventListenerFilterShowDescendants;
181
182 if (info.Length() > 2 && info[2]->IsFalse())
183 filterMask &= ~V8EventListenerInfo::EventListenerFilterShowPassive;
184
185 if (info.Length() > 3 && info[3]->IsFalse())
186 filterMask &= ~V8EventListenerInfo::EventListenerFilterShowBlocking;
187
178 V8DebuggerClient* client = unwrapDebugger(info)->client(); 188 V8DebuggerClient* client = unwrapDebugger(info)->client();
179 V8EventListenerInfoList listenerInfo; 189 V8EventListenerInfoList listenerInfo;
180 // eventListeners call can produce message on ErrorEvent during lazy event l istener compilation. 190 // eventListeners call can produce message on ErrorEvent during lazy event l istener compilation.
181 client->muteWarningsAndDeprecations(); 191 client->muteWarningsAndDeprecations();
182 client->eventListeners(info[0], listenerInfo); 192 client->eventListeners(info[0], filterMask, listenerInfo);
183 client->unmuteWarningsAndDeprecations(); 193 client->unmuteWarningsAndDeprecations();
184 194
185 v8::Local<v8::Object> result = v8::Object::New(info.GetIsolate()); 195 v8::Local<v8::Object> result = v8::Object::New(info.GetIsolate());
186 protocol::HashSet<String16> types; 196 protocol::HashSet<String16> types;
187 for (auto& info : listenerInfo) 197 for (auto& info : listenerInfo)
188 types.add(info.eventType); 198 types.add(info.eventType);
189 for (const auto& it : types) { 199 for (const auto& it : types) {
190 v8::Local<v8::Array> listeners = wrapListenerFunctions(info.GetIsolate() , listenerInfo, it.first); 200 v8::Local<v8::Array> listeners = wrapListenerFunctions(info.GetIsolate() , listenerInfo, it.first);
191 if (!listeners->Length()) 201 if (!listeners->Length())
192 continue; 202 continue;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 { 291 {
282 return v8::Private::ForApi(isolate, toV8StringInternalized(isolate, "V8Debug ger#scopeExtension")); 292 return v8::Private::ForApi(isolate, toV8StringInternalized(isolate, "V8Debug ger#scopeExtension"));
283 } 293 }
284 294
285 bool V8Debugger::isRemoteObjectAPIMethod(const String16& name) 295 bool V8Debugger::isRemoteObjectAPIMethod(const String16& name)
286 { 296 {
287 return name == "bindRemoteObject"; 297 return name == "bindRemoteObject";
288 } 298 }
289 299
290 } // namespace blink 300 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698