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

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

Issue 2557763003: DevTools: sort completions by prototype. (Closed)
Patch Set: rebaselined Created 4 years 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 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 infoElement.className = 'gray-info-message'; 63 infoElement.className = 'gray-info-message';
64 infoElement.textContent = Common.UIString('Not Paused'); 64 infoElement.textContent = Common.UIString('Not Paused');
65 this.element.appendChild(infoElement); 65 this.element.appendChild(infoElement);
66 return; 66 return;
67 } 67 }
68 68
69 var foundLocalScope = false; 69 var foundLocalScope = false;
70 var scopeChain = callFrame.scopeChain(); 70 var scopeChain = callFrame.scopeChain();
71 for (var i = 0; i < scopeChain.length; ++i) { 71 for (var i = 0; i < scopeChain.length; ++i) {
72 var scope = scopeChain[i]; 72 var scope = scopeChain[i];
73 var title = null; 73 var title = scope.typeName();
74 var emptyPlaceholder = null; 74 var emptyPlaceholder = null;
75 var extraProperties = []; 75 var extraProperties = [];
76 76
77 switch (scope.type()) { 77 switch (scope.type()) {
78 case Protocol.Debugger.ScopeType.Local: 78 case Protocol.Debugger.ScopeType.Local:
79 foundLocalScope = true; 79 foundLocalScope = true;
80 title = Common.UIString('Local');
81 emptyPlaceholder = Common.UIString('No Variables'); 80 emptyPlaceholder = Common.UIString('No Variables');
82 if (thisObject) 81 if (thisObject)
83 extraProperties.push(new SDK.RemoteObjectProperty('this', thisObject )); 82 extraProperties.push(new SDK.RemoteObjectProperty('this', thisObject ));
84 if (i === 0) { 83 if (i === 0) {
85 var exception = details.exception(); 84 var exception = details.exception();
86 if (exception) { 85 if (exception) {
87 extraProperties.push(new SDK.RemoteObjectProperty( 86 extraProperties.push(new SDK.RemoteObjectProperty(
88 Common.UIString.capitalize('Exception'), exception, undefined, undefined, undefined, undefined, 87 Common.UIString.capitalize('Exception'), exception, undefined, undefined, undefined, undefined,
89 undefined, true)); 88 undefined, true));
90 } 89 }
91 var returnValue = callFrame.returnValue(); 90 var returnValue = callFrame.returnValue();
92 if (returnValue) { 91 if (returnValue) {
93 extraProperties.push(new SDK.RemoteObjectProperty( 92 extraProperties.push(new SDK.RemoteObjectProperty(
94 Common.UIString.capitalize('Return ^value'), returnValue, unde fined, undefined, undefined, undefined, 93 Common.UIString.capitalize('Return ^value'), returnValue, unde fined, undefined, undefined, undefined,
95 undefined, true)); 94 undefined, true));
96 } 95 }
97 } 96 }
98 break; 97 break;
99 case Protocol.Debugger.ScopeType.Closure: 98 case Protocol.Debugger.ScopeType.Closure:
100 var scopeName = scope.name(); 99 var scopeName = scope.name();
101 if (scopeName) 100 if (scopeName)
102 title = Common.UIString('Closure (%s)', UI.beautifyFunctionName(scop eName)); 101 title = Common.UIString('Closure (%s)', UI.beautifyFunctionName(scop eName));
103 else 102 else
104 title = Common.UIString('Closure'); 103 title = Common.UIString('Closure');
105 emptyPlaceholder = Common.UIString('No Variables'); 104 emptyPlaceholder = Common.UIString('No Variables');
106 break; 105 break;
107 case Protocol.Debugger.ScopeType.Catch:
108 title = Common.UIString('Catch');
109 break;
110 case Protocol.Debugger.ScopeType.Block:
111 title = Common.UIString('Block');
112 break;
113 case Protocol.Debugger.ScopeType.Script:
114 title = Common.UIString('Script');
115 break;
116 case Protocol.Debugger.ScopeType.With:
117 title = Common.UIString('With Block');
118 break;
119 case Protocol.Debugger.ScopeType.Global:
120 title = Common.UIString('Global');
121 break;
122 } 106 }
123 107
124 var subtitle = scope.description(); 108 var subtitle = scope.description();
125 if (!title || title === subtitle) 109 if (!title || title === subtitle)
126 subtitle = undefined; 110 subtitle = undefined;
127 111
128 var titleElement = createElementWithClass('div', 'scope-chain-sidebar-pane -section-header'); 112 var titleElement = createElementWithClass('div', 'scope-chain-sidebar-pane -section-header');
129 titleElement.createChild('div', 'scope-chain-sidebar-pane-section-subtitle ').textContent = subtitle; 113 titleElement.createChild('div', 'scope-chain-sidebar-pane-section-subtitle ').textContent = subtitle;
130 titleElement.createChild('div', 'scope-chain-sidebar-pane-section-title'). textContent = title; 114 titleElement.createChild('div', 'scope-chain-sidebar-pane-section-title'). textContent = title;
131 115
(...skipping 11 matching lines...) Expand all
143 this.element.appendChild(section.element); 127 this.element.appendChild(section.element);
144 } 128 }
145 this._sidebarPaneUpdatedForTest(); 129 this._sidebarPaneUpdatedForTest();
146 } 130 }
147 131
148 _sidebarPaneUpdatedForTest() { 132 _sidebarPaneUpdatedForTest() {
149 } 133 }
150 }; 134 };
151 135
152 Sources.ScopeChainSidebarPane._pathSymbol = Symbol('path'); 136 Sources.ScopeChainSidebarPane._pathSymbol = Symbol('path');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698