Chromium Code Reviews| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 for (var id in this._breakpointElements) { | 127 for (var id in this._breakpointElements) { |
| 128 var element = this._breakpointElements[id]; | 128 var element = this._breakpointElements[id]; |
| 129 if (element._node === node && element._checkboxElement.checked) | 129 if (element._node === node && element._checkboxElement.checked) |
| 130 return true; | 130 return true; |
| 131 } | 131 } |
| 132 return false; | 132 return false; |
| 133 }, | 133 }, |
| 134 | 134 |
| 135 /** | 135 /** |
| 136 * @param {!WebInspector.DebuggerPausedDetails} details | 136 * @param {!WebInspector.DebuggerPausedDetails} details |
| 137 * @param {function(!Element)} callback | 137 * @return {!Element} |
| 138 */ | 138 */ |
| 139 createBreakpointHitStatusMessage: function(details, callback) | 139 createBreakpointHitStatusMessage: function(details) |
| 140 { | 140 { |
| 141 var auxData = /** @type {!Object} */ (details.auxData); | 141 var auxData = /** @type {!Object} */ (details.auxData); |
| 142 var message = "Paused on a \"%s\" breakpoint."; | |
| 143 var substitutions = []; | |
| 144 substitutions.push(this._breakpointTypeLabels[auxData["type"]]); | |
| 145 | |
| 142 var domModel = WebInspector.DOMModel.fromTarget(details.target()); | 146 var domModel = WebInspector.DOMModel.fromTarget(details.target()); |
| 143 if (!domModel) | 147 if (!domModel) |
| 144 return; | 148 return WebInspector.formatLocalized(message, substitutions); |
| 145 if (auxData.type === this._breakpointTypes.SubtreeModified) { | |
| 146 var targetNodeObject = details.target().runtimeModel.createRemoteObj ect(auxData["targetNode"]); | |
| 147 domModel.pushObjectAsNodeToFrontend(targetNodeObject, didPushNodeToF rontend.bind(this)); | |
| 148 } else { | |
| 149 this._doCreateBreakpointHitStatusMessage(auxData, domModel.nodeForId (auxData.nodeId), null, callback); | |
| 150 } | |
| 151 | 149 |
| 152 /** | 150 var node = domModel.nodeForId(auxData["nodeId"]); |
| 153 * @param {?WebInspector.DOMNode} targetNode | 151 var linkifiedNode = WebInspector.DOMPresentationUtils.linkifyNodeReferen ce(node); |
| 154 * @this {WebInspector.DOMBreakpointsSidebarPane} | 152 substitutions.push(linkifiedNode); |
| 155 */ | |
| 156 function didPushNodeToFrontend(targetNode) | |
| 157 { | |
| 158 if (targetNode) | |
| 159 targetNodeObject.release(); | |
| 160 this._doCreateBreakpointHitStatusMessage(auxData, domModel.nodeForId (auxData.nodeId), targetNode, callback); | |
| 161 } | |
| 162 }, | |
| 163 | 153 |
| 164 /** | 154 var targetNode = auxData["targetNode"] ? domModel.nodeForId(auxData["tar getNode"]) : null; |
|
kozy
2016/07/26 17:27:56
targetNodeId?
dgozman
2016/07/26 19:12:16
Done.
| |
| 165 * @param {!Object} auxData | 155 var targetNodeLink = targetNode ? WebInspector.DOMPresentationUtils.link ifyNodeReference(targetNode) : ""; |
| 166 * @param {?WebInspector.DOMNode} node | |
| 167 * @param {?WebInspector.DOMNode} targetNode | |
| 168 * @param {function(!Element)} callback | |
| 169 */ | |
| 170 _doCreateBreakpointHitStatusMessage: function(auxData, node, targetNode, cal lback) | |
| 171 { | |
| 172 var message; | |
| 173 var typeLabel = this._breakpointTypeLabels[auxData.type]; | |
| 174 var linkifiedNode = WebInspector.DOMPresentationUtils.linkifyNodeReferen ce(node); | |
| 175 var substitutions = [typeLabel, linkifiedNode]; | |
| 176 var targetNodeLink = ""; | |
| 177 if (targetNode) | |
| 178 targetNodeLink = WebInspector.DOMPresentationUtils.linkifyNodeRefere nce(targetNode); | |
| 179 | 156 |
| 180 if (auxData.type === this._breakpointTypes.SubtreeModified) { | 157 if (auxData.type === this._breakpointTypes.SubtreeModified) { |
| 181 if (auxData.insertion) { | 158 if (auxData["insertion"]) { |
| 182 if (targetNode !== node) { | 159 if (targetNode !== node) { |
| 183 message = "Paused on a \"%s\" breakpoint set on %s, because a new child was added to its descendant %s."; | 160 message = "Paused on a \"%s\" breakpoint set on %s, because a new child was added to its descendant %s."; |
| 184 substitutions.push(targetNodeLink); | 161 substitutions.push(targetNodeLink); |
| 185 } else | 162 } else |
| 186 message = "Paused on a \"%s\" breakpoint set on %s, because a new child was added to that node."; | 163 message = "Paused on a \"%s\" breakpoint set on %s, because a new child was added to that node."; |
| 187 } else { | 164 } else { |
| 188 message = "Paused on a \"%s\" breakpoint set on %s, because its descendant %s was removed."; | 165 message = "Paused on a \"%s\" breakpoint set on %s, because its descendant %s was removed."; |
| 189 substitutions.push(targetNodeLink); | 166 substitutions.push(targetNodeLink); |
| 190 } | 167 } |
| 191 } else | 168 } else { |
| 192 message = "Paused on a \"%s\" breakpoint set on %s."; | 169 message = "Paused on a \"%s\" breakpoint set on %s."; |
| 170 } | |
| 193 | 171 |
| 194 var element = WebInspector.formatLocalized(message, substitutions); | 172 return WebInspector.formatLocalized(message, substitutions); |
| 195 | |
| 196 callback(element); | |
| 197 }, | 173 }, |
| 198 | 174 |
| 199 _nodeRemoved: function(event) | 175 _nodeRemoved: function(event) |
| 200 { | 176 { |
| 201 var node = event.data.node; | 177 var node = event.data.node; |
| 202 this._removeBreakpointsForNode(event.data.node); | 178 this._removeBreakpointsForNode(event.data.node); |
| 203 var children = node.children(); | 179 var children = node.children(); |
| 204 if (!children) | 180 if (!children) |
| 205 return; | 181 return; |
| 206 for (var i = 0; i < children.length; ++i) | 182 for (var i = 0; i < children.length; ++i) |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 467 this._wrappedPane.show(this.element); | 443 this._wrappedPane.show(this.element); |
| 468 }, | 444 }, |
| 469 | 445 |
| 470 __proto__: WebInspector.View.prototype | 446 __proto__: WebInspector.View.prototype |
| 471 } | 447 } |
| 472 | 448 |
| 473 /** | 449 /** |
| 474 * @type {!WebInspector.DOMBreakpointsSidebarPane} | 450 * @type {!WebInspector.DOMBreakpointsSidebarPane} |
| 475 */ | 451 */ |
| 476 WebInspector.domBreakpointsSidebarPane; | 452 WebInspector.domBreakpointsSidebarPane; |
| OLD | NEW |