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()) { |
| 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( | |
| 624 rendererElement => { | |
| 625 result.appendChild(rendererElement); | |
| 626 this._formattedParameterAsNodeForTest(); | |
| 627 }, | |
| 628 () => { | |
| 629 result.appendChild(this._formatParameterAsObject(remoteObject, false )); | |
|
pfeldman
2017/03/02 22:04:51
Don't use silent catch, it is better to break than
chenwilliam
2017/03/13 23:25:26
Done.
| |
| 630 }); | |
| 623 } | 631 } |
| 632 return result; | |
| 624 } | 633 } |
| 625 | 634 |
| 626 _formattedParameterAsNodeForTest() { | 635 _formattedParameterAsNodeForTest() { |
| 627 } | 636 } |
| 628 | 637 |
| 629 /** | 638 /** |
| 630 * @param {!SDK.RemoteObject} output | 639 * @param {!SDK.RemoteObject} output |
| 631 * @return {!Element} | 640 * @return {!Element} |
| 632 */ | 641 */ |
| 633 _formatParameterAsString(output) { | 642 _formatParameterAsString(output) { |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1247 toMessageElement() { | 1256 toMessageElement() { |
| 1248 if (!this._element) { | 1257 if (!this._element) { |
| 1249 super.toMessageElement(); | 1258 super.toMessageElement(); |
| 1250 this._expandGroupIcon = UI.Icon.create('', 'expand-group-icon'); | 1259 this._expandGroupIcon = UI.Icon.create('', 'expand-group-icon'); |
| 1251 this._contentElement.insertBefore(this._expandGroupIcon, this._contentElem ent.firstChild); | 1260 this._contentElement.insertBefore(this._expandGroupIcon, this._contentElem ent.firstChild); |
| 1252 this.setCollapsed(this._collapsed); | 1261 this.setCollapsed(this._collapsed); |
| 1253 } | 1262 } |
| 1254 return this._element; | 1263 return this._element; |
| 1255 } | 1264 } |
| 1256 }; | 1265 }; |
| OLD | NEW |