Chromium Code Reviews| Index: third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.cpp |
| diff --git a/third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.cpp |
| index 3cefc9b5b95fe73157dbadcf6b849b203c9d0fc4..44697924e63c290030a1aaea84262b968c3c3581 100644 |
| --- a/third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.cpp |
| +++ b/third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.cpp |
| @@ -38,6 +38,7 @@ |
| #include "core/events/EventTarget.h" |
| #include "core/frame/LocalDOMWindow.h" |
| #include "core/inspector/InspectorDOMAgent.h" |
| +#include "core/inspector/V8InspectorStringConversion.h" |
| #include "platform/v8_inspector/public/V8InspectorSession.h" |
| namespace { |
| @@ -309,7 +310,7 @@ void InspectorDOMDebuggerAgent::didInvalidateStyleAttr(Node* node) |
| if (hasBreakpoint(node, AttributeModified)) { |
| std::unique_ptr<protocol::DictionaryValue> eventData = protocol::DictionaryValue::create(); |
| descriptionForDOMEvent(node, AttributeModified, false, eventData.get()); |
| - m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::DOM, eventData->toJSONString()); |
| + m_v8Session->breakProgram(v8_inspector::protocol::Debugger::API::Paused::ReasonEnum::DOM, toV8InspectorString(eventData->toJSONString())); |
| } |
| } |
| @@ -411,15 +412,18 @@ void InspectorDOMDebuggerAgent::getEventListeners(ErrorString* errorString, cons |
| v8::HandleScope handles(m_isolate); |
| v8::Local<v8::Value> value; |
| v8::Local<v8::Context> context; |
| - String16 objectGroup; |
| - if (!m_v8Session->unwrapObject(errorString, objectId, &value, &context, &objectGroup)) |
| + v8_inspector::String16 objectGroup; |
| + v8_inspector::String16 error; |
| + if (!m_v8Session->unwrapObject(&error, toV8InspectorString(objectId), &value, &context, &objectGroup)) { |
| + *errorString = toCoreString(error); |
| return; |
| + } |
| v8::Context::Scope scope(context); |
| *listenersArray = protocol::Array<protocol::DOMDebugger::EventListener>::create(); |
| - eventListeners(context, value, objectGroup, listenersArray->get()); |
| + eventListeners(context, value, toCoreString(objectGroup), listenersArray->get()); |
| } |
| -void InspectorDOMDebuggerAgent::eventListeners(v8::Local<v8::Context> context, v8::Local<v8::Value> object, const String16& objectGroup, protocol::Array<protocol::DOMDebugger::EventListener>* listenersArray) |
| +void InspectorDOMDebuggerAgent::eventListeners(v8::Local<v8::Context> context, v8::Local<v8::Value> object, const String& objectGroup, protocol::Array<protocol::DOMDebugger::EventListener>* listenersArray) |
| { |
| V8EventListenerInfoList eventInformation; |
| InspectorDOMDebuggerAgent::eventListenersInfoForTarget(context->GetIsolate(), object, eventInformation); |
| @@ -439,7 +443,7 @@ void InspectorDOMDebuggerAgent::eventListeners(v8::Local<v8::Context> context, v |
| } |
| } |
| -std::unique_ptr<protocol::DOMDebugger::EventListener> InspectorDOMDebuggerAgent::buildObjectForEventListener(v8::Local<v8::Context> context, const V8EventListenerInfo& info, const String16& objectGroupId) |
| +std::unique_ptr<protocol::DOMDebugger::EventListener> InspectorDOMDebuggerAgent::buildObjectForEventListener(v8::Local<v8::Context> context, const V8EventListenerInfo& info, const String& objectGroupId) |
| { |
| if (info.handler.IsEmpty()) |
| return nullptr; |
| @@ -462,11 +466,11 @@ std::unique_ptr<protocol::DOMDebugger::EventListener> InspectorDOMDebuggerAgent: |
| .setLineNumber(lineNumber) |
| .setColumnNumber(columnNumber).build(); |
| if (!objectGroupId.isEmpty()) { |
| - value->setHandler(m_v8Session->wrapObject(context, function, objectGroupId)); |
| - value->setOriginalHandler(m_v8Session->wrapObject(context, info.handler, objectGroupId)); |
| + value->setHandler(m_v8Session->wrapObject(context, function, toV8InspectorString(objectGroupId))); |
| + value->setOriginalHandler(m_v8Session->wrapObject(context, info.handler, toV8InspectorString(objectGroupId))); |
| v8::Local<v8::Function> removeFunction; |
| if (info.removeFunction.ToLocal(&removeFunction)) |
| - value->setRemoveFunction(m_v8Session->wrapObject(context, removeFunction, objectGroupId)); |
| + value->setRemoveFunction(m_v8Session->wrapObject(context, removeFunction, toV8InspectorString(objectGroupId))); |
| } |
| return value; |
| } |
| @@ -481,7 +485,7 @@ void InspectorDOMDebuggerAgent::willInsertDOMNode(Node* parent) |
| if (hasBreakpoint(parent, SubtreeModified)) { |
| std::unique_ptr<protocol::DictionaryValue> eventData = protocol::DictionaryValue::create(); |
| descriptionForDOMEvent(parent, SubtreeModified, true, eventData.get()); |
| - m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::DOM, eventData->toJSONString()); |
| + m_v8Session->breakProgram(v8_inspector::protocol::Debugger::API::Paused::ReasonEnum::DOM, toV8InspectorString(eventData->toJSONString())); |
| } |
| } |
| @@ -491,11 +495,11 @@ void InspectorDOMDebuggerAgent::willRemoveDOMNode(Node* node) |
| if (hasBreakpoint(node, NodeRemoved)) { |
| std::unique_ptr<protocol::DictionaryValue> eventData = protocol::DictionaryValue::create(); |
| descriptionForDOMEvent(node, NodeRemoved, false, eventData.get()); |
| - m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::DOM, eventData->toJSONString()); |
| + m_v8Session->breakProgram(v8_inspector::protocol::Debugger::API::Paused::ReasonEnum::DOM, toV8InspectorString(eventData->toJSONString())); |
| } else if (parentNode && hasBreakpoint(parentNode, SubtreeModified)) { |
| std::unique_ptr<protocol::DictionaryValue> eventData = protocol::DictionaryValue::create(); |
| descriptionForDOMEvent(node, SubtreeModified, false, eventData.get()); |
| - m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::DOM, eventData->toJSONString()); |
| + m_v8Session->breakProgram(v8_inspector::protocol::Debugger::API::Paused::ReasonEnum::DOM, toV8InspectorString(eventData->toJSONString())); |
| } |
| didRemoveDOMNode(node); |
| } |
| @@ -505,7 +509,7 @@ void InspectorDOMDebuggerAgent::willModifyDOMAttr(Element* element, const Atomic |
| if (hasBreakpoint(element, AttributeModified)) { |
| std::unique_ptr<protocol::DictionaryValue> eventData = protocol::DictionaryValue::create(); |
| descriptionForDOMEvent(element, AttributeModified, false, eventData.get()); |
| - m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::DOM, eventData->toJSONString()); |
| + m_v8Session->breakProgram(v8_inspector::protocol::Debugger::API::Paused::ReasonEnum::DOM, toV8InspectorString(eventData->toJSONString())); |
| } |
| } |
| @@ -572,9 +576,9 @@ void InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded(std::unique_ptr<proto |
| if (!eventData) |
| return; |
| if (synchronous) |
| - m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::EventListener, eventData->toJSONString()); |
| + m_v8Session->breakProgram(v8_inspector::protocol::Debugger::API::Paused::ReasonEnum::EventListener, toV8InspectorString(eventData->toJSONString())); |
| else |
| - m_v8Session->schedulePauseOnNextStatement(protocol::Debugger::API::Paused::ReasonEnum::EventListener, eventData->toJSONString()); |
| + m_v8Session->schedulePauseOnNextStatement(v8_inspector::protocol::Debugger::API::Paused::ReasonEnum::EventListener, toV8InspectorString(eventData->toJSONString())); |
| } |
| std::unique_ptr<protocol::DictionaryValue> InspectorDOMDebuggerAgent::preparePauseOnNativeEventData(const String& eventName, const String* targetName) |
| @@ -676,7 +680,7 @@ void InspectorDOMDebuggerAgent::willSendXMLHttpOrFetchNetworkRequest(const Strin |
| std::unique_ptr<protocol::DictionaryValue> eventData = protocol::DictionaryValue::create(); |
| eventData->setString("breakpointURL", breakpointURL); |
| eventData->setString("url", url); |
| - m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::XHR, eventData->toJSONString()); |
| + m_v8Session->breakProgram(v8_inspector::protocol::Debugger::API::Paused::ReasonEnum::XHR, toV8InspectorString(eventData->toJSONString())); |
|
caseq
2016/08/19 02:50:36
It's seventh time we're invoking breakProgram here
|
| } |
| void InspectorDOMDebuggerAgent::didAddBreakpoint() |