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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
496 case "number": | 496 case "number": |
497 case "regexp": | 497 case "regexp": |
498 case "symbol": | 498 case "symbol": |
499 case "undefined": | 499 case "undefined": |
500 element = this._formatParameterAsValue(output); | 500 element = this._formatParameterAsValue(output); |
501 break; | 501 break; |
502 default: | 502 default: |
503 element = this._formatParameterAsValue(output); | 503 element = this._formatParameterAsValue(output); |
504 console.error("Tried to format remote object of unknown type."); | 504 console.error("Tried to format remote object of unknown type."); |
505 } | 505 } |
506 element.className = "object-value-" + type + " source-code"; | |
507 return element; | 506 return element; |
508 }, | 507 }, |
509 | 508 |
510 /** | 509 /** |
511 * @param {!WebInspector.RemoteObject} obj | 510 * @param {!WebInspector.RemoteObject} obj |
512 * @return {!Element} | 511 * @return {!Element} |
513 */ | 512 */ |
514 _formatParameterAsValue: function(obj) | 513 _formatParameterAsValue: function(obj) |
515 { | 514 { |
516 var element = createElement("span"); | 515 var element = createElementWithClass("span", "source-code"); |
516 var type = obj.subtype || obj.type; | |
517 if (type === "boolean") | |
518 element.classList.add("object-value-boolean"); | |
519 else if (type === "null") | |
520 element.classList.add("object-value-null"); | |
521 else if (type === "undefined") | |
522 element.classList.add("object-value-undefined"); | |
523 else if (type === "number") | |
524 element.classList.add("object-value-number"); | |
525 else if (type === "regexp" || type === "symbol") | |
526 element.classList.add("object-value-regexp"); | |
lushnikov
2016/10/18 23:15:19
object-value-string?
| |
527 else if (type === "set") | |
528 element.classList.add("object-value-set"); | |
517 element.createTextChild(obj.description || ""); | 529 element.createTextChild(obj.description || ""); |
518 if (obj.objectId) | 530 if (obj.objectId) |
519 element.addEventListener("contextmenu", this._contextMenuEventFired. bind(this, obj), false); | 531 element.addEventListener("contextmenu", this._contextMenuEventFired. bind(this, obj), false); |
520 return element; | 532 return element; |
521 }, | 533 }, |
522 | 534 |
523 /** | 535 /** |
524 * @param {!WebInspector.RemoteObject} obj | 536 * @param {!WebInspector.RemoteObject} obj |
525 * @param {!WebInspector.Linkifier} linkifier | 537 * @param {!WebInspector.Linkifier} linkifier |
526 * @param {boolean=} includePreview | 538 * @param {boolean=} includePreview |
527 * @return {!Element} | 539 * @return {!Element} |
528 */ | 540 */ |
529 _formatParameterAsObject: function(obj, linkifier, includePreview) | 541 _formatParameterAsObject: function(obj, linkifier, includePreview) |
530 { | 542 { |
531 var element = createElement("span"); | 543 var element = createElementWithClass("span", "source-code"); |
544 var type = obj.subtype || obj.type; | |
545 if (type === "iterator") | |
546 element.classList.add("object-value-iterator"); | |
547 else if (type === "map") | |
548 element.classList.add("object-value-map"); | |
549 else if (type === "object" || type === "promise") | |
550 element.classList.add("object-value-object"); | |
551 else if (type === "proxy") | |
552 element.classList.add("object-value-proxy"); | |
553 else if (type === "set") | |
554 element.classList.add("object-value-set"); | |
532 var expandableObject = this._formatAsExpandableObject(obj, linkifier, in cludePreview); | 555 var expandableObject = this._formatAsExpandableObject(obj, linkifier, in cludePreview); |
533 element.appendChild(expandableObject); | 556 element.appendChild(expandableObject); |
534 return element; | 557 return element; |
535 }, | 558 }, |
536 | 559 |
537 /** | 560 /** |
538 * @param {!WebInspector.RemoteObject} obj | 561 * @param {!WebInspector.RemoteObject} obj |
539 * @param {!WebInspector.Linkifier} linkifier | 562 * @param {!WebInspector.Linkifier} linkifier |
540 * @param {boolean=} includePreview | 563 * @param {boolean=} includePreview |
541 * @return {!Element} | 564 * @return {!Element} |
(...skipping 17 matching lines...) Expand all Loading... | |
559 return section.element; | 582 return section.element; |
560 }, | 583 }, |
561 | 584 |
562 /** | 585 /** |
563 * @param {!WebInspector.RemoteObject} func | 586 * @param {!WebInspector.RemoteObject} func |
564 * @param {boolean=} includePreview | 587 * @param {boolean=} includePreview |
565 * @return {!Element} | 588 * @return {!Element} |
566 */ | 589 */ |
567 _formatParameterAsFunction: function(func, includePreview) | 590 _formatParameterAsFunction: function(func, includePreview) |
568 { | 591 { |
569 var element = createElement("span"); | 592 var element = createElementWithClass("span", "source-code"); |
593 var type = func.subtype || func.type; | |
594 if (type === "function") | |
595 element.classList.add("object-value-function"); | |
596 else if (type === "generator") | |
597 element.classList.add("object-value-generator"); | |
570 WebInspector.RemoteFunction.objectAsFunction(func).targetFunction().then (formatTargetFunction.bind(this)); | 598 WebInspector.RemoteFunction.objectAsFunction(func).targetFunction().then (formatTargetFunction.bind(this)); |
571 return element; | 599 return element; |
572 | 600 |
573 /** | 601 /** |
574 * @param {!WebInspector.RemoteObject} targetFunction | 602 * @param {!WebInspector.RemoteObject} targetFunction |
575 * @this {WebInspector.ConsoleViewMessage} | 603 * @this {WebInspector.ConsoleViewMessage} |
576 */ | 604 */ |
577 function formatTargetFunction(targetFunction) | 605 function formatTargetFunction(targetFunction) |
578 { | 606 { |
579 var functionElement = createElement("span"); | 607 var functionElement = createElement("span"); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
611 return this._previewFormatter.renderPropertyPreview(property.type, /** @ type {string} */ (property.subtype), property.value); | 639 return this._previewFormatter.renderPropertyPreview(property.type, /** @ type {string} */ (property.subtype), property.value); |
612 }, | 640 }, |
613 | 641 |
614 /** | 642 /** |
615 * @param {!WebInspector.RemoteObject} object | 643 * @param {!WebInspector.RemoteObject} object |
616 * @param {!WebInspector.Linkifier} linkifier | 644 * @param {!WebInspector.Linkifier} linkifier |
617 * @return {!Element} | 645 * @return {!Element} |
618 */ | 646 */ |
619 _formatParameterAsNode: function(object, linkifier) | 647 _formatParameterAsNode: function(object, linkifier) |
620 { | 648 { |
621 var element = createElement("span"); | 649 var element = createElementWithClass("span", "object-value-node source-c ode"); |
622 WebInspector.Renderer.renderPromise(object).then(appendRenderer.bind(thi s), failedToRender.bind(this)); | 650 WebInspector.Renderer.renderPromise(object).then(appendRenderer.bind(thi s), failedToRender.bind(this)); |
623 return element; | 651 return element; |
624 | 652 |
625 /** | 653 /** |
626 * @param {!Element} rendererElement | 654 * @param {!Element} rendererElement |
627 * @this {WebInspector.ConsoleViewMessage} | 655 * @this {WebInspector.ConsoleViewMessage} |
628 */ | 656 */ |
629 function appendRenderer(rendererElement) | 657 function appendRenderer(rendererElement) |
630 { | 658 { |
631 element.appendChild(rendererElement); | 659 element.appendChild(rendererElement); |
(...skipping 15 matching lines...) Expand all Loading... | |
647 }, | 675 }, |
648 | 676 |
649 /** | 677 /** |
650 * @param {!WebInspector.RemoteObject} array | 678 * @param {!WebInspector.RemoteObject} array |
651 * @param {!WebInspector.Linkifier} linkifier | 679 * @param {!WebInspector.Linkifier} linkifier |
652 * @param {string} messageType | 680 * @param {string} messageType |
653 * @return {!Element} | 681 * @return {!Element} |
654 */ | 682 */ |
655 _formatParameterAsArray: function(array, linkifier, messageType) | 683 _formatParameterAsArray: function(array, linkifier, messageType) |
656 { | 684 { |
657 var element = createElement("span"); | 685 var element = createElementWithClass("span", "object-value-array source- code"); |
658 var usePrintedArrayFormat = messageType !== WebInspector.ConsoleMessage. MessageType.DirXML && messageType !== WebInspector.ConsoleMessage.MessageType.Re sult; | 686 var usePrintedArrayFormat = messageType !== WebInspector.ConsoleMessage. MessageType.DirXML && messageType !== WebInspector.ConsoleMessage.MessageType.Re sult; |
659 var isLongArray = array.arrayLength() > 100; | 687 var isLongArray = array.arrayLength() > 100; |
660 if (usePrintedArrayFormat || isLongArray) | 688 if (usePrintedArrayFormat || isLongArray) { |
661 return this._formatParameterAsObject(array, linkifier, usePrintedArr ayFormat || !isLongArray); | 689 element = this._formatParameterAsObject(array, linkifier, usePrinted ArrayFormat || !isLongArray); |
690 element.classList.add("object-value-array"); | |
691 return element; | |
692 } | |
662 array.getAllProperties(false, printArrayResult.bind(this)); | 693 array.getAllProperties(false, printArrayResult.bind(this)); |
663 return element; | 694 return element; |
664 | 695 |
665 /** | 696 /** |
666 * @param {?Array.<!WebInspector.RemoteObjectProperty>} properties | 697 * @param {?Array.<!WebInspector.RemoteObjectProperty>} properties |
667 * @this {!WebInspector.ConsoleViewMessage} | 698 * @this {!WebInspector.ConsoleViewMessage} |
668 */ | 699 */ |
669 function printArrayResult(properties) | 700 function printArrayResult(properties) |
670 { | 701 { |
671 if (!properties) { | 702 if (!properties) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
724 element.appendChild(section.element); | 755 element.appendChild(section.element); |
725 } | 756 } |
726 }, | 757 }, |
727 | 758 |
728 /** | 759 /** |
729 * @param {!WebInspector.RemoteObject} output | 760 * @param {!WebInspector.RemoteObject} output |
730 * @return {!Element} | 761 * @return {!Element} |
731 */ | 762 */ |
732 _formatParameterAsString: function(output) | 763 _formatParameterAsString: function(output) |
733 { | 764 { |
734 var span = createElement("span"); | 765 var span = createElementWithClass("span", "object-value-string source-co de"); |
735 span.className = "object-value-string-inner source-code"; | |
736 span.appendChild(WebInspector.linkifyStringAsFragment(output.description || "")); | 766 span.appendChild(WebInspector.linkifyStringAsFragment(output.description || "")); |
737 | 767 |
738 // Make black quotes. | 768 // Make black quotes. |
739 var element = createElement("span"); | 769 var element = createElement("span"); |
740 element.createTextChild("\""); | 770 element.createTextChild("\""); |
741 element.appendChild(span); | 771 element.appendChild(span); |
742 element.createTextChild("\""); | 772 element.createTextChild("\""); |
743 return element; | 773 return element; |
744 }, | 774 }, |
745 | 775 |
746 /** | 776 /** |
747 * @param {!WebInspector.RemoteObject} output | 777 * @param {!WebInspector.RemoteObject} output |
748 * @param {!WebInspector.Linkifier} linkifier | 778 * @param {!WebInspector.Linkifier} linkifier |
749 * @return {!Element} | 779 * @return {!Element} |
750 */ | 780 */ |
751 _formatParameterAsError: function(output, linkifier) | 781 _formatParameterAsError: function(output, linkifier) |
752 { | 782 { |
753 var element = createElement("span"); | 783 var element = createElement("span"); |
754 var span = element.createChild("span", "object-value-error source-code") ; | 784 var span = element.createChild("span", "source-code"); |
755 var errorSpan = this._tryFormatAsError(output.target(), linkifier, outpu t.description || ""); | 785 var errorSpan = this._tryFormatAsError(output.target(), linkifier, outpu t.description || ""); |
756 span.appendChild(errorSpan ? errorSpan : WebInspector.linkifyStringAsFra gment(output.description || "")); | 786 span.appendChild(errorSpan ? errorSpan : WebInspector.linkifyStringAsFra gment(output.description || "")); |
757 return element; | 787 return element; |
758 }, | 788 }, |
759 | 789 |
760 /** | 790 /** |
761 * @param {!WebInspector.RemoteObject} output | 791 * @param {!WebInspector.RemoteObject} output |
762 * @return {!Element} | 792 * @return {!Element} |
763 */ | 793 */ |
764 _formatAsArrayEntry: function(output) | 794 _formatAsArrayEntry: function(output) |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1299 { | 1329 { |
1300 if (!this._element) { | 1330 if (!this._element) { |
1301 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this ); | 1331 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this ); |
1302 this._element.classList.toggle("collapsed", this._collapsed); | 1332 this._element.classList.toggle("collapsed", this._collapsed); |
1303 } | 1333 } |
1304 return this._element; | 1334 return this._element; |
1305 }, | 1335 }, |
1306 | 1336 |
1307 __proto__: WebInspector.ConsoleViewMessage.prototype | 1337 __proto__: WebInspector.ConsoleViewMessage.prototype |
1308 } | 1338 } |
OLD | NEW |