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

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

Issue 1884213003: DevTools: teach SourceMapNamesResolver to resolve "this" object (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ids
Patch Set: fix tesst Created 4 years, 8 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 * 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 24 matching lines...) Expand all
35 } 35 }
36 36
37 WebInspector.ScopeChainSidebarPane._pathSymbol = Symbol("path"); 37 WebInspector.ScopeChainSidebarPane._pathSymbol = Symbol("path");
38 38
39 WebInspector.ScopeChainSidebarPane.prototype = { 39 WebInspector.ScopeChainSidebarPane.prototype = {
40 /** 40 /**
41 * @param {?WebInspector.DebuggerModel.CallFrame} callFrame 41 * @param {?WebInspector.DebuggerModel.CallFrame} callFrame
42 */ 42 */
43 update: function(callFrame) 43 update: function(callFrame)
44 { 44 {
45 WebInspector.SourceMapNamesResolver.resolveThisObject(callFrame)
46 .then(this._innerUpdate.bind(this, callFrame));
47 },
48
49 /**
50 * @param {?WebInspector.DebuggerModel.CallFrame} callFrame
51 * @param {?WebInspector.RemoteObject} thisObject
52 */
53 _innerUpdate: function(callFrame, thisObject)
54 {
45 this.element.removeChildren(); 55 this.element.removeChildren();
46 56
47 if (!callFrame) { 57 if (!callFrame) {
48 var infoElement = createElement("div"); 58 var infoElement = createElement("div");
49 infoElement.className = "info"; 59 infoElement.className = "info";
50 infoElement.textContent = WebInspector.UIString("Not Paused"); 60 infoElement.textContent = WebInspector.UIString("Not Paused");
51 this.element.appendChild(infoElement); 61 this.element.appendChild(infoElement);
52 return; 62 return;
53 } 63 }
54 64
55 var foundLocalScope = false; 65 var foundLocalScope = false;
56 var scopeChain = callFrame.scopeChain(); 66 var scopeChain = callFrame.scopeChain();
57 for (var i = 0; i < scopeChain.length; ++i) { 67 for (var i = 0; i < scopeChain.length; ++i) {
58 var scope = scopeChain[i]; 68 var scope = scopeChain[i];
59 var title = null; 69 var title = null;
60 var emptyPlaceholder = null; 70 var emptyPlaceholder = null;
61 var extraProperties = []; 71 var extraProperties = [];
62 72
63 switch (scope.type()) { 73 switch (scope.type()) {
64 case DebuggerAgent.ScopeType.Local: 74 case DebuggerAgent.ScopeType.Local:
65 foundLocalScope = true; 75 foundLocalScope = true;
66 title = WebInspector.UIString("Local"); 76 title = WebInspector.UIString("Local");
67 emptyPlaceholder = WebInspector.UIString("No Variables"); 77 emptyPlaceholder = WebInspector.UIString("No Variables");
68 var thisObject = callFrame.thisObject();
69 if (thisObject) 78 if (thisObject)
70 extraProperties.push(new WebInspector.RemoteObjectProperty(" this", thisObject)); 79 extraProperties.push(new WebInspector.RemoteObjectProperty(" this", thisObject));
71 if (i == 0) { 80 if (i == 0) {
72 var details = callFrame.debuggerModel.debuggerPausedDetails( ); 81 var details = callFrame.debuggerModel.debuggerPausedDetails( );
73 var exception = details.exception(); 82 var exception = details.exception();
74 if (exception) 83 if (exception)
75 extraProperties.push(new WebInspector.RemoteObjectProper ty(WebInspector.UIString.capitalize("Exception"), exception, undefined, undefine d, undefined, undefined, undefined, true)); 84 extraProperties.push(new WebInspector.RemoteObjectProper ty(WebInspector.UIString.capitalize("Exception"), exception, undefined, undefine d, undefined, undefined, undefined, true));
76 var returnValue = callFrame.returnValue(); 85 var returnValue = callFrame.returnValue();
77 if (returnValue) 86 if (returnValue)
78 extraProperties.push(new WebInspector.RemoteObjectProper ty(WebInspector.UIString.capitalize("Return ^value"), returnValue, undefined, un defined, undefined, undefined, undefined, true)); 87 extraProperties.push(new WebInspector.RemoteObjectProper ty(WebInspector.UIString.capitalize("Return ^value"), returnValue, undefined, un defined, undefined, undefined, undefined, true));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 this._expandController.watchSection(title + (subtitle ? ":" + subtit le : ""), section); 124 this._expandController.watchSection(title + (subtitle ? ":" + subtit le : ""), section);
116 125
117 if (scope.type() === DebuggerAgent.ScopeType.Global) 126 if (scope.type() === DebuggerAgent.ScopeType.Global)
118 section.objectTreeElement().collapse(); 127 section.objectTreeElement().collapse();
119 else if (!foundLocalScope || scope.type() === DebuggerAgent.ScopeTyp e.Local) 128 else if (!foundLocalScope || scope.type() === DebuggerAgent.ScopeTyp e.Local)
120 section.objectTreeElement().expand(); 129 section.objectTreeElement().expand();
121 130
122 section.element.classList.add("scope-chain-sidebar-pane-section"); 131 section.element.classList.add("scope-chain-sidebar-pane-section");
123 this.element.appendChild(section.element); 132 this.element.appendChild(section.element);
124 } 133 }
134 this._sidebarPaneUpdatedForTest();
125 }, 135 },
126 136
137 _sidebarPaneUpdatedForTest: function() { },
138
127 __proto__: WebInspector.SidebarPane.prototype 139 __proto__: WebInspector.SidebarPane.prototype
128 } 140 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698