Changeset 181612 in webkit
- Timestamp:
- Mar 16, 2015, 9:41:31 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/inspector/model/remote-object-expected.txt (modified) (20 diffs)
-
LayoutTests/inspector/model/remote-object.html (modified) (1 diff)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/inspector/InjectedScriptSource.js (modified) (4 diffs)
-
Source/WebInspectorUI/ChangeLog (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r181611 r181612 1 2015-03-16 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Better Console Previews for Arrays / Small Objects 4 https://bugs.webkit.org/show_bug.cgi?id=142322 5 6 Reviewed by Timothy Hatcher. 7 8 * inspector/model/remote-object-expected.txt: 9 * inspector/model/remote-object.html: 10 Include a test with cyclic values, and update 11 results which now have sub-previews. 12 1 13 2015-03-16 Ryosuke Niwa <rniwa@webkit.org> 2 14 -
trunk/LayoutTests/inspector/model/remote-object-expected.txt
r181516 r181612 593 593 "_subtype": "array", 594 594 "_description": "Array", 595 "_lossless": false,595 "_lossless": true, 596 596 "_overflow": false, 597 597 "_size": 3, … … 601 601 "_type": "object", 602 602 "_subtype": "array", 603 "_value": "Array" 603 "_valuePreview": { 604 "_type": "object", 605 "_subtype": "array", 606 "_description": "Array", 607 "_lossless": true, 608 "_overflow": false, 609 "_size": 1, 610 "_properties": [ 611 { 612 "_name": "0", 613 "_type": "number", 614 "_value": "1" 615 } 616 ], 617 "_entries": null 618 } 604 619 }, 605 620 { … … 607 622 "_type": "object", 608 623 "_subtype": "array", 609 "_value": "Array" 624 "_valuePreview": { 625 "_type": "object", 626 "_subtype": "array", 627 "_description": "Array", 628 "_lossless": true, 629 "_overflow": false, 630 "_size": 1, 631 "_properties": [ 632 { 633 "_name": "0", 634 "_type": "number", 635 "_value": "2" 636 } 637 ], 638 "_entries": null 639 } 610 640 }, 611 641 { … … 613 643 "_type": "object", 614 644 "_subtype": "array", 615 "_value": "Array" 645 "_valuePreview": { 646 "_type": "object", 647 "_subtype": "array", 648 "_description": "Array", 649 "_lossless": true, 650 "_overflow": false, 651 "_size": 1, 652 "_properties": [ 653 { 654 "_name": "0", 655 "_type": "number", 656 "_value": "3" 657 } 658 ], 659 "_entries": null 660 } 616 661 } 617 662 ], … … 679 724 "_subtype": "array", 680 725 "_description": "Array", 681 "_lossless": false,726 "_lossless": true, 682 727 "_overflow": false, 683 728 "_size": 3, … … 686 731 "_name": "0", 687 732 "_type": "object", 688 "_value": "Object" 733 "_valuePreview": { 734 "_type": "object", 735 "_description": "Object", 736 "_lossless": true, 737 "_overflow": false, 738 "_properties": [ 739 { 740 "_name": "a", 741 "_type": "number", 742 "_value": "1" 743 } 744 ], 745 "_entries": null 746 } 689 747 }, 690 748 { 691 749 "_name": "1", 692 750 "_type": "object", 693 "_value": "Object" 751 "_valuePreview": { 752 "_type": "object", 753 "_description": "Object", 754 "_lossless": true, 755 "_overflow": false, 756 "_properties": [ 757 { 758 "_name": "b", 759 "_type": "number", 760 "_value": "2" 761 } 762 ], 763 "_entries": null 764 } 694 765 }, 695 766 { 696 767 "_name": "2", 697 768 "_type": "object", 698 "_value": "Object" 769 "_valuePreview": { 770 "_type": "object", 771 "_description": "Object", 772 "_lossless": true, 773 "_overflow": false, 774 "_properties": [ 775 { 776 "_name": "c", 777 "_type": "number", 778 "_value": "2" 779 } 780 ], 781 "_entries": null 782 } 699 783 } 700 784 ], … … 715 799 "_subtype": "array", 716 800 "_description": "Array", 717 "_lossless": false,801 "_lossless": true, 718 802 "_overflow": false, 719 803 "_size": 1, … … 723 807 "_type": "object", 724 808 "_subtype": "array", 725 "_value": "Array" 809 "_valuePreview": { 810 "_type": "object", 811 "_subtype": "array", 812 "_description": "Array", 813 "_lossless": true, 814 "_overflow": false, 815 "_size": 3, 816 "_properties": [ 817 { 818 "_name": "0", 819 "_type": "object", 820 "_valuePreview": { 821 "_type": "object", 822 "_description": "Object", 823 "_lossless": true, 824 "_overflow": false, 825 "_properties": [ 826 { 827 "_name": "a", 828 "_type": "number", 829 "_value": "1" 830 } 831 ], 832 "_entries": null 833 } 834 }, 835 { 836 "_name": "1", 837 "_type": "object", 838 "_valuePreview": { 839 "_type": "object", 840 "_description": "Object", 841 "_lossless": true, 842 "_overflow": false, 843 "_properties": [ 844 { 845 "_name": "b", 846 "_type": "number", 847 "_value": "2" 848 } 849 ], 850 "_entries": null 851 } 852 }, 853 { 854 "_name": "2", 855 "_type": "object", 856 "_valuePreview": { 857 "_type": "object", 858 "_description": "Object", 859 "_lossless": true, 860 "_overflow": false, 861 "_properties": [ 862 { 863 "_name": "c", 864 "_type": "number", 865 "_value": "2" 866 } 867 ], 868 "_entries": null 869 } 870 } 871 ], 872 "_entries": null 873 } 726 874 } 727 875 ], … … 1548 1696 "_type": "symbol", 1549 1697 "_value": "Symbol(sym)" 1698 } 1699 ], 1700 "_entries": null 1701 } 1702 } 1703 1704 ----------------------------------------------------- 1705 EXPRESSION: o = {a:1}; o.b = o; o 1706 { 1707 "_type": "object", 1708 "_objectId": "<filtered>", 1709 "_description": "Object", 1710 "_preview": { 1711 "_type": "object", 1712 "_description": "Object", 1713 "_lossless": false, 1714 "_overflow": false, 1715 "_properties": [ 1716 { 1717 "_name": "a", 1718 "_type": "number", 1719 "_value": "1" 1720 }, 1721 { 1722 "_name": "b", 1723 "_type": "object", 1724 "_value": "Object" 1550 1725 } 1551 1726 ], … … 2949 3124 "_subtype": "iterator", 2950 3125 "_description": "ArrayIterator", 3126 "_lossless": true, 3127 "_overflow": false, 3128 "_properties": [ 3129 { 3130 "_name": "array", 3131 "_type": "object", 3132 "_subtype": "array", 3133 "_valuePreview": { 3134 "_type": "object", 3135 "_subtype": "array", 3136 "_description": "Array", 3137 "_lossless": true, 3138 "_overflow": false, 3139 "_size": 0, 3140 "_properties": [], 3141 "_entries": null 3142 }, 3143 "_internal": true 3144 }, 3145 { 3146 "_name": "kind", 3147 "_type": "string", 3148 "_value": "value", 3149 "_internal": true 3150 } 3151 ], 3152 "_entries": [] 3153 } 3154 } 3155 3156 ----------------------------------------------------- 3157 EXPRESSION: [1][Symbol.iterator]() 3158 { 3159 "_type": "object", 3160 "_subtype": "iterator", 3161 "_objectId": "<filtered>", 3162 "_description": "ArrayIterator", 3163 "_preview": { 3164 "_type": "object", 3165 "_subtype": "iterator", 3166 "_description": "ArrayIterator", 3167 "_lossless": true, 3168 "_overflow": false, 3169 "_properties": [ 3170 { 3171 "_name": "array", 3172 "_type": "object", 3173 "_subtype": "array", 3174 "_valuePreview": { 3175 "_type": "object", 3176 "_subtype": "array", 3177 "_description": "Array", 3178 "_lossless": true, 3179 "_overflow": false, 3180 "_size": 1, 3181 "_properties": [ 3182 { 3183 "_name": "0", 3184 "_type": "number", 3185 "_value": "1" 3186 } 3187 ], 3188 "_entries": null 3189 }, 3190 "_internal": true 3191 }, 3192 { 3193 "_name": "kind", 3194 "_type": "string", 3195 "_value": "value", 3196 "_internal": true 3197 } 3198 ], 3199 "_entries": [ 3200 { 3201 "_value": { 3202 "_type": "number", 3203 "_description": "1", 3204 "_lossless": true, 3205 "_overflow": false, 3206 "_properties": null, 3207 "_entries": null 3208 } 3209 } 3210 ] 3211 } 3212 } 3213 3214 ----------------------------------------------------- 3215 EXPRESSION: [1, 'two', 3, 'four', 5, 'size'][Symbol.iterator]() 3216 { 3217 "_type": "object", 3218 "_subtype": "iterator", 3219 "_objectId": "<filtered>", 3220 "_description": "ArrayIterator", 3221 "_preview": { 3222 "_type": "object", 3223 "_subtype": "iterator", 3224 "_description": "ArrayIterator", 2951 3225 "_lossless": false, 2952 "_overflow": false,3226 "_overflow": true, 2953 3227 "_properties": [ 2954 3228 { … … 2966 3240 } 2967 3241 ], 2968 "_entries": [] 2969 } 2970 } 2971 2972 ----------------------------------------------------- 2973 EXPRESSION: [1][Symbol.iterator]() 3242 "_entries": [ 3243 { 3244 "_value": { 3245 "_type": "number", 3246 "_description": "1", 3247 "_lossless": true, 3248 "_overflow": false, 3249 "_properties": null, 3250 "_entries": null 3251 } 3252 }, 3253 { 3254 "_value": { 3255 "_type": "string", 3256 "_description": "two", 3257 "_lossless": true, 3258 "_overflow": false, 3259 "_properties": null, 3260 "_entries": null 3261 } 3262 }, 3263 { 3264 "_value": { 3265 "_type": "number", 3266 "_description": "3", 3267 "_lossless": true, 3268 "_overflow": false, 3269 "_properties": null, 3270 "_entries": null 3271 } 3272 }, 3273 { 3274 "_value": { 3275 "_type": "string", 3276 "_description": "four", 3277 "_lossless": true, 3278 "_overflow": false, 3279 "_properties": null, 3280 "_entries": null 3281 } 3282 }, 3283 { 3284 "_value": { 3285 "_type": "number", 3286 "_description": "5", 3287 "_lossless": true, 3288 "_overflow": false, 3289 "_properties": null, 3290 "_entries": null 3291 } 3292 } 3293 ] 3294 } 3295 } 3296 3297 ----------------------------------------------------- 3298 EXPRESSION: [1, 'two', 3, 'four', 5, 'size'].keys() 2974 3299 { 2975 3300 "_type": "object", … … 2982 3307 "_description": "ArrayIterator", 2983 3308 "_lossless": false, 2984 "_overflow": false,3309 "_overflow": true, 2985 3310 "_properties": [ 2986 3311 { … … 2994 3319 "_name": "kind", 2995 3320 "_type": "string", 2996 "_value": " value",3321 "_value": "key", 2997 3322 "_internal": true 2998 3323 } 2999 3324 ], 3000 3325 "_entries": [ 3326 { 3327 "_value": { 3328 "_type": "number", 3329 "_description": "0", 3330 "_lossless": true, 3331 "_overflow": false, 3332 "_properties": null, 3333 "_entries": null 3334 } 3335 }, 3001 3336 { 3002 3337 "_value": { … … 3008 3343 "_entries": null 3009 3344 } 3345 }, 3346 { 3347 "_value": { 3348 "_type": "number", 3349 "_description": "2", 3350 "_lossless": true, 3351 "_overflow": false, 3352 "_properties": null, 3353 "_entries": null 3354 } 3355 }, 3356 { 3357 "_value": { 3358 "_type": "number", 3359 "_description": "3", 3360 "_lossless": true, 3361 "_overflow": false, 3362 "_properties": null, 3363 "_entries": null 3364 } 3365 }, 3366 { 3367 "_value": { 3368 "_type": "number", 3369 "_description": "4", 3370 "_lossless": true, 3371 "_overflow": false, 3372 "_properties": null, 3373 "_entries": null 3374 } 3010 3375 } 3011 3376 ] … … 3014 3379 3015 3380 ----------------------------------------------------- 3016 EXPRESSION: [1, 'two', 3, 'four', 5, 'size'] [Symbol.iterator]()3381 EXPRESSION: [1, 'two', 3, 'four', 5, 'size'].entries() 3017 3382 { 3018 3383 "_type": "object", … … 3037 3402 "_name": "kind", 3038 3403 "_type": "string", 3039 "_value": "value",3040 "_internal": true3041 }3042 ],3043 "_entries": [3044 {3045 "_value": {3046 "_type": "number",3047 "_description": "1",3048 "_lossless": true,3049 "_overflow": false,3050 "_properties": null,3051 "_entries": null3052 }3053 },3054 {3055 "_value": {3056 "_type": "string",3057 "_description": "two",3058 "_lossless": true,3059 "_overflow": false,3060 "_properties": null,3061 "_entries": null3062 }3063 },3064 {3065 "_value": {3066 "_type": "number",3067 "_description": "3",3068 "_lossless": true,3069 "_overflow": false,3070 "_properties": null,3071 "_entries": null3072 }3073 },3074 {3075 "_value": {3076 "_type": "string",3077 "_description": "four",3078 "_lossless": true,3079 "_overflow": false,3080 "_properties": null,3081 "_entries": null3082 }3083 },3084 {3085 "_value": {3086 "_type": "number",3087 "_description": "5",3088 "_lossless": true,3089 "_overflow": false,3090 "_properties": null,3091 "_entries": null3092 }3093 }3094 ]3095 }3096 }3097 3098 -----------------------------------------------------3099 EXPRESSION: [1, 'two', 3, 'four', 5, 'size'].keys()3100 {3101 "_type": "object",3102 "_subtype": "iterator",3103 "_objectId": "<filtered>",3104 "_description": "ArrayIterator",3105 "_preview": {3106 "_type": "object",3107 "_subtype": "iterator",3108 "_description": "ArrayIterator",3109 "_lossless": false,3110 "_overflow": true,3111 "_properties": [3112 {3113 "_name": "array",3114 "_type": "object",3115 "_subtype": "array",3116 "_value": "Array",3117 "_internal": true3118 },3119 {3120 "_name": "kind",3121 "_type": "string",3122 "_value": "key",3123 "_internal": true3124 }3125 ],3126 "_entries": [3127 {3128 "_value": {3129 "_type": "number",3130 "_description": "0",3131 "_lossless": true,3132 "_overflow": false,3133 "_properties": null,3134 "_entries": null3135 }3136 },3137 {3138 "_value": {3139 "_type": "number",3140 "_description": "1",3141 "_lossless": true,3142 "_overflow": false,3143 "_properties": null,3144 "_entries": null3145 }3146 },3147 {3148 "_value": {3149 "_type": "number",3150 "_description": "2",3151 "_lossless": true,3152 "_overflow": false,3153 "_properties": null,3154 "_entries": null3155 }3156 },3157 {3158 "_value": {3159 "_type": "number",3160 "_description": "3",3161 "_lossless": true,3162 "_overflow": false,3163 "_properties": null,3164 "_entries": null3165 }3166 },3167 {3168 "_value": {3169 "_type": "number",3170 "_description": "4",3171 "_lossless": true,3172 "_overflow": false,3173 "_properties": null,3174 "_entries": null3175 }3176 }3177 ]3178 }3179 }3180 3181 -----------------------------------------------------3182 EXPRESSION: [1, 'two', 3, 'four', 5, 'size'].entries()3183 {3184 "_type": "object",3185 "_subtype": "iterator",3186 "_objectId": "<filtered>",3187 "_description": "ArrayIterator",3188 "_preview": {3189 "_type": "object",3190 "_subtype": "iterator",3191 "_description": "ArrayIterator",3192 "_lossless": false,3193 "_overflow": true,3194 "_properties": [3195 {3196 "_name": "array",3197 "_type": "object",3198 "_subtype": "array",3199 "_value": "Array",3200 "_internal": true3201 },3202 {3203 "_name": "kind",3204 "_type": "string",3205 3404 "_value": "key+value", 3206 3405 "_internal": true … … 3685 3884 "_subtype": "iterator", 3686 3885 "_description": "ArgumentsIterator", 3687 "_lossless": false,3886 "_lossless": true, 3688 3887 "_overflow": false, 3689 3888 "_properties": [ … … 3692 3891 "_type": "object", 3693 3892 "_subtype": "array", 3694 "_value": "Arguments", 3893 "_valuePreview": { 3894 "_type": "object", 3895 "_subtype": "array", 3896 "_description": "Arguments", 3897 "_lossless": true, 3898 "_overflow": false, 3899 "_size": 2, 3900 "_properties": [ 3901 { 3902 "_name": "0", 3903 "_type": "number", 3904 "_value": "1" 3905 }, 3906 { 3907 "_name": "1", 3908 "_type": "string", 3909 "_value": "two" 3910 } 3911 ], 3912 "_entries": null 3913 }, 3695 3914 "_internal": true 3696 3915 } … … 3840 4059 "_type": "object", 3841 4060 "_description": "Promise", 3842 "_lossless": false,4061 "_lossless": true, 3843 4062 "_overflow": false, 3844 4063 "_properties": [ … … 3852 4071 "_name": "result", 3853 4072 "_type": "object", 3854 "_value": "Object", 4073 "_valuePreview": { 4074 "_type": "object", 4075 "_description": "Object", 4076 "_lossless": true, 4077 "_overflow": false, 4078 "_properties": [ 4079 { 4080 "_name": "result", 4081 "_type": "number", 4082 "_value": "1" 4083 } 4084 ], 4085 "_entries": null 4086 }, 3855 4087 "_internal": true 3856 4088 } -
trunk/LayoutTests/inspector/model/remote-object.html
r181516 r181612 92 92 {expression: "({a: 1, b: 0, c: -0})"}, 93 93 {expression: "({a: 1, b: \"string\", c: /regex/, d: Symbol('sym')})"}, 94 {expression: "o = {a:1}; o.b = o; o"}, // Cyclic. 94 95 {expression: "({a:function a(){}, b:function b(){}, get getter(){}, set setter(v){}})"}, 95 96 {expression: "function Foo() {}; new Foo"}, -
trunk/Source/JavaScriptCore/ChangeLog
r181611 r181612 1 2015-03-16 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Better Console Previews for Arrays / Small Objects 4 https://bugs.webkit.org/show_bug.cgi?id=142322 5 6 Reviewed by Timothy Hatcher. 7 8 * inspector/InjectedScriptSource.js: 9 Create deep valuePreviews for simple previewable objects, 10 such as arrays with 5 values, or basic objects with 11 3 properties. 12 1 13 2015-03-16 Ryosuke Niwa <rniwa@webkit.org> 2 14 -
trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js
r181516 r181612 991 991 } 992 992 993 if (preview.entries) 994 return preview; 995 993 996 // Properties. 994 997 var descriptors = injectedScript._propertyDescriptors(object, InjectedScript.CollectionMode.AllProperties); … … 996 999 if (propertiesThreshold.indexes < 0 || propertiesThreshold.properties < 0) 997 1000 return preview; 998 999 // FIXME: Iterator entries.1000 1001 } catch (e) { 1001 1002 preview.lossless = false; … … 1089 1090 if (secondLevelKeys === null || secondLevelKeys) { 1090 1091 var subPreview = this._generatePreview(value, secondLevelKeys || undefined, undefined); 1092 property.valuePreview = subPreview; 1093 if (!subPreview.lossless) 1094 preview.lossless = false; 1095 if (subPreview.overflow) 1096 preview.overflow = true; 1097 } else if (this._isPreviewableObject(value)) { 1098 var subPreview = this._createObjectPreviewForValue(value); 1091 1099 property.valuePreview = subPreview; 1092 1100 if (!subPreview.lossless) … … 1146 1154 }, 1147 1155 1156 _isPreviewableObject: function(object) 1157 { 1158 return this._isPreviewableObjectInternal(object, new Set, 1); 1159 }, 1160 1161 _isPreviewableObjectInternal: function(object, knownObjects, depth) 1162 { 1163 // Deep object. 1164 if (depth > 3) 1165 return false; 1166 1167 // Primitive. 1168 if (injectedScript.isPrimitiveValue(object) || isSymbol(object)) 1169 return true; 1170 1171 // Cyclic objects. 1172 if (knownObjects.has(object)) 1173 return false; 1174 1175 ++depth; 1176 knownObjects.add(object); 1177 1178 // Arrays are simple if they have 5 or less simple objects. 1179 var subtype = injectedScript._subtype(object); 1180 if (subtype === "array") { 1181 var length = object.length; 1182 if (length > 5) 1183 return false; 1184 for (var i = 0; i < length; ++i) { 1185 if (!this._isPreviewableObjectInternal(object[i], knownObjects, depth)) 1186 return false; 1187 } 1188 return true; 1189 } 1190 1191 // Not a basic object. 1192 if (object.__proto__ && object.__proto__.__proto__) 1193 return false; 1194 1195 // Objects are simple if they have 3 or less simple properties. 1196 var ownPropertyNames = Object.getOwnPropertyNames(object); 1197 if (ownPropertyNames.length > 3) 1198 return false; 1199 for (var propertyName of ownPropertyNames) { 1200 if (!this._isPreviewableObjectInternal(object[propertyName], knownObjects, depth)) 1201 return false; 1202 } 1203 1204 return true; 1205 }, 1206 1148 1207 _abbreviateString: function(string, maxLength, middle) 1149 1208 { -
trunk/Source/WebInspectorUI/ChangeLog
r181610 r181612 1 2015-03-16 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Better Console Previews for Arrays / Small Objects 4 https://bugs.webkit.org/show_bug.cgi?id=142322 5 6 Reviewed by Timothy Hatcher. 7 8 * UserInterface/Views/ObjectPreviewView.js: 9 If there is a sub-preview, show the sub-preview. 10 11 * UserInterface/Views/ObjectTreeView.js: 12 (WebInspector.ObjectTreeView): 13 For an ObjectTree that is not a root (e.g. one inside of 14 an array/set/map property tree element) allow it to be 15 expanded even if the preview is lossless. 16 1 17 2015-03-16 Nikita Vasilyev <nvasilyev@apple.com> 2 18 -
trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js
r181203 r181612 212 212 } 213 213 214 element.appendChild(WebInspector.FormattedValue.createElementForPropertyPreview(property)); 214 if (property.valuePreview) 215 this._appendPreview(element, property.valuePreview); 216 else 217 element.appendChild(WebInspector.FormattedValue.createElementForPropertyPreview(property)); 215 218 } 216 219 -
trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js
r181186 r181612 50 50 this._element.appendChild(this._previewView.element); 51 51 52 if (this._previewView.lossless && ! forceExpanding) {52 if (this._previewView.lossless && !this._propertyPath.parent && !forceExpanding) { 53 53 this._hasLosslessPreview = true; 54 54 this.element.classList.add("lossless-preview");
Note:
See TracChangeset
for help on using the changeset viewer.