Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(873)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/CallStackSidebarPane.js

Issue 2191183003: DevTools: extract model from DOMBreakpointsSidebarPane (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address CL feedback from PS6 Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 var status = this.contentElement.createChild("div", "callstack-info"); 117 var status = this.contentElement.createChild("div", "callstack-info");
118 status.removeChildren(); 118 status.removeChildren();
119 119
120 if (!details) { 120 if (!details) {
121 status.textContent = WebInspector.UIString("Not Paused"); 121 status.textContent = WebInspector.UIString("Not Paused");
122 status.classList.toggle("status", false); 122 status.classList.toggle("status", false);
123 return; 123 return;
124 } 124 }
125 125
126 if (details.reason === WebInspector.DebuggerModel.BreakReason.DOM) { 126 if (details.reason === WebInspector.DebuggerModel.BreakReason.DOM) {
127 status.appendChild(WebInspector.domBreakpointsSidebarPane.createBrea kpointHitStatusMessage(details)); 127 status.appendChild(this._createDOMBreakpointHitStatusMessage(details ));
128 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.Eve ntListener) { 128 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.Eve ntListener) {
129 var eventName = details.auxData["eventName"]; 129 var eventName = details.auxData["eventName"];
130 var eventNameForUI = WebInspector.EventListenerBreakpointsSidebarPan e.eventNameForUI(eventName, details.auxData); 130 var eventNameForUI = WebInspector.EventListenerBreakpointsSidebarPan e.eventNameForUI(eventName, details.auxData);
131 status.textContent = WebInspector.UIString("Paused on a \"%s\" Event Listener.", eventNameForUI); 131 status.textContent = WebInspector.UIString("Paused on a \"%s\" Event Listener.", eventNameForUI);
132 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.XHR ) { 132 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.XHR ) {
133 status.textContent = WebInspector.UIString("Paused on a XMLHttpReque st."); 133 status.textContent = WebInspector.UIString("Paused on a XMLHttpReque st.");
134 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.Exc eption) { 134 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.Exc eption) {
135 var description = details.auxData["description"] || ""; 135 var description = details.auxData["description"] || "";
136 status.textContent = WebInspector.UIString("Paused on exception: '%s '.", description.split("\n", 1)[0]); 136 status.textContent = WebInspector.UIString("Paused on exception: '%s '.", description.split("\n", 1)[0]);
137 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.Pro miseRejection) { 137 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.Pro miseRejection) {
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 }, 438 },
439 439
440 _keyDown: function(event) 440 _keyDown: function(event)
441 { 441 {
442 if (event.altKey || event.shiftKey || event.metaKey || event.ctrlKey) 442 if (event.altKey || event.shiftKey || event.metaKey || event.ctrlKey)
443 return; 443 return;
444 if (event.key === "ArrowUp" && this._selectPreviousCallFrameOnStack() || event.key === "ArrowDown" && this._selectNextCallFrameOnStack()) 444 if (event.key === "ArrowUp" && this._selectPreviousCallFrameOnStack() || event.key === "ArrowDown" && this._selectNextCallFrameOnStack())
445 event.consume(true); 445 event.consume(true);
446 }, 446 },
447 447
448 /**
449 * @param {!WebInspector.DebuggerPausedDetails} details
450 * @return {!Element}
451 */
452 _createDOMBreakpointHitStatusMessage: function(details)
453 {
454 var auxData = /** @type {!Object} */ (details.auxData);
455 var message = "Paused on a \"%s\" breakpoint.";
456 var substitutions = [];
457 substitutions.push(WebInspector.DOMBreakpointsSidebarPane.BreakpointType Labels[auxData["type"]]);
458
459 var domModel = WebInspector.DOMModel.fromTarget(details.target());
460 if (!domModel)
461 return WebInspector.formatLocalized(message, substitutions);
462
463 var node = domModel.nodeForId(auxData["nodeId"]);
464 var linkifiedNode = WebInspector.DOMPresentationUtils.linkifyNodeReferen ce(node);
465 substitutions.push(linkifiedNode);
466
467 var targetNode = auxData["targetNodeId"] ? domModel.nodeForId(auxData["t argetNodeId"]) : null;
468 var targetNodeLink = targetNode ? WebInspector.DOMPresentationUtils.link ifyNodeReference(targetNode) : "";
469
470 if (auxData.type === WebInspector.DOMBreakpointsSidebarPane.BreakpointTy pes.SubtreeModified) {
471 if (auxData["insertion"]) {
472 if (targetNode !== node) {
473 message = "Paused on a \"%s\" breakpoint set on %s, because a new child was added to its descendant %s.";
474 substitutions.push(targetNodeLink);
475 } else
476 message = "Paused on a \"%s\" breakpoint set on %s, because a new child was added to that node.";
477 } else {
478 message = "Paused on a \"%s\" breakpoint set on %s, because its descendant %s was removed.";
479 substitutions.push(targetNodeLink);
480 }
481 } else {
482 message = "Paused on a \"%s\" breakpoint set on %s.";
483 }
484
485 return WebInspector.formatLocalized(message, substitutions);
486 },
487
448 __proto__: WebInspector.SimpleView.prototype 488 __proto__: WebInspector.SimpleView.prototype
449 } 489 }
450 490
451 /** 491 /**
452 * @constructor 492 * @constructor
453 * @extends {WebInspector.UIList.Item} 493 * @extends {WebInspector.UIList.Item}
454 * @param {string} functionName 494 * @param {string} functionName
455 * @param {!WebInspector.DebuggerModel.Location} location 495 * @param {!WebInspector.DebuggerModel.Location} location
456 * @param {!WebInspector.Linkifier} linkifier 496 * @param {!WebInspector.Linkifier} linkifier
457 * @param {?WebInspector.DebuggerModel.CallFrame} debuggerCallFrame 497 * @param {?WebInspector.DebuggerModel.CallFrame} debuggerCallFrame
(...skipping 26 matching lines...) Expand all
484 var uiLocation = liveLocation.uiLocation(); 524 var uiLocation = liveLocation.uiLocation();
485 if (!uiLocation) 525 if (!uiLocation)
486 return; 526 return;
487 var text = uiLocation.linkText(); 527 var text = uiLocation.linkText();
488 this.setSubtitle(text.trimMiddle(30)); 528 this.setSubtitle(text.trimMiddle(30));
489 this.subtitleElement.title = text; 529 this.subtitleElement.title = text;
490 }, 530 },
491 531
492 __proto__: WebInspector.UIList.Item.prototype 532 __proto__: WebInspector.UIList.Item.prototype
493 } 533 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698