Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 591 */ | 591 */ |
| 592 _renderPropertyPreviewOrAccessor(object, propertyPath) { | 592 _renderPropertyPreviewOrAccessor(object, propertyPath) { |
| 593 var property = propertyPath.peekLast(); | 593 var property = propertyPath.peekLast(); |
| 594 if (property.type === 'accessor') | 594 if (property.type === 'accessor') |
| 595 return this._formatAsAccessorProperty(object, propertyPath.map(property => property.name), false); | 595 return this._formatAsAccessorProperty(object, propertyPath.map(property => property.name), false); |
| 596 return this._previewFormatter.renderPropertyPreview( | 596 return this._previewFormatter.renderPropertyPreview( |
| 597 property.type, /** @type {string} */ (property.subtype), property.value) ; | 597 property.type, /** @type {string} */ (property.subtype), property.value) ; |
| 598 } | 598 } |
| 599 | 599 |
| 600 /** | 600 /** |
| 601 * @param {!SDK.RemoteObject} object | 601 * @param {!SDK.RemoteObject} remoteObject |
| 602 * @return {!Element} | 602 * @return {!Element} |
| 603 */ | 603 */ |
| 604 _formatParameterAsNode(object) { | 604 _formatParameterAsNode(remoteObject) { |
| 605 var result = createElement('span'); | 605 var result = createElement('span'); |
| 606 Common.Renderer.renderPromise(object).then(appendRenderer.bind(this), failed ToRender.bind(this)); | |
| 607 return result; | |
| 608 | 606 |
| 609 /** | 607 if (remoteObject.isNode()) { |
|
dgozman
2017/03/16 23:07:36
- let's change the callsite to check for remoteObj
chenwilliam
2017/03/21 22:40:28
Done.
| |
| 610 * @param {!Element} rendererElement | 608 var domModel = SDK.DOMModel.fromTarget(remoteObject.target()); |
| 611 * @this {Console.ConsoleViewMessage} | 609 domModel.pushObjectAsNodeToFrontend(remoteObject, onNodeResolved.bind(this )); |
| 612 */ | 610 } else { |
| 613 function appendRenderer(rendererElement) { | 611 result.appendChild(this._formatParameterAsObject(remoteObject, false)); |
| 614 result.appendChild(rendererElement); | |
| 615 this._formattedParameterAsNodeForTest(); | |
| 616 } | 612 } |
| 617 | 613 |
| 618 /** | 614 /** |
| 615 * @param {?SDK.DOMNode} node | |
| 619 * @this {Console.ConsoleViewMessage} | 616 * @this {Console.ConsoleViewMessage} |
| 620 */ | 617 */ |
| 621 function failedToRender() { | 618 function onNodeResolved(node) { |
| 622 result.appendChild(this._formatParameterAsObject(object, false)); | 619 if (!node) { |
| 620 result.appendChild(this._formatParameterAsObject(remoteObject, false)); | |
| 621 return result; | |
| 622 } | |
| 623 Common.Renderer.renderPromise(node).then(rendererElement => { | |
| 624 result.appendChild(rendererElement); | |
| 625 this._formattedParameterAsNodeForTest(); | |
| 626 }); | |
| 623 } | 627 } |
| 628 return result; | |
| 624 } | 629 } |
| 625 | 630 |
| 626 _formattedParameterAsNodeForTest() { | 631 _formattedParameterAsNodeForTest() { |
| 627 } | 632 } |
| 628 | 633 |
| 629 /** | 634 /** |
| 630 * @param {!SDK.RemoteObject} output | 635 * @param {!SDK.RemoteObject} output |
| 631 * @return {!Element} | 636 * @return {!Element} |
| 632 */ | 637 */ |
| 633 _formatParameterAsString(output) { | 638 _formatParameterAsString(output) { |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1247 toMessageElement() { | 1252 toMessageElement() { |
| 1248 if (!this._element) { | 1253 if (!this._element) { |
| 1249 super.toMessageElement(); | 1254 super.toMessageElement(); |
| 1250 this._expandGroupIcon = UI.Icon.create('', 'expand-group-icon'); | 1255 this._expandGroupIcon = UI.Icon.create('', 'expand-group-icon'); |
| 1251 this._contentElement.insertBefore(this._expandGroupIcon, this._contentElem ent.firstChild); | 1256 this._contentElement.insertBefore(this._expandGroupIcon, this._contentElem ent.firstChild); |
| 1252 this.setCollapsed(this._collapsed); | 1257 this.setCollapsed(this._collapsed); |
| 1253 } | 1258 } |
| 1254 return this._element; | 1259 return this._element; |
| 1255 } | 1260 } |
| 1256 }; | 1261 }; |
| OLD | NEW |