Chromium Code Reviews| Index: third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp |
| diff --git a/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp b/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp |
| index 5feed2b53378580d95ed3c82e61b9a35f98fa700..5ac1d108008d661356ce515e205ed716d55b326e 100644 |
| --- a/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp |
| +++ b/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp |
| @@ -298,10 +298,26 @@ void ThreadDebugger::getEventListenersCallback(const v8::FunctionCallbackInfo<v8 |
| v8::Isolate* isolate = info.GetIsolate(); |
| v8::Local<v8::Context> context = isolate->GetCurrentContext(); |
| + EventListenerFilter filterMask = EventListenerFilter::ShowPassive | EventListenerFilter::ShowBlocking; |
| + if (info.Length() > 1 && info[1]->IsObject()) { |
| + v8::Local<v8::Object> options = v8::Local<v8::Object>::Cast(info[1]); |
| + |
| + v8::Local<v8::Value> setting; |
| + if (options->Get(context, v8String(isolate, "descendants")).ToLocal(&setting) && setting->IsTrue()) |
| + filterMask |= EventListenerFilter::ShowDescendants; |
| + |
| + if (options->Get(context, v8String(isolate, "passive")).ToLocal(&setting) && !setting->IsUndefined()) { |
| + if (setting->IsFalse()) |
| + filterMask &= ~EventListenerFilter::ShowPassive; |
| + else |
| + filterMask &= ~EventListenerFilter::ShowBlocking; |
| + } |
| + } |
| + |
| V8EventListenerInfoList listenerInfo; |
| // eventListeners call can produce message on ErrorEvent during lazy event listener compilation. |
| debugger->muteWarningsAndDeprecations(); |
| - InspectorDOMDebuggerAgent::eventListenersInfoForTarget(isolate, info[0], listenerInfo); |
| + InspectorDOMDebuggerAgent::eventListenersInfoForTarget(isolate, info[0], filterMask, listenerInfo); |
|
pfeldman
2016/05/27 21:54:01
We should not mix data from different worlds in th
dtapuska
2016/05/27 22:12:39
Yes there is a check inside the query. Is there so
pfeldman
2016/05/27 22:32:12
We want InspectorDOMDebuggerAgent::eventListenersI
dtapuska
2016/05/31 21:26:07
Can you be more explicit of which security checks?
|
| debugger->unmuteWarningsAndDeprecations(); |
| v8::Local<v8::Object> result = v8::Object::New(isolate); |
| @@ -317,9 +333,15 @@ void ThreadDebugger::getEventListenersCallback(const v8::FunctionCallbackInfo<v8 |
| for (auto& info : listenerInfo) { |
| if (currentEventType != info.eventType) { |
| currentEventType = info.eventType; |
| - listeners = v8::Array::New(isolate); |
| - outputIndex = 0; |
| - result->Set(v8String(isolate, currentEventType), listeners); |
| + v8::Local<v8::Value> matchingList; |
| + if (result->Get(context, v8String(isolate, currentEventType)).ToLocal(&matchingList) && matchingList->IsArray()) { |
| + listeners = v8::Local<v8::Array>::Cast(matchingList); |
| + outputIndex = listeners->Length(); |
| + } else { |
| + listeners = v8::Array::New(isolate); |
| + outputIndex = 0; |
| + result->Set(v8String(isolate, currentEventType), listeners); |
| + } |
| } |
| v8::Local<v8::Object> listenerObject = v8::Object::New(isolate); |