| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "core/inspector/InspectorDOMDebuggerAgent.h" | 31 #include "core/inspector/InspectorDOMDebuggerAgent.h" |
| 32 | 32 |
| 33 #include "bindings/core/v8/ScriptEventListener.h" | 33 #include "bindings/core/v8/ScriptEventListener.h" |
| 34 #include "bindings/core/v8/V8EventTarget.h" | 34 #include "bindings/core/v8/V8EventTarget.h" |
| 35 #include "core/dom/Element.h" | 35 #include "core/dom/Element.h" |
| 36 #include "core/dom/Node.h" | 36 #include "core/dom/Node.h" |
| 37 #include "core/events/Event.h" | 37 #include "core/events/Event.h" |
| 38 #include "core/events/EventTarget.h" | 38 #include "core/events/EventTarget.h" |
| 39 #include "core/frame/LocalDOMWindow.h" | 39 #include "core/frame/LocalDOMWindow.h" |
| 40 #include "core/inspector/InspectorDOMAgent.h" | 40 #include "core/inspector/InspectorDOMAgent.h" |
| 41 #include "core/inspector/V8InspectorStringView.h" |
| 41 #include "platform/v8_inspector/public/V8InspectorSession.h" | 42 #include "platform/v8_inspector/public/V8InspectorSession.h" |
| 42 | 43 |
| 43 namespace { | 44 namespace { |
| 44 | 45 |
| 45 enum DOMBreakpointType { | 46 enum DOMBreakpointType { |
| 46 SubtreeModified = 0, | 47 SubtreeModified = 0, |
| 47 AttributeModified, | 48 AttributeModified, |
| 48 NodeRemoved, | 49 NodeRemoved, |
| 49 DOMBreakpointTypesCount | 50 DOMBreakpointTypesCount |
| 50 }; | 51 }; |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 protocol::DictionaryValue* breakpointsByTarget = ensurePropertyObject(eventL
istenerBreakpoints(), eventName); | 300 protocol::DictionaryValue* breakpointsByTarget = ensurePropertyObject(eventL
istenerBreakpoints(), eventName); |
| 300 if (targetName.isEmpty()) | 301 if (targetName.isEmpty()) |
| 301 breakpointsByTarget->remove(DOMDebuggerAgentState::eventTargetAny); | 302 breakpointsByTarget->remove(DOMDebuggerAgentState::eventTargetAny); |
| 302 else | 303 else |
| 303 breakpointsByTarget->remove(targetName.lower()); | 304 breakpointsByTarget->remove(targetName.lower()); |
| 304 didRemoveBreakpoint(); | 305 didRemoveBreakpoint(); |
| 305 } | 306 } |
| 306 | 307 |
| 307 void InspectorDOMDebuggerAgent::didInvalidateStyleAttr(Node* node) | 308 void InspectorDOMDebuggerAgent::didInvalidateStyleAttr(Node* node) |
| 308 { | 309 { |
| 309 if (hasBreakpoint(node, AttributeModified)) { | 310 if (hasBreakpoint(node, AttributeModified)) |
| 310 std::unique_ptr<protocol::DictionaryValue> eventData = protocol::Diction
aryValue::create(); | 311 breakProgramOnDOMEvent(node, AttributeModified, false); |
| 311 descriptionForDOMEvent(node, AttributeModified, false, eventData.get()); | |
| 312 m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::D
OM, eventData->toJSONString()); | |
| 313 } | |
| 314 } | 312 } |
| 315 | 313 |
| 316 void InspectorDOMDebuggerAgent::didInsertDOMNode(Node* node) | 314 void InspectorDOMDebuggerAgent::didInsertDOMNode(Node* node) |
| 317 { | 315 { |
| 318 if (m_domBreakpoints.size()) { | 316 if (m_domBreakpoints.size()) { |
| 319 uint32_t mask = m_domBreakpoints.get(InspectorDOMAgent::innerParentNode(
node)); | 317 uint32_t mask = m_domBreakpoints.get(InspectorDOMAgent::innerParentNode(
node)); |
| 320 uint32_t inheritableTypesMask = (mask | (mask >> domBreakpointDerivedTyp
eShift)) & inheritableDOMBreakpointTypesMask; | 318 uint32_t inheritableTypesMask = (mask | (mask >> domBreakpointDerivedTyp
eShift)) & inheritableDOMBreakpointTypesMask; |
| 321 if (inheritableTypesMask) | 319 if (inheritableTypesMask) |
| 322 updateSubtreeBreakpoints(node, inheritableTypesMask, true); | 320 updateSubtreeBreakpoints(node, inheritableTypesMask, true); |
| 323 } | 321 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 updateSubtreeBreakpoints(child, rootBit, false); | 402 updateSubtreeBreakpoints(child, rootBit, false); |
| 405 } | 403 } |
| 406 didRemoveBreakpoint(); | 404 didRemoveBreakpoint(); |
| 407 } | 405 } |
| 408 | 406 |
| 409 void InspectorDOMDebuggerAgent::getEventListeners(ErrorString* errorString, cons
t String& objectId, std::unique_ptr<protocol::Array<protocol::DOMDebugger::Event
Listener>>* listenersArray) | 407 void InspectorDOMDebuggerAgent::getEventListeners(ErrorString* errorString, cons
t String& objectId, std::unique_ptr<protocol::Array<protocol::DOMDebugger::Event
Listener>>* listenersArray) |
| 410 { | 408 { |
| 411 v8::HandleScope handles(m_isolate); | 409 v8::HandleScope handles(m_isolate); |
| 412 v8::Local<v8::Value> value; | 410 v8::Local<v8::Value> value; |
| 413 v8::Local<v8::Context> context; | 411 v8::Local<v8::Context> context; |
| 414 String16 objectGroup; | 412 v8_inspector::StringView objectGroup; |
| 415 if (!m_v8Session->unwrapObject(errorString, objectId, &value, &context, &obj
ectGroup)) | 413 if (!m_v8Session->unwrapObject(errorString, toV8InspectorStringView(objectId
), &value, &context, &objectGroup)) |
| 416 return; | 414 return; |
| 417 v8::Context::Scope scope(context); | 415 v8::Context::Scope scope(context); |
| 418 *listenersArray = protocol::Array<protocol::DOMDebugger::EventListener>::cre
ate(); | 416 *listenersArray = protocol::Array<protocol::DOMDebugger::EventListener>::cre
ate(); |
| 419 eventListeners(context, value, objectGroup, listenersArray->get()); | 417 eventListeners(context, value, toCoreString(objectGroup), listenersArray->ge
t()); |
| 420 } | 418 } |
| 421 | 419 |
| 422 void InspectorDOMDebuggerAgent::eventListeners(v8::Local<v8::Context> context, v
8::Local<v8::Value> object, const String16& objectGroup, protocol::Array<protoco
l::DOMDebugger::EventListener>* listenersArray) | 420 void InspectorDOMDebuggerAgent::eventListeners(v8::Local<v8::Context> context, v
8::Local<v8::Value> object, const String& objectGroup, protocol::Array<protocol:
:DOMDebugger::EventListener>* listenersArray) |
| 423 { | 421 { |
| 424 V8EventListenerInfoList eventInformation; | 422 V8EventListenerInfoList eventInformation; |
| 425 InspectorDOMDebuggerAgent::eventListenersInfoForTarget(context->GetIsolate()
, object, eventInformation); | 423 InspectorDOMDebuggerAgent::eventListenersInfoForTarget(context->GetIsolate()
, object, eventInformation); |
| 426 for (const auto& info : eventInformation) { | 424 for (const auto& info : eventInformation) { |
| 427 if (!info.useCapture) | 425 if (!info.useCapture) |
| 428 continue; | 426 continue; |
| 429 std::unique_ptr<protocol::DOMDebugger::EventListener> listenerObject = b
uildObjectForEventListener(context, info, objectGroup); | 427 std::unique_ptr<protocol::DOMDebugger::EventListener> listenerObject = b
uildObjectForEventListener(context, info, objectGroup); |
| 430 if (listenerObject) | 428 if (listenerObject) |
| 431 listenersArray->addItem(std::move(listenerObject)); | 429 listenersArray->addItem(std::move(listenerObject)); |
| 432 } | 430 } |
| 433 for (const auto& info : eventInformation) { | 431 for (const auto& info : eventInformation) { |
| 434 if (info.useCapture) | 432 if (info.useCapture) |
| 435 continue; | 433 continue; |
| 436 std::unique_ptr<protocol::DOMDebugger::EventListener> listenerObject = b
uildObjectForEventListener(context, info, objectGroup); | 434 std::unique_ptr<protocol::DOMDebugger::EventListener> listenerObject = b
uildObjectForEventListener(context, info, objectGroup); |
| 437 if (listenerObject) | 435 if (listenerObject) |
| 438 listenersArray->addItem(std::move(listenerObject)); | 436 listenersArray->addItem(std::move(listenerObject)); |
| 439 } | 437 } |
| 440 } | 438 } |
| 441 | 439 |
| 442 std::unique_ptr<protocol::DOMDebugger::EventListener> InspectorDOMDebuggerAgent:
:buildObjectForEventListener(v8::Local<v8::Context> context, const V8EventListen
erInfo& info, const String16& objectGroupId) | 440 std::unique_ptr<protocol::DOMDebugger::EventListener> InspectorDOMDebuggerAgent:
:buildObjectForEventListener(v8::Local<v8::Context> context, const V8EventListen
erInfo& info, const String& objectGroupId) |
| 443 { | 441 { |
| 444 if (info.handler.IsEmpty()) | 442 if (info.handler.IsEmpty()) |
| 445 return nullptr; | 443 return nullptr; |
| 446 | 444 |
| 447 v8::Isolate* isolate = context->GetIsolate(); | 445 v8::Isolate* isolate = context->GetIsolate(); |
| 448 v8::Local<v8::Function> function = eventListenerEffectiveFunction(isolate, i
nfo.handler); | 446 v8::Local<v8::Function> function = eventListenerEffectiveFunction(isolate, i
nfo.handler); |
| 449 if (function.IsEmpty()) | 447 if (function.IsEmpty()) |
| 450 return nullptr; | 448 return nullptr; |
| 451 | 449 |
| 452 String scriptId; | 450 String scriptId; |
| 453 int lineNumber; | 451 int lineNumber; |
| 454 int columnNumber; | 452 int columnNumber; |
| 455 getFunctionLocation(function, scriptId, lineNumber, columnNumber); | 453 getFunctionLocation(function, scriptId, lineNumber, columnNumber); |
| 456 | 454 |
| 457 std::unique_ptr<protocol::DOMDebugger::EventListener> value = protocol::DOMD
ebugger::EventListener::create() | 455 std::unique_ptr<protocol::DOMDebugger::EventListener> value = protocol::DOMD
ebugger::EventListener::create() |
| 458 .setType(info.eventType) | 456 .setType(info.eventType) |
| 459 .setUseCapture(info.useCapture) | 457 .setUseCapture(info.useCapture) |
| 460 .setPassive(info.passive) | 458 .setPassive(info.passive) |
| 461 .setScriptId(scriptId) | 459 .setScriptId(scriptId) |
| 462 .setLineNumber(lineNumber) | 460 .setLineNumber(lineNumber) |
| 463 .setColumnNumber(columnNumber).build(); | 461 .setColumnNumber(columnNumber).build(); |
| 464 if (!objectGroupId.isEmpty()) { | 462 if (!objectGroupId.isEmpty()) { |
| 465 value->setHandler(m_v8Session->wrapObject(context, function, objectGroup
Id)); | 463 v8_inspector::StringView objectGroup = toV8InspectorStringView(objectGro
upId); |
| 466 value->setOriginalHandler(m_v8Session->wrapObject(context, info.handler,
objectGroupId)); | 464 value->setHandler(m_v8Session->wrapObject(context, function, objectGroup
)); |
| 465 value->setOriginalHandler(m_v8Session->wrapObject(context, info.handler,
objectGroup)); |
| 467 v8::Local<v8::Function> removeFunction; | 466 v8::Local<v8::Function> removeFunction; |
| 468 if (info.removeFunction.ToLocal(&removeFunction)) | 467 if (info.removeFunction.ToLocal(&removeFunction)) |
| 469 value->setRemoveFunction(m_v8Session->wrapObject(context, removeFunc
tion, objectGroupId)); | 468 value->setRemoveFunction(m_v8Session->wrapObject(context, removeFunc
tion, objectGroup)); |
| 470 } | 469 } |
| 471 return value; | 470 return value; |
| 472 } | 471 } |
| 473 | 472 |
| 474 void InspectorDOMDebuggerAgent::allowNativeBreakpoint(const String& breakpointNa
me, const String* targetName, bool sync) | 473 void InspectorDOMDebuggerAgent::allowNativeBreakpoint(const String& breakpointNa
me, const String* targetName, bool sync) |
| 475 { | 474 { |
| 476 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(breakpointName, tar
getName), sync); | 475 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(breakpointName, tar
getName), sync); |
| 477 } | 476 } |
| 478 | 477 |
| 479 void InspectorDOMDebuggerAgent::willInsertDOMNode(Node* parent) | 478 void InspectorDOMDebuggerAgent::willInsertDOMNode(Node* parent) |
| 480 { | 479 { |
| 481 if (hasBreakpoint(parent, SubtreeModified)) { | 480 if (hasBreakpoint(parent, SubtreeModified)) |
| 482 std::unique_ptr<protocol::DictionaryValue> eventData = protocol::Diction
aryValue::create(); | 481 breakProgramOnDOMEvent(parent, SubtreeModified, true); |
| 483 descriptionForDOMEvent(parent, SubtreeModified, true, eventData.get()); | |
| 484 m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::D
OM, eventData->toJSONString()); | |
| 485 } | |
| 486 } | 482 } |
| 487 | 483 |
| 488 void InspectorDOMDebuggerAgent::willRemoveDOMNode(Node* node) | 484 void InspectorDOMDebuggerAgent::willRemoveDOMNode(Node* node) |
| 489 { | 485 { |
| 490 Node* parentNode = InspectorDOMAgent::innerParentNode(node); | 486 Node* parentNode = InspectorDOMAgent::innerParentNode(node); |
| 491 if (hasBreakpoint(node, NodeRemoved)) { | 487 if (hasBreakpoint(node, NodeRemoved)) |
| 492 std::unique_ptr<protocol::DictionaryValue> eventData = protocol::Diction
aryValue::create(); | 488 breakProgramOnDOMEvent(node, NodeRemoved, false); |
| 493 descriptionForDOMEvent(node, NodeRemoved, false, eventData.get()); | 489 else if (parentNode && hasBreakpoint(parentNode, SubtreeModified)) |
| 494 m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::D
OM, eventData->toJSONString()); | 490 breakProgramOnDOMEvent(node, SubtreeModified, false); |
| 495 } else if (parentNode && hasBreakpoint(parentNode, SubtreeModified)) { | |
| 496 std::unique_ptr<protocol::DictionaryValue> eventData = protocol::Diction
aryValue::create(); | |
| 497 descriptionForDOMEvent(node, SubtreeModified, false, eventData.get()); | |
| 498 m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::D
OM, eventData->toJSONString()); | |
| 499 } | |
| 500 didRemoveDOMNode(node); | 491 didRemoveDOMNode(node); |
| 501 } | 492 } |
| 502 | 493 |
| 503 void InspectorDOMDebuggerAgent::willModifyDOMAttr(Element* element, const Atomic
String&, const AtomicString&) | 494 void InspectorDOMDebuggerAgent::willModifyDOMAttr(Element* element, const Atomic
String&, const AtomicString&) |
| 504 { | 495 { |
| 505 if (hasBreakpoint(element, AttributeModified)) { | 496 if (hasBreakpoint(element, AttributeModified)) |
| 506 std::unique_ptr<protocol::DictionaryValue> eventData = protocol::Diction
aryValue::create(); | 497 breakProgramOnDOMEvent(element, AttributeModified, false); |
| 507 descriptionForDOMEvent(element, AttributeModified, false, eventData.get(
)); | |
| 508 m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::D
OM, eventData->toJSONString()); | |
| 509 } | |
| 510 } | 498 } |
| 511 | 499 |
| 512 void InspectorDOMDebuggerAgent::descriptionForDOMEvent(Node* target, int breakpo
intType, bool insertion, protocol::DictionaryValue* description) | 500 void InspectorDOMDebuggerAgent::breakProgramOnDOMEvent(Node* target, int breakpo
intType, bool insertion) |
| 513 { | 501 { |
| 514 ASSERT(hasBreakpoint(target, breakpointType)); | 502 DCHECK(hasBreakpoint(target, breakpointType)); |
| 503 std::unique_ptr<protocol::DictionaryValue> description = protocol::Dictionar
yValue::create(); |
| 515 | 504 |
| 516 Node* breakpointOwner = target; | 505 Node* breakpointOwner = target; |
| 517 if ((1 << breakpointType) & inheritableDOMBreakpointTypesMask) { | 506 if ((1 << breakpointType) & inheritableDOMBreakpointTypesMask) { |
| 518 // For inheritable breakpoint types, target node isn't always the same a
s the node that owns a breakpoint. | 507 // For inheritable breakpoint types, target node isn't always the same a
s the node that owns a breakpoint. |
| 519 // Target node may be unknown to frontend, so we need to push it first. | 508 // Target node may be unknown to frontend, so we need to push it first. |
| 520 description->setInteger("targetNodeId", m_domAgent->pushNodePathToFronte
nd(target)); | 509 description->setInteger("targetNodeId", m_domAgent->pushNodePathToFronte
nd(target)); |
| 521 | 510 |
| 522 // Find breakpoint owner node. | 511 // Find breakpoint owner node. |
| 523 if (!insertion) | 512 if (!insertion) |
| 524 breakpointOwner = InspectorDOMAgent::innerParentNode(target); | 513 breakpointOwner = InspectorDOMAgent::innerParentNode(target); |
| 525 ASSERT(breakpointOwner); | 514 ASSERT(breakpointOwner); |
| 526 while (!(m_domBreakpoints.get(breakpointOwner) & (1 << breakpointType)))
{ | 515 while (!(m_domBreakpoints.get(breakpointOwner) & (1 << breakpointType)))
{ |
| 527 Node* parentNode = InspectorDOMAgent::innerParentNode(breakpointOwne
r); | 516 Node* parentNode = InspectorDOMAgent::innerParentNode(breakpointOwne
r); |
| 528 if (!parentNode) | 517 if (!parentNode) |
| 529 break; | 518 break; |
| 530 breakpointOwner = parentNode; | 519 breakpointOwner = parentNode; |
| 531 } | 520 } |
| 532 | 521 |
| 533 if (breakpointType == SubtreeModified) | 522 if (breakpointType == SubtreeModified) |
| 534 description->setBoolean("insertion", insertion); | 523 description->setBoolean("insertion", insertion); |
| 535 } | 524 } |
| 536 | 525 |
| 537 int breakpointOwnerNodeId = m_domAgent->boundNodeId(breakpointOwner); | 526 int breakpointOwnerNodeId = m_domAgent->boundNodeId(breakpointOwner); |
| 538 ASSERT(breakpointOwnerNodeId); | 527 ASSERT(breakpointOwnerNodeId); |
| 539 description->setInteger("nodeId", breakpointOwnerNodeId); | 528 description->setInteger("nodeId", breakpointOwnerNodeId); |
| 540 description->setString("type", domTypeName(breakpointType)); | 529 description->setString("type", domTypeName(breakpointType)); |
| 530 String16 json = description->toJSONString(); |
| 531 m_v8Session->breakProgram(toV8InspectorStringView(protocol::Debugger::API::P
aused::ReasonEnum::DOM), toV8InspectorStringView(json)); |
| 541 } | 532 } |
| 542 | 533 |
| 543 bool InspectorDOMDebuggerAgent::hasBreakpoint(Node* node, int type) | 534 bool InspectorDOMDebuggerAgent::hasBreakpoint(Node* node, int type) |
| 544 { | 535 { |
| 545 if (!m_domAgent->enabled()) | 536 if (!m_domAgent->enabled()) |
| 546 return false; | 537 return false; |
| 547 uint32_t rootBit = 1 << type; | 538 uint32_t rootBit = 1 << type; |
| 548 uint32_t derivedBit = rootBit << domBreakpointDerivedTypeShift; | 539 uint32_t derivedBit = rootBit << domBreakpointDerivedTypeShift; |
| 549 return m_domBreakpoints.get(node) & (rootBit | derivedBit); | 540 return m_domBreakpoints.get(node) & (rootBit | derivedBit); |
| 550 } | 541 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 564 return; | 555 return; |
| 565 | 556 |
| 566 for (Node* child = InspectorDOMAgent::innerFirstChild(node); child; child =
InspectorDOMAgent::innerNextSibling(child)) | 557 for (Node* child = InspectorDOMAgent::innerFirstChild(node); child; child =
InspectorDOMAgent::innerNextSibling(child)) |
| 567 updateSubtreeBreakpoints(child, newRootMask, set); | 558 updateSubtreeBreakpoints(child, newRootMask, set); |
| 568 } | 559 } |
| 569 | 560 |
| 570 void InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded(std::unique_ptr<proto
col::DictionaryValue> eventData, bool synchronous) | 561 void InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded(std::unique_ptr<proto
col::DictionaryValue> eventData, bool synchronous) |
| 571 { | 562 { |
| 572 if (!eventData) | 563 if (!eventData) |
| 573 return; | 564 return; |
| 565 String16 json = eventData->toJSONString(); |
| 574 if (synchronous) | 566 if (synchronous) |
| 575 m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::E
ventListener, eventData->toJSONString()); | 567 m_v8Session->breakProgram(toV8InspectorStringView(protocol::Debugger::AP
I::Paused::ReasonEnum::EventListener), toV8InspectorStringView(json)); |
| 576 else | 568 else |
| 577 m_v8Session->schedulePauseOnNextStatement(protocol::Debugger::API::Pause
d::ReasonEnum::EventListener, eventData->toJSONString()); | 569 m_v8Session->schedulePauseOnNextStatement(toV8InspectorStringView(protoc
ol::Debugger::API::Paused::ReasonEnum::EventListener), toV8InspectorStringView(j
son)); |
| 578 } | 570 } |
| 579 | 571 |
| 580 std::unique_ptr<protocol::DictionaryValue> InspectorDOMDebuggerAgent::preparePau
seOnNativeEventData(const String& eventName, const String* targetName) | 572 std::unique_ptr<protocol::DictionaryValue> InspectorDOMDebuggerAgent::preparePau
seOnNativeEventData(const String& eventName, const String* targetName) |
| 581 { | 573 { |
| 582 String fullEventName = (targetName ? listenerEventCategoryType : instrumenta
tionEventCategoryType) + eventName; | 574 String fullEventName = (targetName ? listenerEventCategoryType : instrumenta
tionEventCategoryType) + eventName; |
| 583 protocol::DictionaryValue* breakpoints = eventListenerBreakpoints(); | 575 protocol::DictionaryValue* breakpoints = eventListenerBreakpoints(); |
| 584 protocol::Value* value = breakpoints->get(fullEventName); | 576 protocol::Value* value = breakpoints->get(fullEventName); |
| 585 if (!value) | 577 if (!value) |
| 586 return nullptr; | 578 return nullptr; |
| 587 bool match = false; | 579 bool match = false; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 } | 661 } |
| 670 } | 662 } |
| 671 } | 663 } |
| 672 | 664 |
| 673 if (breakpointURL.isNull()) | 665 if (breakpointURL.isNull()) |
| 674 return; | 666 return; |
| 675 | 667 |
| 676 std::unique_ptr<protocol::DictionaryValue> eventData = protocol::DictionaryV
alue::create(); | 668 std::unique_ptr<protocol::DictionaryValue> eventData = protocol::DictionaryV
alue::create(); |
| 677 eventData->setString("breakpointURL", breakpointURL); | 669 eventData->setString("breakpointURL", breakpointURL); |
| 678 eventData->setString("url", url); | 670 eventData->setString("url", url); |
| 679 m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::XHR,
eventData->toJSONString()); | 671 String16 json = eventData->toJSONString(); |
| 672 m_v8Session->breakProgram(toV8InspectorStringView(protocol::Debugger::API::P
aused::ReasonEnum::XHR), toV8InspectorStringView(json)); |
| 680 } | 673 } |
| 681 | 674 |
| 682 void InspectorDOMDebuggerAgent::didAddBreakpoint() | 675 void InspectorDOMDebuggerAgent::didAddBreakpoint() |
| 683 { | 676 { |
| 684 if (m_state->booleanProperty(DOMDebuggerAgentState::enabled, false)) | 677 if (m_state->booleanProperty(DOMDebuggerAgentState::enabled, false)) |
| 685 return; | 678 return; |
| 686 setEnabled(true); | 679 setEnabled(true); |
| 687 } | 680 } |
| 688 | 681 |
| 689 void InspectorDOMDebuggerAgent::didRemoveBreakpoint() | 682 void InspectorDOMDebuggerAgent::didRemoveBreakpoint() |
| (...skipping 19 matching lines...) Expand all Loading... |
| 709 m_instrumentingAgents->removeInspectorDOMDebuggerAgent(this); | 702 m_instrumentingAgents->removeInspectorDOMDebuggerAgent(this); |
| 710 } | 703 } |
| 711 } | 704 } |
| 712 | 705 |
| 713 void InspectorDOMDebuggerAgent::didCommitLoadForLocalFrame(LocalFrame*) | 706 void InspectorDOMDebuggerAgent::didCommitLoadForLocalFrame(LocalFrame*) |
| 714 { | 707 { |
| 715 m_domBreakpoints.clear(); | 708 m_domBreakpoints.clear(); |
| 716 } | 709 } |
| 717 | 710 |
| 718 } // namespace blink | 711 } // namespace blink |
| OLD | NEW |