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

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

Issue 2931143003: DevTools: make debugger's rawLocationToUILocation return nullable type (Closed)
Patch Set: add test Created 3 years, 6 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 */ 267 */
268 _onContextMenu(event) { 268 _onContextMenu(event) {
269 var item = this._list.itemForNode(/** @type {?Node} */ (event.target)); 269 var item = this._list.itemForNode(/** @type {?Node} */ (event.target));
270 if (!item) 270 if (!item)
271 return; 271 return;
272 var contextMenu = new UI.ContextMenu(event); 272 var contextMenu = new UI.ContextMenu(event);
273 if (item.debuggerCallFrame) 273 if (item.debuggerCallFrame)
274 contextMenu.appendItem(Common.UIString('Restart frame'), () => item.debugg erCallFrame.restart()); 274 contextMenu.appendItem(Common.UIString('Restart frame'), () => item.debugg erCallFrame.restart());
275 contextMenu.appendItem(Common.UIString('Copy stack trace'), this._copyStackT race.bind(this)); 275 contextMenu.appendItem(Common.UIString('Copy stack trace'), this._copyStackT race.bind(this));
276 var location = this._itemLocation(item); 276 var location = this._itemLocation(item);
277 if (location) { 277 var uiLocation = location ? Bindings.debuggerWorkspaceBinding.rawLocationToU ILocation(location) : null;
278 var uiLocation = Bindings.debuggerWorkspaceBinding.rawLocationToUILocation (location); 278 if (uiLocation)
279 this.appendBlackboxURLContextMenuItems(contextMenu, uiLocation.uiSourceCod e); 279 this.appendBlackboxURLContextMenuItems(contextMenu, uiLocation.uiSourceCod e);
280 }
281 contextMenu.show(); 280 contextMenu.show();
282 } 281 }
283 282
284 /** 283 /**
285 * @param {!Event} event 284 * @param {!Event} event
286 */ 285 */
287 _onClick(event) { 286 _onClick(event) {
288 var item = this._list.itemForNode(/** @type {?Node} */ (event.target)); 287 var item = this._list.itemForNode(/** @type {?Node} */ (event.target));
289 if (item) 288 if (item)
290 this._activateItem(item); 289 this._activateItem(item);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 return this._list.selectPreviousItem(false /* canWrap */, false /* center */ ); 353 return this._list.selectPreviousItem(false /* canWrap */, false /* center */ );
355 } 354 }
356 355
357 _copyStackTrace() { 356 _copyStackTrace() {
358 var text = []; 357 var text = [];
359 for (var item of this._items) { 358 for (var item of this._items) {
360 if (item.promiseCreationFrame) 359 if (item.promiseCreationFrame)
361 continue; 360 continue;
362 var itemText = this._itemTitle(item); 361 var itemText = this._itemTitle(item);
363 var location = this._itemLocation(item); 362 var location = this._itemLocation(item);
364 if (location) { 363 var uiLocation = location ? Bindings.debuggerWorkspaceBinding.rawLocationT oUILocation(location) : null;
365 var uiLocation = Bindings.debuggerWorkspaceBinding.rawLocationToUILocati on(location); 364 if (uiLocation)
366 itemText += ' (' + uiLocation.linkText(true /* skipTrim */) + ')'; 365 itemText += ' (' + uiLocation.linkText(true /* skipTrim */) + ')';
367 }
368 text.push(itemText); 366 text.push(itemText);
369 } 367 }
370 InspectorFrontendHost.copyText(text.join('\n')); 368 InspectorFrontendHost.copyText(text.join('\n'));
371 } 369 }
372 370
373 /** 371 /**
374 * @param {function(!Array.<!UI.KeyboardShortcut.Descriptor>, function(!Event= ):boolean)} registerShortcutDelegate 372 * @param {function(!Array.<!UI.KeyboardShortcut.Descriptor>, function(!Event= ):boolean)} registerShortcutDelegate
375 */ 373 */
376 registerShortcuts(registerShortcutDelegate) { 374 registerShortcuts(registerShortcutDelegate) {
377 registerShortcutDelegate( 375 registerShortcutDelegate(
378 UI.ShortcutsScreen.SourcesPanelShortcuts.NextCallFrame, this._selectNext CallFrameOnStack.bind(this)); 376 UI.ShortcutsScreen.SourcesPanelShortcuts.NextCallFrame, this._selectNext CallFrameOnStack.bind(this));
379 registerShortcutDelegate( 377 registerShortcutDelegate(
380 UI.ShortcutsScreen.SourcesPanelShortcuts.PrevCallFrame, this._selectPrev iousCallFrameOnStack.bind(this)); 378 UI.ShortcutsScreen.SourcesPanelShortcuts.PrevCallFrame, this._selectPrev iousCallFrameOnStack.bind(this));
381 } 379 }
382 }; 380 };
383 381
384 /** 382 /**
385 * @typedef {{ 383 * @typedef {{
386 * debuggerCallFrame: (SDK.DebuggerModel.CallFrame|undefined), 384 * debuggerCallFrame: (SDK.DebuggerModel.CallFrame|undefined),
387 * asyncStackHeader: (string|undefined), 385 * asyncStackHeader: (string|undefined),
388 * runtimeCallFrame: (Protocol.Runtime.CallFrame|undefined), 386 * runtimeCallFrame: (Protocol.Runtime.CallFrame|undefined),
389 * promiseCreationFrame: (Protocol.Runtime.CallFrame|undefined) 387 * promiseCreationFrame: (Protocol.Runtime.CallFrame|undefined)
390 * }} 388 * }}
391 */ 389 */
392 Sources.CallStackSidebarPane.Item; 390 Sources.CallStackSidebarPane.Item;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698