Changeset 181061 in webkit
- Timestamp:
- Mar 4, 2015 6:27:23 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r181056 r181061 1 2015-03-04 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Array/Collection Sizes should be visible and distinct 4 https://bugs.webkit.org/show_bug.cgi?id=142254 5 6 Reviewed by Timothy Hatcher. 7 8 * inspector-protocol/runtime/getProperties-expected.txt: 9 * inspector/model/remote-object-expected.txt: 10 * inspector/model/remote-object.html: 11 Update tests now that RemoteObjects and Previews may have an explicit size. 12 1 13 2015-03-04 Timothy Horton <timothy_horton@apple.com> 2 14 -
trunk/LayoutTests/inspector-protocol/runtime/getProperties-expected.txt
r180236 r181061 3 3 foo string cat 4 4 Properties of array 5 __proto__ object Array [0]5 __proto__ object Array 6 6 0 string red 7 7 1 string green … … 17 17 name string Number 18 18 Internal properties 19 boundArgs object Array [1]19 boundArgs object Array 20 20 boundThis object Object 21 21 targetFunction function function Number() { -
trunk/LayoutTests/inspector/model/remote-object-expected.txt
r180356 r181061 518 518 "_subtype": "array", 519 519 "_objectId": "<filtered>", 520 "_description": "Array[0]", 520 "_description": "Array", 521 "_size": 0, 521 522 "_preview": { 522 523 "_type": "object", 523 524 "_subtype": "array", 524 "_description": "Array[0]", 525 "_lossless": true, 526 "_overflow": false, 525 "_description": "Array", 526 "_lossless": true, 527 "_overflow": false, 528 "_size": 0, 527 529 "_properties": [], 528 530 "_entries": null … … 536 538 "_subtype": "array", 537 539 "_objectId": "<filtered>", 538 "_description": "Array[2]", 540 "_description": "Array", 541 "_size": 2, 539 542 "_preview": { 540 543 "_type": "object", 541 544 "_subtype": "array", 542 "_description": "Array[2]", 543 "_lossless": true, 544 "_overflow": false, 545 "_description": "Array", 546 "_lossless": true, 547 "_overflow": false, 548 "_size": 2, 545 549 "_properties": [ 546 550 { … … 565 569 "_subtype": "array", 566 570 "_objectId": "<filtered>", 567 "_description": "Array[3]", 571 "_description": "Array", 572 "_size": 3, 568 573 "_preview": { 569 574 "_type": "object", 570 575 "_subtype": "array", 571 "_description": "Array [3]",576 "_description": "Array", 572 577 "_lossless": false, 573 578 "_overflow": false, 579 "_size": 3, 574 580 "_properties": [ 575 581 { … … 577 583 "_type": "object", 578 584 "_subtype": "array", 579 "_value": "Array [1]"585 "_value": "Array" 580 586 }, 581 587 { … … 583 589 "_type": "object", 584 590 "_subtype": "array", 585 "_value": "Array [1]"591 "_value": "Array" 586 592 }, 587 593 { … … 589 595 "_type": "object", 590 596 "_subtype": "array", 591 "_value": "Array [1]"597 "_value": "Array" 592 598 } 593 599 ], … … 602 608 "_subtype": "array", 603 609 "_objectId": "<filtered>", 604 "_description": "Array[5]", 610 "_description": "Array", 611 "_size": 5, 605 612 "_preview": { 606 613 "_type": "object", 607 614 "_subtype": "array", 608 "_description": "Array [5]",615 "_description": "Array", 609 616 "_lossless": false, 610 617 "_overflow": false, 618 "_size": 5, 611 619 "_properties": [ 612 620 { … … 647 655 "_subtype": "array", 648 656 "_objectId": "<filtered>", 649 "_description": "Array[3]", 657 "_description": "Array", 658 "_size": 3, 650 659 "_preview": { 651 660 "_type": "object", 652 661 "_subtype": "array", 653 "_description": "Array [3]",662 "_description": "Array", 654 663 "_lossless": false, 655 664 "_overflow": false, 665 "_size": 3, 656 666 "_properties": [ 657 667 { … … 681 691 "_subtype": "array", 682 692 "_objectId": "<filtered>", 683 "_description": "Array[1]", 693 "_description": "Array", 694 "_size": 1, 684 695 "_preview": { 685 696 "_type": "object", 686 697 "_subtype": "array", 687 "_description": "Array [1]",698 "_description": "Array", 688 699 "_lossless": false, 689 700 "_overflow": false, 701 "_size": 1, 690 702 "_properties": [ 691 703 { … … 693 705 "_type": "object", 694 706 "_subtype": "array", 695 "_value": "Array [3]"707 "_value": "Array" 696 708 } 697 709 ], … … 706 718 "_subtype": "array", 707 719 "_objectId": "<filtered>", 708 "_description": "Array[100]", 720 "_description": "Array", 721 "_size": 100, 709 722 "_preview": { 710 723 "_type": "object", 711 724 "_subtype": "array", 712 "_description": "Array[100]", 713 "_lossless": true, 714 "_overflow": false, 725 "_description": "Array", 726 "_lossless": true, 727 "_overflow": false, 728 "_size": 100, 715 729 "_properties": [], 716 730 "_entries": null … … 724 738 "_subtype": "array", 725 739 "_objectId": "<filtered>", 726 "_description": "Array[100]", 740 "_description": "Array", 741 "_size": 100, 727 742 "_preview": { 728 743 "_type": "object", 729 744 "_subtype": "array", 730 "_description": "Array[100]", 731 "_lossless": true, 732 "_overflow": false, 745 "_description": "Array", 746 "_lossless": true, 747 "_overflow": false, 748 "_size": 100, 733 749 "_properties": [ 734 750 { … … 1243 1259 "_subtype": "array", 1244 1260 "_objectId": "<filtered>", 1245 "_description": "Array[100]", 1261 "_description": "Array", 1262 "_size": 100, 1246 1263 "_preview": { 1247 1264 "_type": "object", 1248 1265 "_subtype": "array", 1249 "_description": "Array[100]", 1250 "_lossless": true, 1251 "_overflow": false, 1266 "_description": "Array", 1267 "_lossless": true, 1268 "_overflow": false, 1269 "_size": 100, 1252 1270 "_properties": [ 1253 1271 { … … 1267 1285 "_subtype": "array", 1268 1286 "_objectId": "<filtered>", 1269 "_description": "Arguments[3]", 1287 "_description": "Arguments", 1288 "_size": 3, 1270 1289 "_preview": { 1271 1290 "_type": "object", 1272 1291 "_subtype": "array", 1273 "_description": "Arguments [3]",1292 "_description": "Arguments", 1274 1293 "_lossless": false, 1275 1294 "_overflow": false, 1295 "_size": 3, 1276 1296 "_properties": [ 1277 1297 { … … 1302 1322 "_subtype": "array", 1303 1323 "_objectId": "<filtered>", 1304 "_description": "Int32Array[4]", 1324 "_description": "Int32Array", 1325 "_size": 4, 1305 1326 "_preview": { 1306 1327 "_type": "object", 1307 1328 "_subtype": "array", 1308 "_description": "Int32Array [4]",1329 "_description": "Int32Array", 1309 1330 "_lossless": false, 1310 1331 "_overflow": false, 1332 "_size": 4, 1311 1333 "_properties": [ 1312 1334 { … … 1356 1378 "_subtype": "array", 1357 1379 "_objectId": "<filtered>", 1358 "_description": "Int32Array[4]", 1380 "_description": "Int32Array", 1381 "_size": 4, 1359 1382 "_preview": { 1360 1383 "_type": "object", 1361 1384 "_subtype": "array", 1362 "_description": "Int32Array [4]",1385 "_description": "Int32Array", 1363 1386 "_lossless": false, 1364 1387 "_overflow": false, 1388 "_size": 4, 1365 1389 "_properties": [ 1366 1390 { … … 1895 1919 "_subtype": "array", 1896 1920 "_objectId": "<filtered>", 1897 "_description": "HTMLCollection[3]", 1921 "_description": "HTMLCollection", 1922 "_size": 3, 1898 1923 "_preview": { 1899 1924 "_type": "object", 1900 1925 "_subtype": "array", 1901 "_description": "HTMLCollection [3]",1926 "_description": "HTMLCollection", 1902 1927 "_lossless": false, 1903 1928 "_overflow": false, 1929 "_size": 3, 1904 1930 "_properties": [ 1905 1931 { … … 1942 1968 "_subtype": "array", 1943 1969 "_objectId": "<filtered>", 1944 "_description": "NodeList[3]", 1970 "_description": "NodeList", 1971 "_size": 3, 1945 1972 "_preview": { 1946 1973 "_type": "object", 1947 1974 "_subtype": "array", 1948 "_description": "NodeList [3]",1975 "_description": "NodeList", 1949 1976 "_lossless": false, 1950 1977 "_overflow": false, 1978 "_size": 3, 1951 1979 "_properties": [ 1952 1980 { … … 1989 2017 "_subtype": "array", 1990 2018 "_objectId": "<filtered>", 1991 "_description": "NodeList[3]", 2019 "_description": "NodeList", 2020 "_size": 3, 1992 2021 "_preview": { 1993 2022 "_type": "object", 1994 2023 "_subtype": "array", 1995 "_description": "NodeList [3]",2024 "_description": "NodeList", 1996 2025 "_lossless": false, 1997 2026 "_overflow": false, 2027 "_size": 3, 1998 2028 "_properties": [ 1999 2029 { … … 2153 2183 2154 2184 ----------------------------------------------------- 2155 EXPRESSION: Object.seal({})2156 {2157 "_type": "object",2158 "_objectId": "<filtered>",2159 "_description": "Object",2160 "_preview": {2161 "_type": "object",2162 "_description": "Object",2163 "_lossless": true,2164 "_overflow": false,2165 "_properties": [],2166 "_entries": null2167 }2168 }2169 2170 -----------------------------------------------------2171 EXPRESSION: Object.freeze({})2172 {2173 "_type": "object",2174 "_objectId": "<filtered>",2175 "_description": "Object",2176 "_preview": {2177 "_type": "object",2178 "_description": "Object",2179 "_lossless": true,2180 "_overflow": false,2181 "_properties": [],2182 "_entries": null2183 }2184 }2185 2186 -----------------------------------------------------2187 2185 EXPRESSION: new Map 2188 2186 { … … 2191 2189 "_objectId": "<filtered>", 2192 2190 "_description": "Map", 2191 "_size": 0, 2193 2192 "_preview": { 2194 2193 "_type": "object", … … 2197 2196 "_lossless": true, 2198 2197 "_overflow": false, 2198 "_size": 0, 2199 2199 "_properties": [], 2200 2200 "_entries": [] … … 2209 2209 "_objectId": "<filtered>", 2210 2210 "_description": "Map", 2211 "_size": 2, 2211 2212 "_preview": { 2212 2213 "_type": "object", … … 2215 2216 "_lossless": true, 2216 2217 "_overflow": false, 2218 "_size": 2, 2217 2219 "_properties": [], 2218 2220 "_entries": [ … … 2264 2266 "_objectId": "<filtered>", 2265 2267 "_description": "Map", 2268 "_size": 2, 2266 2269 "_preview": { 2267 2270 "_type": "object", … … 2270 2273 "_lossless": true, 2271 2274 "_overflow": false, 2275 "_size": 2, 2272 2276 "_properties": [], 2273 2277 "_entries": [ … … 2341 2345 "_type": "object", 2342 2346 "_subtype": "array", 2343 "_description": "Array [2]",2347 "_description": "Array", 2344 2348 "_lossless": true, 2345 2349 "_overflow": false, 2350 "_size": 2, 2346 2351 "_properties": [ 2347 2352 { … … 2370 2375 "_objectId": "<filtered>", 2371 2376 "_description": "Map", 2377 "_size": 101, 2372 2378 "_preview": { 2373 2379 "_type": "object", … … 2376 2382 "_lossless": false, 2377 2383 "_overflow": true, 2384 "_size": 101, 2378 2385 "_properties": [], 2379 2386 "_entries": [ … … 2479 2486 "_objectId": "<filtered>", 2480 2487 "_description": "WeakMap", 2488 "_size": 1, 2481 2489 "_preview": { 2482 2490 "_type": "object", … … 2485 2493 "_lossless": true, 2486 2494 "_overflow": false, 2495 "_size": 1, 2487 2496 "_properties": [], 2488 2497 "_entries": [ … … 2505 2514 "_type": "object", 2506 2515 "_subtype": "array", 2507 "_description": "Array [2]",2516 "_description": "Array", 2508 2517 "_lossless": true, 2509 2518 "_overflow": false, 2519 "_size": 2, 2510 2520 "_properties": [ 2511 2521 { … … 2534 2544 "_objectId": "<filtered>", 2535 2545 "_description": "Set", 2546 "_size": 0, 2536 2547 "_preview": { 2537 2548 "_type": "object", … … 2540 2551 "_lossless": true, 2541 2552 "_overflow": false, 2553 "_size": 0, 2542 2554 "_properties": [], 2543 2555 "_entries": [] … … 2552 2564 "_objectId": "<filtered>", 2553 2565 "_description": "Set", 2566 "_size": 3, 2554 2567 "_preview": { 2555 2568 "_type": "object", … … 2558 2571 "_lossless": true, 2559 2572 "_overflow": false, 2573 "_size": 3, 2560 2574 "_properties": [], 2561 2575 "_entries": [ … … 2601 2615 "_objectId": "<filtered>", 2602 2616 "_description": "Set", 2617 "_size": 3, 2603 2618 "_preview": { 2604 2619 "_type": "object", … … 2607 2622 "_lossless": true, 2608 2623 "_overflow": false, 2624 "_size": 3, 2609 2625 "_properties": [], 2610 2626 "_entries": [ … … 2666 2682 "_type": "object", 2667 2683 "_subtype": "array", 2668 "_description": "Array [2]",2684 "_description": "Array", 2669 2685 "_lossless": true, 2670 2686 "_overflow": false, 2687 "_size": 2, 2671 2688 "_properties": [ 2672 2689 { … … 2695 2712 "_objectId": "<filtered>", 2696 2713 "_description": "Set", 2714 "_size": 101, 2697 2715 "_preview": { 2698 2716 "_type": "object", … … 2701 2719 "_lossless": false, 2702 2720 "_overflow": true, 2721 "_size": 101, 2703 2722 "_properties": [], 2704 2723 "_entries": [ … … 2896 2915 } 2897 2916 2917 ----------------------------------------------------- 2918 EXPRESSION: Object.seal({}) 2919 { 2920 "_type": "object", 2921 "_objectId": "<filtered>", 2922 "_description": "Object", 2923 "_preview": { 2924 "_type": "object", 2925 "_description": "Object", 2926 "_lossless": true, 2927 "_overflow": false, 2928 "_properties": [], 2929 "_entries": null 2930 } 2931 } 2932 2933 ----------------------------------------------------- 2934 EXPRESSION: Object.freeze({}) 2935 { 2936 "_type": "object", 2937 "_objectId": "<filtered>", 2938 "_description": "Object", 2939 "_preview": { 2940 "_type": "object", 2941 "_description": "Object", 2942 "_lossless": true, 2943 "_overflow": false, 2944 "_properties": [], 2945 "_entries": null 2946 } 2947 } 2948 -
trunk/LayoutTests/inspector/model/remote-object.html
r180715 r181061 117 117 {expression: "error = null; try { document.createTextNode('').splitText(100); } catch (e) { error = e; }; error"}, 118 118 119 // Improveable:120 121 // Sealed / Frozen objects.122 {expression: "Object.seal({})"},123 {expression: "Object.freeze({})"},124 125 119 // Map / WeakMap 126 120 {expression: "new Map"}, … … 143 137 {expression: "Promise.resolve({result:1})"}, 144 138 139 // Improveable: 140 141 // Sealed / Frozen objects. 142 {expression: "Object.seal({})"}, 143 {expression: "Object.freeze({})"}, 145 144 ]; 146 145 -
trunk/Source/JavaScriptCore/ChangeLog
r181060 r181061 1 2015-03-04 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Array/Collection Sizes should be visible and distinct 4 https://bugs.webkit.org/show_bug.cgi?id=142254 5 6 Reviewed by Timothy Hatcher. 7 8 * runtime/WeakMapData.h: 9 (JSC::WeakMapData::size): 10 * inspector/JSInjectedScriptHost.cpp: 11 (Inspector::JSInjectedScriptHost::weakMapSize): 12 * inspector/JSInjectedScriptHost.h: 13 * inspector/JSInjectedScriptHostPrototype.cpp: 14 (Inspector::JSInjectedScriptHostPrototype::finishCreation): 15 (Inspector::jsInjectedScriptHostPrototypeFunctionWeakMapSize): 16 Add a way to get a WeakMap's size. 17 18 * inspector/protocol/Runtime.json: 19 Include size in RemoteObject and ObjectPreview. 20 21 * inspector/InjectedScriptSource.js: 22 Set the size of RemoteObjects and previews if they 23 are array/collection types. 24 1 25 2015-03-04 Andreas Kling <akling@apple.com> 2 26 -
trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js
r180913 r181061 769 769 770 770 var className = InjectedScriptHost.internalConstructorName(obj); 771 if (subtype === "array") { 772 if (typeof obj.length === "number") 773 className += "[" + obj.length + "]"; 771 if (subtype === "array") 774 772 return className; 775 }776 773 777 774 // NodeList in JSC is a function, check for array prior to this. … … 905 902 this.description = injectedScript._describe(object); 906 903 904 if (subtype === "array") 905 this.size = typeof object.length === "number" ? object.length : 0; 906 else if (subtype === "set" || subtype === "map") 907 this.size = object.size; 908 else if (subtype === "weakmap") 909 this.size = InjectedScriptHost.weakMapSize(object); 910 907 911 if (generatePreview && this.type === "object") 908 912 this.preview = this._generatePreview(object, undefined, columnNames); … … 925 929 } 926 930 } 931 932 if ("size" in this) 933 preview.size = this.size; 927 934 928 935 return preview; -
trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp
r180891 r181061 254 254 } 255 255 256 JSValue JSInjectedScriptHost::weakMapSize(ExecState* exec) 257 { 258 if (exec->argumentCount() < 1) 259 return jsUndefined(); 260 261 JSValue value = exec->uncheckedArgument(0); 262 JSWeakMap* weakMap = jsDynamicCast<JSWeakMap*>(value); 263 if (!weakMap) 264 return jsUndefined(); 265 266 return jsNumber(weakMap->weakMapData()->size()); 267 } 268 256 269 JSValue JSInjectedScriptHost::weakMapEntries(ExecState* exec) 257 270 { -
trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.h
r179349 r181061 66 66 JSC::JSValue functionDetails(JSC::ExecState*); 67 67 JSC::JSValue getInternalProperties(JSC::ExecState*); 68 JSC::JSValue weakMapSize(JSC::ExecState*); 68 69 JSC::JSValue weakMapEntries(JSC::ExecState*); 69 70 -
trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.cpp
r179349 r181061 44 44 static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionInternalConstructorName(ExecState*); 45 45 static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionIsHTMLAllCollection(ExecState*); 46 static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionWeakMapSize(ExecState*); 46 47 static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionWeakMapEntries(ExecState*); 47 48 … … 61 62 JSC_NATIVE_FUNCTION("internalConstructorName", jsInjectedScriptHostPrototypeFunctionInternalConstructorName, DontEnum, 1); 62 63 JSC_NATIVE_FUNCTION("isHTMLAllCollection", jsInjectedScriptHostPrototypeFunctionIsHTMLAllCollection, DontEnum, 1); 64 JSC_NATIVE_FUNCTION("weakMapSize", jsInjectedScriptHostPrototypeFunctionWeakMapSize, DontEnum, 1); 63 65 JSC_NATIVE_FUNCTION("weakMapEntries", jsInjectedScriptHostPrototypeFunctionWeakMapEntries, DontEnum, 1); 64 66 … … 101 103 ASSERT_GC_OBJECT_INHERITS(castedThis, JSInjectedScriptHost::info()); 102 104 return JSValue::encode(castedThis->isHTMLAllCollection(exec)); 105 } 106 107 EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionWeakMapSize(ExecState* exec) 108 { 109 JSValue thisValue = exec->thisValue(); 110 JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(thisValue); 111 if (!castedThis) 112 return throwVMTypeError(exec); 113 114 ASSERT_GC_OBJECT_INHERITS(castedThis, JSInjectedScriptHost::info()); 115 return JSValue::encode(castedThis->weakMapSize(exec)); 103 116 } 104 117 -
trunk/Source/JavaScriptCore/inspector/protocol/Runtime.json
r180913 r181061 19 19 { "name": "description", "type": "string", "optional": true, "description": "String representation of the object." }, 20 20 { "name": "objectId", "$ref": "RemoteObjectId", "optional": true, "description": "Unique object identifier (for non-primitive values)." }, 21 { "name": "size", "type": "integer", "optional": true, "description": "Size of the array/collection. Specified for array/map/set/weakmap object type values only." }, 21 22 { "name": "preview", "$ref": "ObjectPreview", "optional": true, "description": "Preview containing abbreviated property values. Specified for <code>object</code> type values only." } 22 23 ] … … 33 34 { "name": "overflow", "type": "boolean", "optional": true, "description": "True iff some of the properties of the original did not fit." }, 34 35 { "name": "properties", "type": "array", "items": { "$ref": "PropertyPreview" }, "optional": true, "description": "List of the properties." }, 35 { "name": "entries", "type": "array", "items": { "$ref": "EntryPreview" }, "optional": true, "description": "List of the entries. Specified for <code>map</code> and <code>set</code> subtype values only." } 36 { "name": "entries", "type": "array", "items": { "$ref": "EntryPreview" }, "optional": true, "description": "List of the entries. Specified for <code>map</code> and <code>set</code> subtype values only." }, 37 { "name": "size", "type": "integer", "optional": true, "description": "Size of the array/collection. Specified for array/map/set/weakmap object type values only." } 36 38 ] 37 39 }, -
trunk/Source/JavaScriptCore/runtime/WeakMapData.h
r179349 r181061 68 68 MapType::const_iterator end() const { return m_map.end(); } 69 69 70 int size() const { return m_map.size(); } 71 70 72 private: 71 73 WeakMapData(VM&); -
trunk/Source/WebInspectorUI/ChangeLog
r181011 r181061 1 2015-03-04 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Array/Collection Sizes should be visible and distinct 4 https://bugs.webkit.org/show_bug.cgi?id=142254 5 6 Reviewed by Timothy Hatcher. 7 8 * UserInterface/Models/ObjectPreview.js: 9 (WebInspector.ObjectPreview): 10 (WebInspector.ObjectPreview.fromPayload): 11 (WebInspector.ObjectPreview.prototype.get size): 12 (WebInspector.ObjectPreview.prototype.hasSize): 13 * UserInterface/Protocol/RemoteObject.js: 14 (WebInspector.RemoteObject): 15 (WebInspector.RemoteObject.fromPrimitiveValue): 16 (WebInspector.RemoteObject.fromPayload): 17 (WebInspector.RemoteObject.prototype.get size): 18 (WebInspector.RemoteObject.prototype.hasSize): 19 Check if this type has a size and get the size. 20 Gracefully handle construction for legacy protocols. 21 22 * UserInterface/Views/ObjectPreviewView.css: 23 (.object-preview > .size): 24 * UserInterface/Views/FormattedValue.css: 25 (:matches(.formatted-array, .formatted-map, .formatted-set, .formatted-weakmap) > .size): 26 Style the array/collection size. 27 28 * UserInterface/Views/ObjectPreviewView.js: 29 (WebInspector.ObjectPreviewView): 30 * UserInterface/Views/FormattedValue.js: 31 (WebInspector.FormattedValue.createElementForTypesAndValue): 32 (WebInspector.FormattedValue.createElementForRemoteObject): 33 (WebInspector.FormattedValue.createElementForObjectPreview): 34 (WebInspector.FormattedValue.createElementForPropertyPreview): 35 Add an element showing the array/collection size. 36 37 * UserInterface/Views/ObjectTreePropertyTreeElement.js: 38 (WebInspector.ObjectTreePropertyTreeElement.prototype): 39 Remove special handling for Array sizes now that this is handled earlier. 40 41 * UserInterface/Controllers/StorageManager.js: 42 (WebInspector.StorageManager.prototype.processData): 43 (WebInspector.StorageManager.prototype.requestIndexedDatabaseData): 44 Fix what looks like broken RemoteObject construction. 45 1 46 2015-03-04 Brian J. Burg <burg@cs.washington.edu> 2 47 -
trunk/Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js
r176049 r181061 151 151 for (var entryPayload of entryPayloads) { 152 152 var entry = {}; 153 entry.primaryKey = newWebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);154 entry.key = newWebInspector.RemoteObject.fromPayload(entryPayload.key);155 entry.value = newWebInspector.RemoteObject.fromPayload(entryPayload.value);153 entry.primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey); 154 entry.key = WebInspector.RemoteObject.fromPayload(entryPayload.key); 155 entry.value = WebInspector.RemoteObject.fromPayload(entryPayload.value); 156 156 entries.push(entry); 157 157 } -
trunk/Source/WebInspectorUI/UserInterface/Models/ObjectPreview.js
r180356 r181061 24 24 */ 25 25 26 WebInspector.ObjectPreview = function(type, subtype, description, lossless, overflow, properties, entries )26 WebInspector.ObjectPreview = function(type, subtype, description, lossless, overflow, properties, entries, size) 27 27 { 28 28 WebInspector.Object.call(this); … … 38 38 this._lossless = lossless; 39 39 this._overflow = overflow || false; 40 this._size = size; 40 41 41 42 this._properties = properties || null; … … 51 52 payload.entries = payload.entries.map(function(entry) { return WebInspector.CollectionEntryPreview.fromPayload(entry); }); 52 53 53 return new WebInspector.ObjectPreview(payload.type, payload.subtype, payload.description, payload.lossless, payload.overflow, payload.properties, payload.entries); 54 if (payload.subtype === "array") { 55 // COMPATIBILITY (iOS 8): Runtime.ObjectPreview did not have size property, 56 // instead it was tacked onto the end of the description, like "Array[#]". 57 var match = payload.description.match(/\[(\d+)\]$/); 58 if (match) { 59 payload.size = parseInt(match[1]); 60 payload.description = payload.description.replace(/\[\d+\]$/, ""); 61 } 62 } 63 64 return new WebInspector.ObjectPreview(payload.type, payload.subtype, payload.description, payload.lossless, payload.overflow, payload.properties, payload.entries, payload.size); 54 65 }; 55 66 … … 93 104 { 94 105 return this._entries; 106 }, 107 108 get size() 109 { 110 return this._size; 111 }, 112 113 hasSize: function() 114 { 115 return this._size !== undefined && (this._subtype === "array" || this._subtype === "set" || this._subtype === "map" || this._subtype === "weakmap"); 95 116 } 96 117 }; -
trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js
r180913 r181061 29 29 */ 30 30 31 WebInspector.RemoteObject = function(objectId, type, subtype, value, description, preview)31 WebInspector.RemoteObject = function(objectId, type, subtype, value, description, size, preview) 32 32 { 33 33 // No superclass. … … 48 48 this._description = description; 49 49 this._hasChildren = type !== "symbol"; 50 this._size = size; 50 51 this._preview = preview; 51 52 } else { … … 62 63 WebInspector.RemoteObject.fromPrimitiveValue = function(value) 63 64 { 64 return new WebInspector.RemoteObject(undefined, typeof value, undefined, value);65 return new WebInspector.RemoteObject(undefined, typeof value, undefined, undefined, value); 65 66 }; 66 67 … … 68 69 { 69 70 console.assert(typeof payload === "object", "Remote object payload should only be an object"); 71 72 if (payload.subtype === "array") { 73 // COMPATIBILITY (iOS 8): Runtime.RemoteObject did not have size property, 74 // instead it was tacked onto the end of the description, like "Array[#]". 75 var match = payload.description.match(/\[(\d+)\]$/); 76 if (match) { 77 payload.size = parseInt(match[1]); 78 payload.description = payload.description.replace(/\[\d+\]$/, ""); 79 } 80 } 70 81 71 82 if (payload.preview) { … … 76 87 payload.preview.subtype = payload.subtype; 77 88 payload.preview.description = payload.description; 89 payload.preview.size = payload.size; 78 90 } 79 91 payload.preview = WebInspector.ObjectPreview.fromPayload(payload.preview); 80 92 } 81 93 82 return new WebInspector.RemoteObject(payload.objectId, payload.type, payload.subtype, payload.value, payload.description, payload. preview);94 return new WebInspector.RemoteObject(payload.objectId, payload.type, payload.subtype, payload.value, payload.description, payload.size, payload.preview); 83 95 }; 84 96 … … 152 164 }, 153 165 166 get size() 167 { 168 return this._size || 0; 169 }, 170 154 171 get preview() 155 172 { 156 173 return this._preview; 174 }, 175 176 hasSize: function() 177 { 178 return this.isArray() || this.isCollectionType(); 157 179 }, 158 180 -
trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.css
r180713 r181061 29 29 vertical-align: top; 30 30 color: black; 31 } 32 33 :matches(.formatted-array, .formatted-map, .formatted-set, .formatted-weakmap) > .size { 34 font-style: normal; 35 color: hsl(0, 0%, 67%); 31 36 } 32 37 -
trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.js
r180713 r181061 70 70 }; 71 71 72 WebInspector.FormattedValue.createElementForTypesAndValue = function(type, subtype, displayString, isPreview, hadException)72 WebInspector.FormattedValue.createElementForTypesAndValue = function(type, subtype, displayString, size, isPreview, hadException) 73 73 { 74 74 var span = document.createElement("span"); … … 95 95 // Everything else, the description/value string. 96 96 span.textContent = displayString; 97 98 // If there is a size, include it. 99 if (size !== undefined && (subtype === "array" || subtype === "set" || subtype === "map" || subtype === "weakmap")) { 100 var sizeElement = span.appendChild(document.createElement("span")); 101 sizeElement.className = "size"; 102 sizeElement.textContent = " (" + size + ")"; 103 } 104 97 105 return span; 98 106 }; … … 100 108 WebInspector.FormattedValue.createElementForRemoteObject = function(object, hadException) 101 109 { 102 return WebInspector.FormattedValue.createElementForTypesAndValue(object.type, object.subtype, object.description, false, hadException);110 return WebInspector.FormattedValue.createElementForTypesAndValue(object.type, object.subtype, object.description, object.size, false, hadException); 103 111 }; 104 112 105 113 WebInspector.FormattedValue.createElementForObjectPreview = function(objectPreview) 106 114 { 107 return WebInspector.FormattedValue.createElementForTypesAndValue(objectPreview.type, objectPreview.subtype, objectPreview.description, true, false);115 return WebInspector.FormattedValue.createElementForTypesAndValue(objectPreview.type, objectPreview.subtype, objectPreview.description, objectPreview.size, true, false); 108 116 }; 109 117 110 118 WebInspector.FormattedValue.createElementForPropertyPreview = function(propertyPreview) 111 119 { 112 return WebInspector.FormattedValue.createElementForTypesAndValue(propertyPreview.type, propertyPreview.subtype, propertyPreview.value, true, false);120 return WebInspector.FormattedValue.createElementForTypesAndValue(propertyPreview.type, propertyPreview.subtype, propertyPreview.value, undefined, true, false); 113 121 }; 114 122 -
trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.css
r180722 r181061 39 39 color: rgb(136, 19, 145); 40 40 } 41 42 .object-preview > .size { 43 font-style: normal; 44 color: hsl(0, 0%, 67%); 45 } -
trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js
r180714 r181061 45 45 this._initTitleElement(); 46 46 47 if (this._preview.hasSize()) { 48 var sizeElement = this._element.appendChild(document.createElement("span")); 49 sizeElement.className = "size"; 50 sizeElement.textContent = " (" + this._preview.size + ")"; 51 } 52 47 53 if (this._lossless) 48 54 this._element.classList.add("lossless"); -
trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js
r180913 r181061 376 376 return "RegExp"; 377 377 378 return value.description.replace(/ \[\d+\]$/, "").replace(/Prototype$/, "");378 return value.description.replace(/Prototype$/, ""); 379 379 }, 380 380
Note: See TracChangeset
for help on using the changeset viewer.