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/V8InspectorString.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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 if ((rootBit & inheritableDOMBreakpointTypesMask) && !(mask & (rootBit << do
mBreakpointDerivedTypeShift))) { | 400 if ((rootBit & inheritableDOMBreakpointTypesMask) && !(mask & (rootBit << do
mBreakpointDerivedTypeShift))) { |
403 for (Node* child = InspectorDOMAgent::innerFirstChild(node); child; chil
d = InspectorDOMAgent::innerNextSibling(child)) | 401 for (Node* child = InspectorDOMAgent::innerFirstChild(node); child; chil
d = InspectorDOMAgent::innerNextSibling(child)) |
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> object; |
413 v8::Local<v8::Context> context; | 411 v8::Local<v8::Context> context; |
414 String16 objectGroup; | 412 std::unique_ptr<v8_inspector::StringBuffer> objectGroup; |
415 if (!m_v8Session->unwrapObject(errorString, objectId, &value, &context, &obj
ectGroup)) | 413 if (!m_v8Session->unwrapObject(errorString, toV8InspectorStringView(objectId
), &object, &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()); | |
420 } | |
421 | |
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) | |
423 { | |
424 V8EventListenerInfoList eventInformation; | 417 V8EventListenerInfoList eventInformation; |
425 InspectorDOMDebuggerAgent::eventListenersInfoForTarget(context->GetIsolate()
, object, eventInformation); | 418 InspectorDOMDebuggerAgent::eventListenersInfoForTarget(context->GetIsolate()
, object, eventInformation); |
426 for (const auto& info : eventInformation) { | 419 for (const auto& info : eventInformation) { |
427 if (!info.useCapture) | 420 if (!info.useCapture) |
428 continue; | 421 continue; |
429 std::unique_ptr<protocol::DOMDebugger::EventListener> listenerObject = b
uildObjectForEventListener(context, info, objectGroup); | 422 std::unique_ptr<protocol::DOMDebugger::EventListener> listenerObject = b
uildObjectForEventListener(context, info, objectGroup->string()); |
430 if (listenerObject) | 423 if (listenerObject) |
431 listenersArray->addItem(std::move(listenerObject)); | 424 (*listenersArray)->addItem(std::move(listenerObject)); |
432 } | 425 } |
433 for (const auto& info : eventInformation) { | 426 for (const auto& info : eventInformation) { |
434 if (info.useCapture) | 427 if (info.useCapture) |
435 continue; | 428 continue; |
436 std::unique_ptr<protocol::DOMDebugger::EventListener> listenerObject = b
uildObjectForEventListener(context, info, objectGroup); | 429 std::unique_ptr<protocol::DOMDebugger::EventListener> listenerObject = b
uildObjectForEventListener(context, info, objectGroup->string()); |
437 if (listenerObject) | 430 if (listenerObject) |
438 listenersArray->addItem(std::move(listenerObject)); | 431 (*listenersArray)->addItem(std::move(listenerObject)); |
439 } | 432 } |
440 } | 433 } |
441 | 434 |
442 std::unique_ptr<protocol::DOMDebugger::EventListener> InspectorDOMDebuggerAgent:
:buildObjectForEventListener(v8::Local<v8::Context> context, const V8EventListen
erInfo& info, const String16& objectGroupId) | 435 std::unique_ptr<protocol::DOMDebugger::EventListener> InspectorDOMDebuggerAgent:
:buildObjectForEventListener(v8::Local<v8::Context> context, const V8EventListen
erInfo& info, const v8_inspector::StringView& objectGroupId) |
443 { | 436 { |
444 if (info.handler.IsEmpty()) | 437 if (info.handler.IsEmpty()) |
445 return nullptr; | 438 return nullptr; |
446 | 439 |
447 v8::Isolate* isolate = context->GetIsolate(); | 440 v8::Isolate* isolate = context->GetIsolate(); |
448 v8::Local<v8::Function> function = eventListenerEffectiveFunction(isolate, i
nfo.handler); | 441 v8::Local<v8::Function> function = eventListenerEffectiveFunction(isolate, i
nfo.handler); |
449 if (function.IsEmpty()) | 442 if (function.IsEmpty()) |
450 return nullptr; | 443 return nullptr; |
451 | 444 |
452 String scriptId; | 445 String scriptId; |
453 int lineNumber; | 446 int lineNumber; |
454 int columnNumber; | 447 int columnNumber; |
455 getFunctionLocation(function, scriptId, lineNumber, columnNumber); | 448 getFunctionLocation(function, scriptId, lineNumber, columnNumber); |
456 | 449 |
457 std::unique_ptr<protocol::DOMDebugger::EventListener> value = protocol::DOMD
ebugger::EventListener::create() | 450 std::unique_ptr<protocol::DOMDebugger::EventListener> value = protocol::DOMD
ebugger::EventListener::create() |
458 .setType(info.eventType) | 451 .setType(info.eventType) |
459 .setUseCapture(info.useCapture) | 452 .setUseCapture(info.useCapture) |
460 .setPassive(info.passive) | 453 .setPassive(info.passive) |
461 .setScriptId(scriptId) | 454 .setScriptId(scriptId) |
462 .setLineNumber(lineNumber) | 455 .setLineNumber(lineNumber) |
463 .setColumnNumber(columnNumber).build(); | 456 .setColumnNumber(columnNumber).build(); |
464 if (!objectGroupId.isEmpty()) { | 457 if (objectGroupId.length()) { |
465 value->setHandler(m_v8Session->wrapObject(context, function, objectGroup
Id)); | 458 value->setHandler(m_v8Session->wrapObject(context, function, objectGroup
Id)); |
466 value->setOriginalHandler(m_v8Session->wrapObject(context, info.handler,
objectGroupId)); | 459 value->setOriginalHandler(m_v8Session->wrapObject(context, info.handler,
objectGroupId)); |
467 v8::Local<v8::Function> removeFunction; | 460 v8::Local<v8::Function> removeFunction; |
468 if (info.removeFunction.ToLocal(&removeFunction)) | 461 if (info.removeFunction.ToLocal(&removeFunction)) |
469 value->setRemoveFunction(m_v8Session->wrapObject(context, removeFunc
tion, objectGroupId)); | 462 value->setRemoveFunction(m_v8Session->wrapObject(context, removeFunc
tion, objectGroupId)); |
470 } | 463 } |
471 return value; | 464 return value; |
472 } | 465 } |
473 | 466 |
474 void InspectorDOMDebuggerAgent::allowNativeBreakpoint(const String& breakpointNa
me, const String* targetName, bool sync) | 467 void InspectorDOMDebuggerAgent::allowNativeBreakpoint(const String& breakpointNa
me, const String* targetName, bool sync) |
475 { | 468 { |
476 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(breakpointName, tar
getName), sync); | 469 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(breakpointName, tar
getName), sync); |
477 } | 470 } |
478 | 471 |
479 void InspectorDOMDebuggerAgent::willInsertDOMNode(Node* parent) | 472 void InspectorDOMDebuggerAgent::willInsertDOMNode(Node* parent) |
480 { | 473 { |
481 if (hasBreakpoint(parent, SubtreeModified)) { | 474 if (hasBreakpoint(parent, SubtreeModified)) |
482 std::unique_ptr<protocol::DictionaryValue> eventData = protocol::Diction
aryValue::create(); | 475 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 } | 476 } |
487 | 477 |
488 void InspectorDOMDebuggerAgent::willRemoveDOMNode(Node* node) | 478 void InspectorDOMDebuggerAgent::willRemoveDOMNode(Node* node) |
489 { | 479 { |
490 Node* parentNode = InspectorDOMAgent::innerParentNode(node); | 480 Node* parentNode = InspectorDOMAgent::innerParentNode(node); |
491 if (hasBreakpoint(node, NodeRemoved)) { | 481 if (hasBreakpoint(node, NodeRemoved)) |
492 std::unique_ptr<protocol::DictionaryValue> eventData = protocol::Diction
aryValue::create(); | 482 breakProgramOnDOMEvent(node, NodeRemoved, false); |
493 descriptionForDOMEvent(node, NodeRemoved, false, eventData.get()); | 483 else if (parentNode && hasBreakpoint(parentNode, SubtreeModified)) |
494 m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::D
OM, eventData->toJSONString()); | 484 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); | 485 didRemoveDOMNode(node); |
501 } | 486 } |
502 | 487 |
503 void InspectorDOMDebuggerAgent::willModifyDOMAttr(Element* element, const Atomic
String&, const AtomicString&) | 488 void InspectorDOMDebuggerAgent::willModifyDOMAttr(Element* element, const Atomic
String&, const AtomicString&) |
504 { | 489 { |
505 if (hasBreakpoint(element, AttributeModified)) { | 490 if (hasBreakpoint(element, AttributeModified)) |
506 std::unique_ptr<protocol::DictionaryValue> eventData = protocol::Diction
aryValue::create(); | 491 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 } | 492 } |
511 | 493 |
512 void InspectorDOMDebuggerAgent::descriptionForDOMEvent(Node* target, int breakpo
intType, bool insertion, protocol::DictionaryValue* description) | 494 void InspectorDOMDebuggerAgent::breakProgramOnDOMEvent(Node* target, int breakpo
intType, bool insertion) |
513 { | 495 { |
514 ASSERT(hasBreakpoint(target, breakpointType)); | 496 DCHECK(hasBreakpoint(target, breakpointType)); |
| 497 std::unique_ptr<protocol::DictionaryValue> description = protocol::Dictionar
yValue::create(); |
515 | 498 |
516 Node* breakpointOwner = target; | 499 Node* breakpointOwner = target; |
517 if ((1 << breakpointType) & inheritableDOMBreakpointTypesMask) { | 500 if ((1 << breakpointType) & inheritableDOMBreakpointTypesMask) { |
518 // For inheritable breakpoint types, target node isn't always the same a
s the node that owns a breakpoint. | 501 // 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. | 502 // Target node may be unknown to frontend, so we need to push it first. |
520 description->setInteger("targetNodeId", m_domAgent->pushNodePathToFronte
nd(target)); | 503 description->setInteger("targetNodeId", m_domAgent->pushNodePathToFronte
nd(target)); |
521 | 504 |
522 // Find breakpoint owner node. | 505 // Find breakpoint owner node. |
523 if (!insertion) | 506 if (!insertion) |
524 breakpointOwner = InspectorDOMAgent::innerParentNode(target); | 507 breakpointOwner = InspectorDOMAgent::innerParentNode(target); |
525 ASSERT(breakpointOwner); | 508 ASSERT(breakpointOwner); |
526 while (!(m_domBreakpoints.get(breakpointOwner) & (1 << breakpointType)))
{ | 509 while (!(m_domBreakpoints.get(breakpointOwner) & (1 << breakpointType)))
{ |
527 Node* parentNode = InspectorDOMAgent::innerParentNode(breakpointOwne
r); | 510 Node* parentNode = InspectorDOMAgent::innerParentNode(breakpointOwne
r); |
528 if (!parentNode) | 511 if (!parentNode) |
529 break; | 512 break; |
530 breakpointOwner = parentNode; | 513 breakpointOwner = parentNode; |
531 } | 514 } |
532 | 515 |
533 if (breakpointType == SubtreeModified) | 516 if (breakpointType == SubtreeModified) |
534 description->setBoolean("insertion", insertion); | 517 description->setBoolean("insertion", insertion); |
535 } | 518 } |
536 | 519 |
537 int breakpointOwnerNodeId = m_domAgent->boundNodeId(breakpointOwner); | 520 int breakpointOwnerNodeId = m_domAgent->boundNodeId(breakpointOwner); |
538 ASSERT(breakpointOwnerNodeId); | 521 ASSERT(breakpointOwnerNodeId); |
539 description->setInteger("nodeId", breakpointOwnerNodeId); | 522 description->setInteger("nodeId", breakpointOwnerNodeId); |
540 description->setString("type", domTypeName(breakpointType)); | 523 description->setString("type", domTypeName(breakpointType)); |
| 524 String json = description->toJSONString(); |
| 525 m_v8Session->breakProgram(toV8InspectorStringView(protocol::Debugger::API::P
aused::ReasonEnum::DOM), toV8InspectorStringView(json)); |
541 } | 526 } |
542 | 527 |
543 bool InspectorDOMDebuggerAgent::hasBreakpoint(Node* node, int type) | 528 bool InspectorDOMDebuggerAgent::hasBreakpoint(Node* node, int type) |
544 { | 529 { |
545 if (!m_domAgent->enabled()) | 530 if (!m_domAgent->enabled()) |
546 return false; | 531 return false; |
547 uint32_t rootBit = 1 << type; | 532 uint32_t rootBit = 1 << type; |
548 uint32_t derivedBit = rootBit << domBreakpointDerivedTypeShift; | 533 uint32_t derivedBit = rootBit << domBreakpointDerivedTypeShift; |
549 return m_domBreakpoints.get(node) & (rootBit | derivedBit); | 534 return m_domBreakpoints.get(node) & (rootBit | derivedBit); |
550 } | 535 } |
(...skipping 13 matching lines...) Expand all Loading... |
564 return; | 549 return; |
565 | 550 |
566 for (Node* child = InspectorDOMAgent::innerFirstChild(node); child; child =
InspectorDOMAgent::innerNextSibling(child)) | 551 for (Node* child = InspectorDOMAgent::innerFirstChild(node); child; child =
InspectorDOMAgent::innerNextSibling(child)) |
567 updateSubtreeBreakpoints(child, newRootMask, set); | 552 updateSubtreeBreakpoints(child, newRootMask, set); |
568 } | 553 } |
569 | 554 |
570 void InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded(std::unique_ptr<proto
col::DictionaryValue> eventData, bool synchronous) | 555 void InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded(std::unique_ptr<proto
col::DictionaryValue> eventData, bool synchronous) |
571 { | 556 { |
572 if (!eventData) | 557 if (!eventData) |
573 return; | 558 return; |
| 559 String json = eventData->toJSONString(); |
574 if (synchronous) | 560 if (synchronous) |
575 m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::E
ventListener, eventData->toJSONString()); | 561 m_v8Session->breakProgram(toV8InspectorStringView(protocol::Debugger::AP
I::Paused::ReasonEnum::EventListener), toV8InspectorStringView(json)); |
576 else | 562 else |
577 m_v8Session->schedulePauseOnNextStatement(protocol::Debugger::API::Pause
d::ReasonEnum::EventListener, eventData->toJSONString()); | 563 m_v8Session->schedulePauseOnNextStatement(toV8InspectorStringView(protoc
ol::Debugger::API::Paused::ReasonEnum::EventListener), toV8InspectorStringView(j
son)); |
578 } | 564 } |
579 | 565 |
580 std::unique_ptr<protocol::DictionaryValue> InspectorDOMDebuggerAgent::preparePau
seOnNativeEventData(const String& eventName, const String* targetName) | 566 std::unique_ptr<protocol::DictionaryValue> InspectorDOMDebuggerAgent::preparePau
seOnNativeEventData(const String& eventName, const String* targetName) |
581 { | 567 { |
582 String fullEventName = (targetName ? listenerEventCategoryType : instrumenta
tionEventCategoryType) + eventName; | 568 String fullEventName = (targetName ? listenerEventCategoryType : instrumenta
tionEventCategoryType) + eventName; |
583 protocol::DictionaryValue* breakpoints = eventListenerBreakpoints(); | 569 protocol::DictionaryValue* breakpoints = eventListenerBreakpoints(); |
584 protocol::Value* value = breakpoints->get(fullEventName); | 570 protocol::Value* value = breakpoints->get(fullEventName); |
585 if (!value) | 571 if (!value) |
586 return nullptr; | 572 return nullptr; |
587 bool match = false; | 573 bool match = false; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 | 642 |
657 void InspectorDOMDebuggerAgent::willSendXMLHttpOrFetchNetworkRequest(const Strin
g& url) | 643 void InspectorDOMDebuggerAgent::willSendXMLHttpOrFetchNetworkRequest(const Strin
g& url) |
658 { | 644 { |
659 String breakpointURL; | 645 String breakpointURL; |
660 if (m_state->booleanProperty(DOMDebuggerAgentState::pauseOnAllXHRs, false)) | 646 if (m_state->booleanProperty(DOMDebuggerAgentState::pauseOnAllXHRs, false)) |
661 breakpointURL = ""; | 647 breakpointURL = ""; |
662 else { | 648 else { |
663 protocol::DictionaryValue* breakpoints = xhrBreakpoints(); | 649 protocol::DictionaryValue* breakpoints = xhrBreakpoints(); |
664 for (size_t i = 0; i < breakpoints->size(); ++i) { | 650 for (size_t i = 0; i < breakpoints->size(); ++i) { |
665 auto breakpoint = breakpoints->at(i); | 651 auto breakpoint = breakpoints->at(i); |
666 if (url.contains(breakpoint.first)) { | 652 // TODO(dgozman): remove extra String cast after migrating away from
String16. |
| 653 if (url.contains(String(breakpoint.first))) { |
667 breakpointURL = breakpoint.first; | 654 breakpointURL = breakpoint.first; |
668 break; | 655 break; |
669 } | 656 } |
670 } | 657 } |
671 } | 658 } |
672 | 659 |
673 if (breakpointURL.isNull()) | 660 if (breakpointURL.isNull()) |
674 return; | 661 return; |
675 | 662 |
676 std::unique_ptr<protocol::DictionaryValue> eventData = protocol::DictionaryV
alue::create(); | 663 std::unique_ptr<protocol::DictionaryValue> eventData = protocol::DictionaryV
alue::create(); |
677 eventData->setString("breakpointURL", breakpointURL); | 664 eventData->setString("breakpointURL", breakpointURL); |
678 eventData->setString("url", url); | 665 eventData->setString("url", url); |
679 m_v8Session->breakProgram(protocol::Debugger::API::Paused::ReasonEnum::XHR,
eventData->toJSONString()); | 666 String json = eventData->toJSONString(); |
| 667 m_v8Session->breakProgram(toV8InspectorStringView(protocol::Debugger::API::P
aused::ReasonEnum::XHR), toV8InspectorStringView(json)); |
680 } | 668 } |
681 | 669 |
682 void InspectorDOMDebuggerAgent::didAddBreakpoint() | 670 void InspectorDOMDebuggerAgent::didAddBreakpoint() |
683 { | 671 { |
684 if (m_state->booleanProperty(DOMDebuggerAgentState::enabled, false)) | 672 if (m_state->booleanProperty(DOMDebuggerAgentState::enabled, false)) |
685 return; | 673 return; |
686 setEnabled(true); | 674 setEnabled(true); |
687 } | 675 } |
688 | 676 |
689 void InspectorDOMDebuggerAgent::didRemoveBreakpoint() | 677 void InspectorDOMDebuggerAgent::didRemoveBreakpoint() |
(...skipping 19 matching lines...) Expand all Loading... |
709 m_instrumentingAgents->removeInspectorDOMDebuggerAgent(this); | 697 m_instrumentingAgents->removeInspectorDOMDebuggerAgent(this); |
710 } | 698 } |
711 } | 699 } |
712 | 700 |
713 void InspectorDOMDebuggerAgent::didCommitLoadForLocalFrame(LocalFrame*) | 701 void InspectorDOMDebuggerAgent::didCommitLoadForLocalFrame(LocalFrame*) |
714 { | 702 { |
715 m_domBreakpoints.clear(); | 703 m_domBreakpoints.clear(); |
716 } | 704 } |
717 | 705 |
718 } // namespace blink | 706 } // namespace blink |
OLD | NEW |