Changeset 251871 in webkit
- Timestamp:
- Oct 31, 2019 1:20:43 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r251867 r251871 1 2019-10-31 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: DOMDebugger: Node Removed breakpoints should fire whenever the node is removed from the main DOM tree, not just when it's removed from it's parent 4 https://bugs.webkit.org/show_bug.cgi?id=203349 5 6 Reviewed by Matt Baker. 7 8 * inspector/dom-debugger/dom-breakpoints.html: 9 * inspector/dom-debugger/dom-breakpoints-expected.txt: 10 1 11 2019-10-31 Ryosuke Niwa <rniwa@webkit.org> 2 12 -
trunk/LayoutTests/inspector/dom-debugger/dom-breakpoints-expected.txt
r249330 r251871 16 16 PAUSED: 17 17 PASS: Pause reason should be DOM. 18 PASS: Pause type should be 'subtree-modified'. 19 PASS: Pause nodeId should be expected value. 20 PASS: Pause insertion should be 'true'. 21 PASS: Pause targetNodeId should match nodeId. 18 22 CALL STACK: 19 23 0: [F] subtreeModifiedTest … … 46 50 PAUSED: 47 51 PASS: Pause reason should be DOM. 52 PASS: Pause type should be 'attribute-modified'. 53 PASS: Pause nodeId should be expected value. 48 54 CALL STACK: 49 55 0: [F] attributeModifiedTest … … 70 76 -- Running test teardown. 71 77 72 -- Running test case: DOMBreakpoints.NodeRemoved .BreakpointEnabled78 -- Running test case: DOMBreakpoints.NodeRemovedSelf.BreakpointEnabled 73 79 PASS: Added 'node-removed' breakpoint. 74 80 PASS: Breakpoint should have expected type. … … 76 82 PAUSED: 77 83 PASS: Pause reason should be DOM. 84 PASS: Pause type should be 'node-removed'. 85 PASS: Pause nodeId should be expected value. 78 86 CALL STACK: 79 0: [F] nodeRemoved Test87 0: [F] nodeRemovedDirectTest 80 88 1: [P] Global Code 81 89 -- Running test teardown. 82 90 83 -- Running test case: DOMBreakpoints.NodeRemoved .BreakpointDisabled91 -- Running test case: DOMBreakpoints.NodeRemovedSelf.BreakpointDisabled 84 92 PASS: Added 'node-removed' breakpoint. 85 93 Wait for evaluate in page to return. … … 87 95 -- Running test teardown. 88 96 89 -- Running test case: DOMBreakpoints.NodeRemoved .DebuggerDisabled97 -- Running test case: DOMBreakpoints.NodeRemovedSelf.DebuggerDisabled 90 98 PASS: Added 'node-removed' breakpoint. 91 99 Wait for evaluate in page to return. … … 93 101 -- Running test teardown. 94 102 95 -- Running test case: DOMBreakpoints.NodeRemoved.RemoveBreakpoint 103 -- Running test case: DOMBreakpoints.NodeRemovedSelf.RemoveBreakpoint 104 PASS: Added 'node-removed' breakpoint. 105 Remove breakpoint. 106 Wait for evaluate in page to return. 107 PASS: Should not pause for removed breakpoint. 108 -- Running test teardown. 109 110 -- Running test case: DOMBreakpoints.NodeRemovedAncestor.BreakpointEnabled 111 PASS: Added 'node-removed' breakpoint. 112 PASS: Breakpoint should have expected type. 113 Call DOM operation. 114 PAUSED: 115 PASS: Pause reason should be DOM. 116 PASS: Pause type should be 'node-removed'. 117 PASS: Pause nodeId should be expected value. 118 PASS: Pause targetNodeId should not match nodeId. 119 CALL STACK: 120 0: [F] nodeRemovedAncestorTest 121 1: [P] Global Code 122 -- Running test teardown. 123 124 -- Running test case: DOMBreakpoints.NodeRemovedAncestor.BreakpointDisabled 125 PASS: Added 'node-removed' breakpoint. 126 Wait for evaluate in page to return. 127 PASS: Should not pause for disabled breakpoint. 128 -- Running test teardown. 129 130 -- Running test case: DOMBreakpoints.NodeRemovedAncestor.DebuggerDisabled 131 PASS: Added 'node-removed' breakpoint. 132 Wait for evaluate in page to return. 133 PASS: Should not pause for disabled breakpoint. 134 -- Running test teardown. 135 136 -- Running test case: DOMBreakpoints.NodeRemovedAncestor.RemoveBreakpoint 96 137 PASS: Added 'node-removed' breakpoint. 97 138 Remove breakpoint. -
trunk/LayoutTests/inspector/dom-debugger/dom-breakpoints.html
r243719 r251871 13 13 } 14 14 15 function nodeRemoved Test() {16 let node = document.getElementById("node-removed- test");15 function nodeRemovedDirectTest() { 16 let node = document.getElementById("node-removed-direct-test"); 17 17 let parent = node.parentNode; 18 18 node.remove(); 19 19 parent.append(node); 20 } 21 22 function nodeRemovedAncestorTest() { 23 let node = document.getElementById("node-removed-ancestor-test"); 24 let parent = node.parentNode; 25 let grandparent = parent.parentNode; 26 parent.remove(node); 27 grandparent.append(parent); 20 28 } 21 29 … … 24 32 const subtreeModifiedTestId = "subtree-modified-test"; 25 33 const attributeModifiedTestId = "attribute-modified-test"; 26 const nodeRemovedTestId = "node-removed-test"; 34 const nodeRemovedDirectTestId = "node-removed-direct-test"; 35 const nodeRemovedAncestorTestId = "node-removed-ancestor-test"; 27 36 const multipleBreakpointsTestId = "multiple-breakpoints-test"; 28 37 … … 110 119 } 111 120 112 function addTestsForBreakpointType({name, elementIdentifier, type, expression }) {121 function addTestsForBreakpointType({name, elementIdentifier, type, expression, insertion, shouldMatch}) { 113 122 suite.addTestCase({ 114 123 name: `DOMBreakpoints.${name}.BreakpointEnabled`, … … 129 138 InspectorTest.log("PAUSED:"); 130 139 InspectorTest.expectEqual(targetData.pauseReason, WI.DebuggerManager.PauseReason.DOM, "Pause reason should be DOM."); 140 141 let pauseData = targetData.pauseData; 142 InspectorTest.expectEqual(pauseData.type, type, `Pause type should be '${type}'.`); 143 InspectorTest.expectEqual(pauseData.nodeId, domNodeIdentifier, `Pause nodeId should be expected value.`); 144 145 if (insertion !== undefined) 146 InspectorTest.expectEqual(insertion, target.pauseData.insertion, `Pause insertion should be '${insertion}'.`); 147 148 if (pauseData.targetNodeId) { 149 if (shouldMatch) 150 InspectorTest.expectEqual(pauseData.targetNodeId, pauseData.nodeId, "Pause targetNodeId should match nodeId."); 151 else 152 InspectorTest.expectNotEqual(pauseData.targetNodeId, pauseData.nodeId, "Pause targetNodeId should not match nodeId."); 153 } 154 131 155 logActiveStackTrace(); 132 133 156 return WI.debuggerManager.resume(); 134 157 }) … … 218 241 type: WI.DOMBreakpoint.Type.SubtreeModified, 219 242 expression: "subtreeModifiedTest()", 243 insertion: true, 244 shouldMatch: true, 220 245 }); 221 246 … … 228 253 229 254 addTestsForBreakpointType({ 230 name: "NodeRemoved ",231 elementIdentifier: nodeRemoved TestId,255 name: "NodeRemovedSelf", 256 elementIdentifier: nodeRemovedDirectTestId, 232 257 type: WI.DOMBreakpoint.Type.NodeRemoved, 233 expression: "nodeRemovedTest()", 258 expression: "nodeRemovedDirectTest()", 259 }); 260 261 addTestsForBreakpointType({ 262 name: "NodeRemovedAncestor", 263 elementIdentifier: nodeRemovedAncestorTestId, 264 type: WI.DOMBreakpoint.Type.NodeRemoved, 265 expression: "nodeRemovedAncestorTest()", 266 shouldMatch: true, 234 267 }); 235 268 … … 354 387 <div id="subtree-modified-test"></div> 355 388 <div id="attribute-modified-test"></div> 356 <div id="node-removed-test"></div> 389 <div id="node-removed-direct-test"></div> 390 <div><div id="node-removed-ancestor-test"></div></div> 357 391 <div id="multiple-breakpoints-test"></div> 358 392 </div> -
trunk/Source/WebCore/ChangeLog
r251870 r251871 1 2019-10-31 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: DOMDebugger: Node Removed breakpoints should fire whenever the node is removed from the main DOM tree, not just when it's removed from it's parent 4 https://bugs.webkit.org/show_bug.cgi?id=203349 5 6 Reviewed by Matt Baker. 7 8 Test: inspector/dom-debugger/dom-breakpoints.html 9 10 Replace `targetNode` (which was a `Runtime.RemoteObject`) with a `targetNodeId` (which is a 11 `DOM.NodeId`) when dispatching `DOMDebugger` pauses. Additionally, include the ancestor's 12 `DOM.NodeId` as the `targetNodeId` whenever an ancestor is removed that has a descendant 13 with a node removed DOM breakpoint. 14 15 * inspector/agents/page/PageDOMDebuggerAgent.h: 16 * inspector/agents/page/PageDOMDebuggerAgent.cpp: 17 (WebCore::PageDOMDebuggerAgent::willRemoveDOMNode): 18 (WebCore::PageDOMDebuggerAgent::descriptionForDOMEvent): 19 20 * inspector/agents/InspectorDOMAgent.h: 21 * inspector/agents/InspectorDOMAgent.cpp: 22 (WebCore::InspectorDOMAgent::pushNodeToFrontend): Added. 23 1 24 2019-10-31 Andres Gonzalez <andresg_22@apple.com> 2 25 -
trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
r251798 r251871 542 542 } 543 543 544 int InspectorDOMAgent::pushNodeToFrontend(Node* nodeToPush) 545 { 546 if (!nodeToPush) 547 return 0; 548 549 ErrorString ignored; 550 return pushNodeToFrontend(ignored, boundNodeId(&nodeToPush->document()), nodeToPush); 551 } 552 544 553 int InspectorDOMAgent::pushNodeToFrontend(ErrorString& errorString, int documentNodeId, Node* nodeToPush) 545 554 { -
trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.h
r251798 r251871 179 179 void styleAttributeInvalidated(const Vector<Element*>& elements); 180 180 181 int pushNodeToFrontend(Node*); 181 182 int pushNodeToFrontend(ErrorString&, int documentNodeId, Node*); 182 183 Node* nodeForId(int nodeId); -
trunk/Source/WebCore/inspector/agents/page/PageDOMDebuggerAgent.cpp
r249714 r251871 188 188 return; 189 189 190 Node* parentNode = InspectorDOMAgent::innerParentNode(&node);191 190 if (hasBreakpoint(&node, NodeRemoved)) { 192 Ref<JSON::Object>eventData = JSON::Object::create();191 auto eventData = JSON::Object::create(); 193 192 descriptionForDOMEvent(node, NodeRemoved, false, eventData.get()); 194 193 m_debuggerAgent->breakProgram(Inspector::DebuggerFrontendDispatcher::Reason::DOM, WTFMove(eventData)); 195 } else if (parentNode && hasBreakpoint(parentNode, SubtreeModified)) { 196 Ref<JSON::Object> eventData = JSON::Object::create(); 194 return; 195 } 196 197 uint32_t rootBit = 1 << NodeRemoved; 198 uint32_t derivedBit = rootBit << domBreakpointDerivedTypeShift; 199 uint32_t matchBit = rootBit | derivedBit; 200 for (auto& [nodeWithBreakpoint, breakpointTypes] : m_domBreakpoints) { 201 if (node.contains(nodeWithBreakpoint) && (breakpointTypes & matchBit)) { 202 auto eventData = JSON::Object::create(); 203 descriptionForDOMEvent(*nodeWithBreakpoint, NodeRemoved, false, eventData.get()); 204 if (auto* domAgent = m_instrumentingAgents.inspectorDOMAgent()) 205 eventData->setInteger("targetNodeId"_s, domAgent->pushNodeToFrontend(&node)); 206 m_debuggerAgent->breakProgram(Inspector::DebuggerFrontendDispatcher::Reason::DOM, WTFMove(eventData)); 207 return; 208 } 209 } 210 211 auto* parentNode = InspectorDOMAgent::innerParentNode(&node); 212 if (parentNode && hasBreakpoint(parentNode, SubtreeModified)) { 213 auto eventData = JSON::Object::create(); 197 214 descriptionForDOMEvent(node, SubtreeModified, false, eventData.get()); 198 215 m_debuggerAgent->breakProgram(Inspector::DebuggerFrontendDispatcher::Reason::DOM, WTFMove(eventData)); 216 return; 199 217 } 200 218 } … … 274 292 // For inheritable breakpoint types, target node isn't always the same as the node that owns a breakpoint. 275 293 // Target node may be unknown to frontend, so we need to push it first. 276 RefPtr<Inspector::Protocol::Runtime::RemoteObject> targetNodeObject = domAgent->resolveNode(&target, InspectorDebuggerAgent::backtraceObjectGroup); 277 description.setValue("targetNode", targetNodeObject); 294 description.setInteger("targetNodeId"_s, domAgent->pushNodeToFrontend(&target)); 278 295 } 279 296 -
trunk/Source/WebCore/inspector/agents/page/PageDOMDebuggerAgent.h
r250996 r251871 65 65 void descriptionForDOMEvent(Node&, int breakpointType, bool insertion, JSON::Object& description); 66 66 void updateSubtreeBreakpoints(Node*, uint32_t rootMask, bool set); 67 bool checkSubtreeForNodeRemoved(Node*); 67 68 bool hasBreakpoint(Node*, int type); 68 69 -
trunk/Source/WebInspectorUI/ChangeLog
r251853 r251871 1 2019-10-31 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: DOMDebugger: Node Removed breakpoints should fire whenever the node is removed from the main DOM tree, not just when it's removed from it's parent 4 https://bugs.webkit.org/show_bug.cgi?id=203349 5 6 Reviewed by Matt Baker. 7 8 Replace `targetNode` (which was a `Runtime.RemoteObject`) with a `targetNodeId` (which is a 9 `DOM.NodeId`) when dispatching `DOMDebugger` pauses. Additionally, include the ancestor's 10 `DOM.NodeId` as the `targetNodeId` whenever an ancestor is removed that has a descendant 11 with a node removed DOM breakpoint. 12 13 * UserInterface/Views/SourcesNavigationSidebarPanel.js: 14 (WI.SourcesNavigationSidebarPanel.prototype._updatePauseReasonSection): 15 16 * Localizations/en.lproj/localizedStrings.js: 17 1 18 2019-10-31 Yury Semikhatsky <yurys@chromium.org> 2 19 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r251624 r251871 892 892 localizedStrings["Remove probe"] = "Remove probe"; 893 893 localizedStrings["Remove this breakpoint action"] = "Remove this breakpoint action"; 894 localizedStrings["Removed ancestor "] = "Removed ancestor "; 894 895 localizedStrings["Removed descendant "] = "Removed descendant "; 895 896 localizedStrings["Render Pipeline %d"] = "Render Pipeline %d"; -
trunk/Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js
r251531 r251871 1466 1466 this._pauseReasonGroup.rows = [domBreakpointRow, ownerElementRow]; 1467 1467 1468 if (domBreakpoint.type !== WI.DOMBreakpoint.Type.SubtreeModified) 1469 return true; 1470 1471 console.assert(pauseData.targetNode); 1472 1473 let remoteObject = WI.RemoteObject.fromPayload(pauseData.targetNode, target); 1474 remoteObject.pushNodeToFrontend((nodeId) => { 1468 let updateTargetDescription = (nodeId) => { 1475 1469 if (!nodeId) 1476 1470 return; … … 1482 1476 1483 1477 let fragment = document.createDocumentFragment(); 1484 let description = pauseData.insertion ? WI.UIString("Child added to ") : WI.UIString("Removed descendant "); 1478 1479 let description = null; 1480 switch (domBreakpoint.type) { 1481 case WI.DOMBreakpoint.Type.SubtreeModified: 1482 description = pauseData.insertion ? WI.UIString("Child added to ") : WI.UIString("Removed descendant "); 1483 break; 1484 case WI.DOMBreakpoint.Type.NodeRemoved: 1485 description = WI.UIString("Removed ancestor "); 1486 break; 1487 } 1488 console.assert(description); 1485 1489 fragment.append(description, WI.linkifyNodeReference(node)); 1486 1490 … … 1489 1493 1490 1494 this._pauseReasonGroup.rows = this._pauseReasonGroup.rows.concat(targetDescriptionRow); 1491 }); 1495 }; 1496 1497 if (pauseData.targetNodeId) { 1498 console.assert(domBreakpoint.type === WI.DOMBreakpoint.Type.SubtreeModified || domBreakpoint.type === WI.DOMBreakpoint.Type.NodeRemoved); 1499 updateTargetDescription(pauseData.targetNodeId); 1500 } else if (pauseData.targetNode) { // COMPATIBILITY (iOS 13): `targetNode` was renamed to `targetNodeId` and was changed from a `Runtime.RemoteObject` to a `DOM.NodeId`. 1501 console.assert(domBreakpoint.type === WI.DOMBreakpoint.Type.SubtreeModified); 1502 let remoteObject = WI.RemoteObject.fromPayload(pauseData.targetNode, target); 1503 remoteObject.pushNodeToFrontend(updateTargetDescription); 1504 } 1492 1505 1493 1506 return true;
Note: See TracChangeset
for help on using the changeset viewer.