| OLD | NEW |
| 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 11 matching lines...) Expand all Loading... |
| 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 /** | 26 /** |
| 27 * @implements {UI.ContextFlavorListener} | 27 * @implements {UI.ContextFlavorListener} |
| 28 * @unrestricted | 28 * @unrestricted |
| 29 */ | 29 */ |
| 30 Sources.ScopeChainSidebarPane = class extends UI.VBox { | 30 Sources.ScopeChainSidebarPane = class extends UI.VBox { |
| 31 constructor() { | 31 constructor() { |
| 32 super(); | 32 super(true); |
| 33 this.registerRequiredCSS('sources/scopeChainSidebarPane.css'); |
| 33 this._expandController = new ObjectUI.ObjectPropertiesSectionExpandControlle
r(); | 34 this._expandController = new ObjectUI.ObjectPropertiesSectionExpandControlle
r(); |
| 34 this._linkifier = new Components.Linkifier(); | 35 this._linkifier = new Components.Linkifier(); |
| 35 this._update(); | 36 this._update(); |
| 36 } | 37 } |
| 37 | 38 |
| 38 /** | 39 /** |
| 39 * @override | 40 * @override |
| 40 * @param {?Object} object | 41 * @param {?Object} object |
| 41 */ | 42 */ |
| 42 flavorChanged(object) { | 43 flavorChanged(object) { |
| 43 this._update(); | 44 this._update(); |
| 44 } | 45 } |
| 45 | 46 |
| 46 _update() { | 47 _update() { |
| 47 var callFrame = UI.context.flavor(SDK.DebuggerModel.CallFrame); | 48 var callFrame = UI.context.flavor(SDK.DebuggerModel.CallFrame); |
| 48 var details = UI.context.flavor(SDK.DebuggerPausedDetails); | 49 var details = UI.context.flavor(SDK.DebuggerPausedDetails); |
| 49 this._linkifier.reset(); | 50 this._linkifier.reset(); |
| 50 Sources.SourceMapNamesResolver.resolveThisObject(callFrame).then(this._inner
Update.bind(this, details, callFrame)); | 51 Sources.SourceMapNamesResolver.resolveThisObject(callFrame).then(this._inner
Update.bind(this, details, callFrame)); |
| 51 } | 52 } |
| 52 | 53 |
| 53 /** | 54 /** |
| 54 * @param {?SDK.DebuggerPausedDetails} details | 55 * @param {?SDK.DebuggerPausedDetails} details |
| 55 * @param {?SDK.DebuggerModel.CallFrame} callFrame | 56 * @param {?SDK.DebuggerModel.CallFrame} callFrame |
| 56 * @param {?SDK.RemoteObject} thisObject | 57 * @param {?SDK.RemoteObject} thisObject |
| 57 */ | 58 */ |
| 58 _innerUpdate(details, callFrame, thisObject) { | 59 _innerUpdate(details, callFrame, thisObject) { |
| 59 this.element.removeChildren(); | 60 this.contentElement.removeChildren(); |
| 60 | 61 |
| 61 if (!details || !callFrame) { | 62 if (!details || !callFrame) { |
| 62 var infoElement = createElement('div'); | 63 var infoElement = createElement('div'); |
| 63 infoElement.className = 'gray-info-message'; | 64 infoElement.className = 'gray-info-message'; |
| 64 infoElement.textContent = Common.UIString('Not Paused'); | 65 infoElement.textContent = Common.UIString('Not Paused'); |
| 65 this.element.appendChild(infoElement); | 66 this.contentElement.appendChild(infoElement); |
| 66 return; | 67 return; |
| 67 } | 68 } |
| 68 | 69 |
| 69 var foundLocalScope = false; | 70 var foundLocalScope = false; |
| 70 var scopeChain = callFrame.scopeChain(); | 71 var scopeChain = callFrame.scopeChain(); |
| 71 for (var i = 0; i < scopeChain.length; ++i) { | 72 for (var i = 0; i < scopeChain.length; ++i) { |
| 72 var scope = scopeChain[i]; | 73 var scope = scopeChain[i]; |
| 73 var title = scope.typeName(); | 74 var title = scope.typeName(); |
| 74 var emptyPlaceholder = null; | 75 var emptyPlaceholder = null; |
| 75 var extraProperties = []; | 76 var extraProperties = []; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 Sources.SourceMapNamesResolver.resolveScopeInObject(scope), titleEleme
nt, this._linkifier, emptyPlaceholder, | 118 Sources.SourceMapNamesResolver.resolveScopeInObject(scope), titleEleme
nt, this._linkifier, emptyPlaceholder, |
| 118 true, extraProperties); | 119 true, extraProperties); |
| 119 this._expandController.watchSection(title + (subtitle ? ':' + subtitle : '
'), section); | 120 this._expandController.watchSection(title + (subtitle ? ':' + subtitle : '
'), section); |
| 120 | 121 |
| 121 if (scope.type() === Protocol.Debugger.ScopeType.Global) | 122 if (scope.type() === Protocol.Debugger.ScopeType.Global) |
| 122 section.objectTreeElement().collapse(); | 123 section.objectTreeElement().collapse(); |
| 123 else if (!foundLocalScope || scope.type() === Protocol.Debugger.ScopeType.
Local) | 124 else if (!foundLocalScope || scope.type() === Protocol.Debugger.ScopeType.
Local) |
| 124 section.objectTreeElement().expand(); | 125 section.objectTreeElement().expand(); |
| 125 | 126 |
| 126 section.element.classList.add('scope-chain-sidebar-pane-section'); | 127 section.element.classList.add('scope-chain-sidebar-pane-section'); |
| 127 this.element.appendChild(section.element); | 128 this.contentElement.appendChild(section.element); |
| 128 } | 129 } |
| 129 this._sidebarPaneUpdatedForTest(); | 130 this._sidebarPaneUpdatedForTest(); |
| 130 } | 131 } |
| 131 | 132 |
| 132 _sidebarPaneUpdatedForTest() { | 133 _sidebarPaneUpdatedForTest() { |
| 133 } | 134 } |
| 134 }; | 135 }; |
| 135 | 136 |
| 136 Sources.ScopeChainSidebarPane._pathSymbol = Symbol('path'); | 137 Sources.ScopeChainSidebarPane._pathSymbol = Symbol('path'); |
| OLD | NEW |