1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497
|
/*
* Copyright (C) 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
WebInspector.DebuggerSidebarPanel = function()
{
WebInspector.NavigationSidebarPanel.call(this, "debugger", WebInspector.UIString("Debugger"), "Images/NavigationItemBug.pdf", "3", true);
WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceChanged, this);
WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceAdded, this);
WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, this._debuggerCallFramesDidChange, this);
WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointAdded, this._breakpointAdded, this);
WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointRemoved, this._breakpointRemoved, this);
WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, this._scriptAdded, this);
WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptsCleared, this._scriptsCleared, this);
WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Paused, this._debuggerDidPause, this);
WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, this._debuggerDidResume, this);
this._pauseOrResumeKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control | WebInspector.KeyboardShortcut.Modifier.Command, "Y", this._debuggerPauseResumeButtonClicked.bind(this));
this._stepOverKeyboardShortcut = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.F6, this._debuggerStepOverButtonClicked.bind(this));
this._stepIntoKeyboardShortcut = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.F7, this._debuggerStepIntoButtonClicked.bind(this));
this._stepOutKeyboardShortcut = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.F8, this._debuggerStepOutButtonClicked.bind(this));
this._pauseOrResumeAlternateKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Command, WebInspector.KeyboardShortcut.Key.Slash, this._debuggerPauseResumeButtonClicked.bind(this));
this._stepOverAlternateKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Command, WebInspector.KeyboardShortcut.Key.SingleQuote, this._debuggerStepOverButtonClicked.bind(this));
this._stepIntoAlternateKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Command, WebInspector.KeyboardShortcut.Key.Semicolon, this._debuggerStepIntoButtonClicked.bind(this));
this._stepOutAlternateKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Shift | WebInspector.KeyboardShortcut.Modifier.Command, WebInspector.KeyboardShortcut.Key.Semicolon, this._debuggerStepOutButtonClicked.bind(this));
this._navigationBar = new WebInspector.NavigationBar;
this.element.appendChild(this._navigationBar.element);
var toolTip = WebInspector.UIString("Enable all breakpoints");
var altToolTip = WebInspector.UIString("Disable all breakpoints");
this._debuggerBreakpointsButtonItem = new WebInspector.ActivateButtonNavigationItem("debugger-breakpoints", toolTip, altToolTip, "Images/Breakpoints.pdf", 16, 16);
this._debuggerBreakpointsButtonItem.activated = WebInspector.debuggerManager.breakpointsEnabled;
this._debuggerBreakpointsButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._breakpointsToggleButtonClicked, this);
this._navigationBar.addNavigationItem(this._debuggerBreakpointsButtonItem);
toolTip = WebInspector.UIString("Pause script execution (%s or %s)").format(this._pauseOrResumeKeyboardShortcut.displayName, this._pauseOrResumeAlternateKeyboardShortcut.displayName);
altToolTip = WebInspector.UIString("Continue script execution (%s or %s)").format(this._pauseOrResumeKeyboardShortcut.displayName, this._pauseOrResumeAlternateKeyboardShortcut.displayName);
this._debuggerPauseResumeButtonItem = new WebInspector.ToggleButtonNavigationItem("debugger-pause-resume", toolTip, altToolTip, "Images/Pause.pdf", "Images/Resume.pdf", 16, 16);
this._debuggerPauseResumeButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._debuggerPauseResumeButtonClicked, this);
this._navigationBar.addNavigationItem(this._debuggerPauseResumeButtonItem);
this._debuggerStepOverButtonItem = new WebInspector.ButtonNavigationItem("debugger-step-over", WebInspector.UIString("Step over (%s or %s)").format(this._stepOverKeyboardShortcut.displayName, this._stepOverAlternateKeyboardShortcut.displayName), "Images/StepOver.pdf", 16, 16);
this._debuggerStepOverButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._debuggerStepOverButtonClicked, this);
this._debuggerStepOverButtonItem.enabled = false;
this._navigationBar.addNavigationItem(this._debuggerStepOverButtonItem);
this._debuggerStepIntoButtonItem = new WebInspector.ButtonNavigationItem("debugger-step-into", WebInspector.UIString("Step into (%s or %s)").format(this._stepIntoKeyboardShortcut.displayName, this._stepIntoAlternateKeyboardShortcut.displayName), "Images/StepInto.pdf", 16, 16);
this._debuggerStepIntoButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._debuggerStepIntoButtonClicked, this);
this._debuggerStepIntoButtonItem.enabled = false;
this._navigationBar.addNavigationItem(this._debuggerStepIntoButtonItem);
this._debuggerStepOutButtonItem = new WebInspector.ButtonNavigationItem("debugger-step-out", WebInspector.UIString("Step out (%s or %s)").format(this._stepOutKeyboardShortcut.displayName, this._stepOutAlternateKeyboardShortcut.displayName), "Images/StepOut.pdf", 16, 16);
this._debuggerStepOutButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._debuggerStepOutButtonClicked, this);
this._debuggerStepOutButtonItem.enabled = false;
this._navigationBar.addNavigationItem(this._debuggerStepOutButtonItem);
// Add this offset-sections class name so the sticky headers don't overlap the navigation bar.
this.element.classList.add(WebInspector.DebuggerSidebarPanel.OffsetSectionsStyleClassName);
this._allExceptionsBreakpointTreeElement = new WebInspector.BreakpointTreeElement(WebInspector.debuggerManager.allExceptionsBreakpoint, WebInspector.DebuggerSidebarPanel.ExceptionIconStyleClassName, WebInspector.UIString("All Exceptions"));
this._allUncaughtExceptionsBreakpointTreeElement = new WebInspector.BreakpointTreeElement(WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint, WebInspector.DebuggerSidebarPanel.ExceptionIconStyleClassName, WebInspector.UIString("All Uncaught Exceptions"));
this.filterBar.placeholder = WebInspector.UIString("Filter Breakpoint List");
this._breakpointsContentTreeOutline = this.contentTreeOutline;
this._breakpointsContentTreeOutline.onselect = this._treeElementSelected.bind(this);
this._breakpointsContentTreeOutline.ondelete = this._breakpointTreeOutlineDeleteTreeElement.bind(this);
this._breakpointsContentTreeOutline.oncontextmenu = this._breakpointTreeOutlineContextMenuTreeElement.bind(this);
this._breakpointsContentTreeOutline.appendChild(this._allExceptionsBreakpointTreeElement);
this._breakpointsContentTreeOutline.appendChild(this._allUncaughtExceptionsBreakpointTreeElement);
var breakpointsRow = new WebInspector.DetailsSectionRow;
breakpointsRow.element.appendChild(this._breakpointsContentTreeOutline.element);
var breakpointsGroup = new WebInspector.DetailsSectionGroup([breakpointsRow]);
var breakpointsSection = new WebInspector.DetailsSection("breakpoints", WebInspector.UIString("Breakpoints"), [breakpointsGroup]);
this.contentElement.appendChild(breakpointsSection.element);
this._callStackContentTreeOutline = this.createContentTreeOutline(true);
this._callStackContentTreeOutline.onselect = this._treeElementSelected.bind(this);
this._callStackRow = new WebInspector.DetailsSectionRow(WebInspector.UIString("No Call Frames"));
this._callStackRow.showEmptyMessage();
var callStackGroup = new WebInspector.DetailsSectionGroup([this._callStackRow]);
this._callStackSection = new WebInspector.DetailsSection("call-stack", WebInspector.UIString("Call Stack"), [callStackGroup]);
WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisplayLocationDidChange, this._breakpointDisplayLocationDidChange, this);
};
WebInspector.DebuggerSidebarPanel.OffsetSectionsStyleClassName = "offset-sections";
WebInspector.DebuggerSidebarPanel.ExceptionIconStyleClassName = "breakpoint-exception-icon";
WebInspector.DebuggerSidebarPanel.prototype = {
constructor: WebInspector.DebuggerSidebarPanel,
// Private
_debuggerPauseResumeButtonClicked: function(event)
{
if (WebInspector.debuggerManager.paused)
WebInspector.debuggerManager.resume();
else {
this._debuggerPauseResumeButtonItem.enabled = false;
WebInspector.debuggerManager.pause();
}
},
_debuggerStepOverButtonClicked: function(event)
{
WebInspector.debuggerManager.stepOver();
},
_debuggerStepIntoButtonClicked: function(event)
{
WebInspector.debuggerManager.stepInto();
},
_debuggerStepOutButtonClicked: function(event)
{
WebInspector.debuggerManager.stepOut();
},
_debuggerDidPause: function(event)
{
this.contentElement.insertBefore(this._callStackSection.element, this.contentElement.firstChild);
this._debuggerPauseResumeButtonItem.enabled = true;
this._debuggerPauseResumeButtonItem.toggled = true;
this._debuggerStepOverButtonItem.enabled = true;
this._debuggerStepIntoButtonItem.enabled = true;
this._debuggerStepOutButtonItem.enabled = true;
},
_debuggerDidResume: function(event)
{
this._callStackSection.element.remove();
this._debuggerPauseResumeButtonItem.enabled = true;
this._debuggerPauseResumeButtonItem.toggled = false;
this._debuggerStepOverButtonItem.enabled = false;
this._debuggerStepIntoButtonItem.enabled = false;
this._debuggerStepOutButtonItem.enabled = false;
},
_breakpointsToggleButtonClicked: function(event)
{
this._debuggerBreakpointsButtonItem.activated = !this._debuggerBreakpointsButtonItem.activated;
WebInspector.debuggerManager.breakpointsEnabled = this._debuggerBreakpointsButtonItem.activated;
},
_addBreakpoint: function(breakpoint, sourceCode)
{
var sourceCode = breakpoint.sourceCodeLocation.displaySourceCode;
if (!sourceCode)
return null;
var parentTreeElement = this._breakpointsContentTreeOutline.getCachedTreeElement(sourceCode);
if (!parentTreeElement) {
if (sourceCode instanceof WebInspector.SourceMapResource)
parentTreeElement = new WebInspector.SourceMapResourceTreeElement(sourceCode);
else if (sourceCode instanceof WebInspector.Resource)
parentTreeElement = new WebInspector.ResourceTreeElement(sourceCode);
else if (sourceCode instanceof WebInspector.Script)
parentTreeElement = new WebInspector.ScriptTreeElement(sourceCode);
}
if (!parentTreeElement.parent) {
parentTreeElement.hasChildren = true;
parentTreeElement.expand();
this._breakpointsContentTreeOutline.insertChild(parentTreeElement, insertionIndexForObjectInListSortedByFunction(parentTreeElement, this._breakpointsContentTreeOutline.children, this._compareTopLevelTreeElements.bind(this)));
}
// Mark disabled breakpoints as resolved if there is source code loaded with that URL.
// This gives the illusion the breakpoint was resolved, but since we don't send disabled
// breakpoints to the backend we don't know for sure. If the user enables the breakpoint
// it will be resolved properly.
if (breakpoint.disabled)
breakpoint.resolved = true;
var breakpointTreeElement = new WebInspector.BreakpointTreeElement(breakpoint);
parentTreeElement.insertChild(breakpointTreeElement, insertionIndexForObjectInListSortedByFunction(breakpointTreeElement, parentTreeElement.children, this._compareBreakpointTreeElements));
return breakpointTreeElement;
},
_addBreakpointsForSourceCode: function(sourceCode)
{
var breakpoints = WebInspector.debuggerManager.breakpointsForSourceCode(sourceCode);
for (var i = 0; i < breakpoints.length; ++i)
this._addBreakpoint(breakpoints[i], sourceCode);
},
_resourceAdded: function(event)
{
var resource = event.data.resource;
this._addBreakpointsForSourceCode(resource);
},
_mainResourceChanged: function(event)
{
var resource = event.target.mainResource;
this._addBreakpointsForSourceCode(resource);
},
_scriptAdded: function(event)
{
var script = event.data.script;
// Don't add breakpoints if the script is represented by a Resource. They were
// already added by _resourceAdded.
if (script.resource)
return;
this._addBreakpointsForSourceCode(script);
},
_scriptsCleared: function(event)
{
for (var i = this._breakpointsContentTreeOutline.children.length - 1; i >= 0; --i) {
var treeElement = this._breakpointsContentTreeOutline.children[i];
if (!(treeElement instanceof WebInspector.ScriptTreeElement))
continue;
this._breakpointsContentTreeOutline.removeChildAtIndex(i, true, true);
}
},
_breakpointAdded: function(event)
{
var breakpoint = event.data.breakpoint;
this._addBreakpoint(breakpoint);
},
_breakpointRemoved: function(event)
{
var breakpoint = event.data.breakpoint;
var breakpointTreeElement = this._breakpointsContentTreeOutline.getCachedTreeElement(breakpoint);
console.assert(breakpointTreeElement);
if (!breakpointTreeElement)
return;
this._removeBreakpointTreeElement(breakpointTreeElement);
},
_breakpointDisplayLocationDidChange: function(event)
{
var breakpoint = event.target;
if (event.data.oldDisplaySourceCode === breakpoint.displaySourceCode)
return;
var breakpointTreeElement = this._breakpointsContentTreeOutline.getCachedTreeElement(breakpoint);
if (!breakpointTreeElement)
return;
// A known breakpoint moved between resources, remove the old tree element
// and create a new tree element with the updated file.
var wasSelected = breakpointTreeElement.selected;
this._removeBreakpointTreeElement(breakpointTreeElement);
var newBreakpointTreeElement = this._addBreakpoint(breakpoint);
if (newBreakpointTreeElement && wasSelected)
newBreakpointTreeElement.revealAndSelect(true, false, true, true);
},
_removeBreakpointTreeElement: function(breakpointTreeElement)
{
var parentTreeElement = breakpointTreeElement.parent;
parentTreeElement.removeChild(breakpointTreeElement);
console.assert(parentTreeElement.parent === this._breakpointsContentTreeOutline);
if (!parentTreeElement.children.length)
this._breakpointsContentTreeOutline.removeChild(parentTreeElement);
},
_debuggerCallFramesDidChange: function()
{
this._callStackContentTreeOutline.removeChildren();
var callFrames = WebInspector.debuggerManager.callFrames;
if (!callFrames || !callFrames.length) {
this._callStackRow.showEmptyMessage();
return;
}
this._callStackRow.hideEmptyMessage();
this._callStackRow.element.appendChild(this._callStackContentTreeOutline.element);
var treeElementToSelect = null;
var activeCallFrame = WebInspector.debuggerManager.activeCallFrame;
for (var i = 0; i < callFrames.length; ++i) {
var callFrameTreeElement = new WebInspector.CallFrameTreeElement(callFrames[i]);
if (callFrames[i] === activeCallFrame)
treeElementToSelect = callFrameTreeElement;
this._callStackContentTreeOutline.appendChild(callFrameTreeElement);
}
if (treeElementToSelect)
treeElementToSelect.select(true, true);
},
_breakpointsBeneathTreeElement: function(treeElement)
{
console.assert(treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement);
if (!(treeElement instanceof WebInspector.ResourceTreeElement) && !(treeElement instanceof WebInspector.ScriptTreeElement))
return [];
var breakpoints = [];
var breakpointTreeElements = treeElement.children;
for (var i = 0; i < breakpointTreeElements.length; ++i) {
console.assert(breakpointTreeElements[i] instanceof WebInspector.BreakpointTreeElement);
console.assert(breakpointTreeElements[i].breakpoint);
var breakpoint = breakpointTreeElements[i].breakpoint;
if (breakpoint)
breakpoints.push(breakpoint);
}
return breakpoints;
},
_removeAllBreakpoints: function(breakpoints)
{
for (var i = 0; i < breakpoints.length; ++i) {
var breakpoint = breakpoints[i];
if (WebInspector.debuggerManager.isBreakpointRemovable(breakpoint))
WebInspector.debuggerManager.removeBreakpoint(breakpoint);
}
},
_toggleAllBreakpoints: function(breakpoints, disabled)
{
for (var i = 0; i < breakpoints.length; ++i)
breakpoints[i].disabled = disabled;
},
_breakpointTreeOutlineDeleteTreeElement: function(treeElement)
{
console.assert(treeElement.selected);
console.assert(treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement);
if (!(treeElement instanceof WebInspector.ResourceTreeElement) && !(treeElement instanceof WebInspector.ScriptTreeElement))
return false;
var wasTopResourceTreeElement = treeElement.previousSibling === this._allUncaughtExceptionsBreakpointTreeElement;
var nextSibling = treeElement.nextSibling;
var breakpoints = this._breakpointsBeneathTreeElement(treeElement);
this._removeAllBreakpoints(breakpoints);
if (wasTopResourceTreeElement && nextSibling)
nextSibling.select(true, true);
return true;
},
_breakpointTreeOutlineContextMenuTreeElement: function(event, treeElement)
{
console.assert(treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement);
if (!(treeElement instanceof WebInspector.ResourceTreeElement) && !(treeElement instanceof WebInspector.ScriptTreeElement))
return;
var breakpoints = this._breakpointsBeneathTreeElement(treeElement);
var shouldDisable = false;
for (var i = 0; i < breakpoints.length; ++i) {
if (!breakpoints[i].disabled) {
shouldDisable = true;
break;
}
}
function removeAllResourceBreakpoints()
{
this._removeAllBreakpoints(breakpoints);
}
function toggleAllResourceBreakpoints()
{
this._toggleAllBreakpoints(breakpoints, shouldDisable);
}
var contextMenu = new WebInspector.ContextMenu(event);
if (shouldDisable)
contextMenu.appendItem(WebInspector.UIString("Disable Breakpoints"), toggleAllResourceBreakpoints.bind(this));
else
contextMenu.appendItem(WebInspector.UIString("Enable Breakpoints"), toggleAllResourceBreakpoints.bind(this));
contextMenu.appendItem(WebInspector.UIString("Delete Breakpoints"), removeAllResourceBreakpoints.bind(this));
contextMenu.show();
},
_treeElementSelected: function(treeElement, selectedByUser)
{
function deselectCallStackContentTreeElements()
{
// Deselect any tree element in the call stack content tree outline to prevent two selections in the sidebar.
var selectedTreeElement = this._callStackContentTreeOutline.selectedTreeElement;
if (selectedTreeElement)
selectedTreeElement.deselect();
}
if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement) {
// If the resource is being selected when it has no children it is in the process of being deleted, don't do anything.
if (!treeElement.children.length)
return;
deselectCallStackContentTreeElements.call(this);
WebInspector.resourceSidebarPanel.showSourceCode(treeElement.representedObject);
return;
}
if (treeElement instanceof WebInspector.CallFrameTreeElement) {
// Deselect any tree element in the breakpoints content tree outline to prevent two selections in the sidebar.
var selectedTreeElement = this._breakpointsContentTreeOutline.selectedTreeElement;
if (selectedTreeElement)
selectedTreeElement.deselect();
var callFrame = treeElement.callFrame;
WebInspector.debuggerManager.activeCallFrame = callFrame;
WebInspector.resourceSidebarPanel.showSourceCodeLocation(callFrame.sourceCodeLocation);
return;
}
if (!(treeElement instanceof WebInspector.BreakpointTreeElement))
return;
deselectCallStackContentTreeElements.call(this);
if (!treeElement.parent.representedObject)
return;
console.assert(treeElement.parent.representedObject instanceof WebInspector.SourceCode);
if (!(treeElement.parent.representedObject instanceof WebInspector.SourceCode))
return;
var breakpoint = treeElement.breakpoint;
WebInspector.resourceSidebarPanel.showSourceCodeLocation(breakpoint.sourceCodeLocation);
},
_compareTopLevelTreeElements: function(a, b)
{
if (a === this._allExceptionsBreakpointTreeElement)
return -1;
if (b === this._allExceptionsBreakpointTreeElement)
return 1;
if (a === this._allUncaughtExceptionsBreakpointTreeElement)
return -1;
if (b === this._allUncaughtExceptionsBreakpointTreeElement)
return 1;
return a.mainTitle.localeCompare(b.mainTitle);
},
_compareBreakpointTreeElements: function(a, b)
{
var aLocation = a.breakpoint.sourceCodeLocation;
var bLocation = b.breakpoint.sourceCodeLocation;
var comparisonResult = aLocation.displayLineNumber - bLocation.displayLineNumber
if (comparisonResult !== 0)
return comparisonResult;
return aLocation.displayColumnNumber - bLocation.displayColumnNumber;
}
};
WebInspector.DebuggerSidebarPanel.prototype.__proto__ = WebInspector.NavigationSidebarPanel.prototype;
|