Log Message
Web Inspector: Array/Collection Sizes should be visible and distinct https://bugs.webkit.org/show_bug.cgi?id=142254
Patch by Joseph Pecoraro <[email protected]> on 2015-03-04 Reviewed by Timothy Hatcher. Source/_javascript_Core: * runtime/WeakMapData.h: (JSC::WeakMapData::size): * inspector/JSInjectedScriptHost.cpp: (Inspector::JSInjectedScriptHost::weakMapSize): * inspector/JSInjectedScriptHost.h: * inspector/JSInjectedScriptHostPrototype.cpp: (Inspector::JSInjectedScriptHostPrototype::finishCreation): (Inspector::jsInjectedScriptHostPrototypeFunctionWeakMapSize): Add a way to get a WeakMap's size. * inspector/protocol/Runtime.json: Include size in RemoteObject and ObjectPreview. * inspector/InjectedScriptSource.js: Set the size of RemoteObjects and previews if they are array/collection types. Source/WebInspectorUI: * UserInterface/Models/ObjectPreview.js: (WebInspector.ObjectPreview): (WebInspector.ObjectPreview.fromPayload): (WebInspector.ObjectPreview.prototype.get size): (WebInspector.ObjectPreview.prototype.hasSize): * UserInterface/Protocol/RemoteObject.js: (WebInspector.RemoteObject): (WebInspector.RemoteObject.fromPrimitiveValue): (WebInspector.RemoteObject.fromPayload): (WebInspector.RemoteObject.prototype.get size): (WebInspector.RemoteObject.prototype.hasSize): Check if this type has a size and get the size. Gracefully handle construction for legacy protocols. * UserInterface/Views/ObjectPreviewView.css: (.object-preview > .size): * UserInterface/Views/FormattedValue.css: (:matches(.formatted-array, .formatted-map, .formatted-set, .formatted-weakmap) > .size): Style the array/collection size. * UserInterface/Views/ObjectPreviewView.js: (WebInspector.ObjectPreviewView): * UserInterface/Views/FormattedValue.js: (WebInspector.FormattedValue.createElementForTypesAndValue): (WebInspector.FormattedValue.createElementForRemoteObject): (WebInspector.FormattedValue.createElementForObjectPreview): (WebInspector.FormattedValue.createElementForPropertyPreview): Add an element showing the array/collection size. * UserInterface/Views/ObjectTreePropertyTreeElement.js: (WebInspector.ObjectTreePropertyTreeElement.prototype): Remove special handling for Array sizes now that this is handled earlier. * UserInterface/Controllers/StorageManager.js: (WebInspector.StorageManager.prototype.processData): (WebInspector.StorageManager.prototype.requestIndexedDatabaseData): Fix what looks like broken RemoteObject construction. LayoutTests: * inspector-protocol/runtime/getProperties-expected.txt: * inspector/model/remote-object-expected.txt: * inspector/model/remote-object.html: Update tests now that RemoteObjects and Previews may have an explicit size.
Modified Paths
- trunk/LayoutTests/ChangeLog
- trunk/LayoutTests/inspector/model/remote-object-expected.txt
- trunk/LayoutTests/inspector/model/remote-object.html
- trunk/LayoutTests/inspector-protocol/runtime/getProperties-expected.txt
- trunk/Source/_javascript_Core/ChangeLog
- trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js
- trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp
- trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.h
- trunk/Source/_javascript_Core/inspector/JSInjectedScriptHostPrototype.cpp
- trunk/Source/_javascript_Core/inspector/protocol/Runtime.json
- trunk/Source/_javascript_Core/runtime/WeakMapData.h
- trunk/Source/WebInspectorUI/ChangeLog
- trunk/Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js
- trunk/Source/WebInspectorUI/UserInterface/Models/ObjectPreview.js
- trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js
- trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.css
- trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.js
- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.css
- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js
- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js
Diff
Modified: trunk/LayoutTests/ChangeLog (181060 => 181061)
--- trunk/LayoutTests/ChangeLog 2015-03-05 02:19:14 UTC (rev 181060)
+++ trunk/LayoutTests/ChangeLog 2015-03-05 02:27:23 UTC (rev 181061)
@@ -1,3 +1,15 @@
+2015-03-04 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: Array/Collection Sizes should be visible and distinct
+ https://bugs.webkit.org/show_bug.cgi?id=142254
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector-protocol/runtime/getProperties-expected.txt:
+ * inspector/model/remote-object-expected.txt:
+ * inspector/model/remote-object.html:
+ Update tests now that RemoteObjects and Previews may have an explicit size.
+
2015-03-04 Timothy Horton <[email protected]>
<attachment> should show the file size as detail text below the icon
Modified: trunk/LayoutTests/inspector/model/remote-object-expected.txt (181060 => 181061)
--- trunk/LayoutTests/inspector/model/remote-object-expected.txt 2015-03-05 02:19:14 UTC (rev 181060)
+++ trunk/LayoutTests/inspector/model/remote-object-expected.txt 2015-03-05 02:27:23 UTC (rev 181061)
@@ -517,13 +517,15 @@
"_type": "object",
"_subtype": "array",
"_objectId": "<filtered>",
- "_description": "Array[0]",
+ "_description": "Array",
+ "_size": 0,
"_preview": {
"_type": "object",
"_subtype": "array",
- "_description": "Array[0]",
+ "_description": "Array",
"_lossless": true,
"_overflow": false,
+ "_size": 0,
"_properties": [],
"_entries": null
}
@@ -535,13 +537,15 @@
"_type": "object",
"_subtype": "array",
"_objectId": "<filtered>",
- "_description": "Array[2]",
+ "_description": "Array",
+ "_size": 2,
"_preview": {
"_type": "object",
"_subtype": "array",
- "_description": "Array[2]",
+ "_description": "Array",
"_lossless": true,
"_overflow": false,
+ "_size": 2,
"_properties": [
{
"_name": "0",
@@ -564,31 +568,33 @@
"_type": "object",
"_subtype": "array",
"_objectId": "<filtered>",
- "_description": "Array[3]",
+ "_description": "Array",
+ "_size": 3,
"_preview": {
"_type": "object",
"_subtype": "array",
- "_description": "Array[3]",
+ "_description": "Array",
"_lossless": false,
"_overflow": false,
+ "_size": 3,
"_properties": [
{
"_name": "0",
"_type": "object",
"_subtype": "array",
- "_value": "Array[1]"
+ "_value": "Array"
},
{
"_name": "1",
"_type": "object",
"_subtype": "array",
- "_value": "Array[1]"
+ "_value": "Array"
},
{
"_name": "2",
"_type": "object",
"_subtype": "array",
- "_value": "Array[1]"
+ "_value": "Array"
}
],
"_entries": null
@@ -601,13 +607,15 @@
"_type": "object",
"_subtype": "array",
"_objectId": "<filtered>",
- "_description": "Array[5]",
+ "_description": "Array",
+ "_size": 5,
"_preview": {
"_type": "object",
"_subtype": "array",
- "_description": "Array[5]",
+ "_description": "Array",
"_lossless": false,
"_overflow": false,
+ "_size": 5,
"_properties": [
{
"_name": "0",
@@ -646,13 +654,15 @@
"_type": "object",
"_subtype": "array",
"_objectId": "<filtered>",
- "_description": "Array[3]",
+ "_description": "Array",
+ "_size": 3,
"_preview": {
"_type": "object",
"_subtype": "array",
- "_description": "Array[3]",
+ "_description": "Array",
"_lossless": false,
"_overflow": false,
+ "_size": 3,
"_properties": [
{
"_name": "0",
@@ -680,19 +690,21 @@
"_type": "object",
"_subtype": "array",
"_objectId": "<filtered>",
- "_description": "Array[1]",
+ "_description": "Array",
+ "_size": 1,
"_preview": {
"_type": "object",
"_subtype": "array",
- "_description": "Array[1]",
+ "_description": "Array",
"_lossless": false,
"_overflow": false,
+ "_size": 1,
"_properties": [
{
"_name": "0",
"_type": "object",
"_subtype": "array",
- "_value": "Array[3]"
+ "_value": "Array"
}
],
"_entries": null
@@ -705,13 +717,15 @@
"_type": "object",
"_subtype": "array",
"_objectId": "<filtered>",
- "_description": "Array[100]",
+ "_description": "Array",
+ "_size": 100,
"_preview": {
"_type": "object",
"_subtype": "array",
- "_description": "Array[100]",
+ "_description": "Array",
"_lossless": true,
"_overflow": false,
+ "_size": 100,
"_properties": [],
"_entries": null
}
@@ -723,13 +737,15 @@
"_type": "object",
"_subtype": "array",
"_objectId": "<filtered>",
- "_description": "Array[100]",
+ "_description": "Array",
+ "_size": 100,
"_preview": {
"_type": "object",
"_subtype": "array",
- "_description": "Array[100]",
+ "_description": "Array",
"_lossless": true,
"_overflow": false,
+ "_size": 100,
"_properties": [
{
"_name": "0",
@@ -1242,13 +1258,15 @@
"_type": "object",
"_subtype": "array",
"_objectId": "<filtered>",
- "_description": "Array[100]",
+ "_description": "Array",
+ "_size": 100,
"_preview": {
"_type": "object",
"_subtype": "array",
- "_description": "Array[100]",
+ "_description": "Array",
"_lossless": true,
"_overflow": false,
+ "_size": 100,
"_properties": [
{
"_name": "10",
@@ -1266,13 +1284,15 @@
"_type": "object",
"_subtype": "array",
"_objectId": "<filtered>",
- "_description": "Arguments[3]",
+ "_description": "Arguments",
+ "_size": 3,
"_preview": {
"_type": "object",
"_subtype": "array",
- "_description": "Arguments[3]",
+ "_description": "Arguments",
"_lossless": false,
"_overflow": false,
+ "_size": 3,
"_properties": [
{
"_name": "0",
@@ -1301,13 +1321,15 @@
"_type": "object",
"_subtype": "array",
"_objectId": "<filtered>",
- "_description": "Int32Array[4]",
+ "_description": "Int32Array",
+ "_size": 4,
"_preview": {
"_type": "object",
"_subtype": "array",
- "_description": "Int32Array[4]",
+ "_description": "Int32Array",
"_lossless": false,
"_overflow": false,
+ "_size": 4,
"_properties": [
{
"_name": "0",
@@ -1355,13 +1377,15 @@
"_type": "object",
"_subtype": "array",
"_objectId": "<filtered>",
- "_description": "Int32Array[4]",
+ "_description": "Int32Array",
+ "_size": 4,
"_preview": {
"_type": "object",
"_subtype": "array",
- "_description": "Int32Array[4]",
+ "_description": "Int32Array",
"_lossless": false,
"_overflow": false,
+ "_size": 4,
"_properties": [
{
"_name": "0",
@@ -1894,13 +1918,15 @@
"_type": "object",
"_subtype": "array",
"_objectId": "<filtered>",
- "_description": "HTMLCollection[3]",
+ "_description": "HTMLCollection",
+ "_size": 3,
"_preview": {
"_type": "object",
"_subtype": "array",
- "_description": "HTMLCollection[3]",
+ "_description": "HTMLCollection",
"_lossless": false,
"_overflow": false,
+ "_size": 3,
"_properties": [
{
"_name": "0",
@@ -1941,13 +1967,15 @@
"_type": "object",
"_subtype": "array",
"_objectId": "<filtered>",
- "_description": "NodeList[3]",
+ "_description": "NodeList",
+ "_size": 3,
"_preview": {
"_type": "object",
"_subtype": "array",
- "_description": "NodeList[3]",
+ "_description": "NodeList",
"_lossless": false,
"_overflow": false,
+ "_size": 3,
"_properties": [
{
"_name": "0",
@@ -1988,13 +2016,15 @@
"_type": "object",
"_subtype": "array",
"_objectId": "<filtered>",
- "_description": "NodeList[3]",
+ "_description": "NodeList",
+ "_size": 3,
"_preview": {
"_type": "object",
"_subtype": "array",
- "_description": "NodeList[3]",
+ "_description": "NodeList",
"_lossless": false,
"_overflow": false,
+ "_size": 3,
"_properties": [
{
"_name": "0",
@@ -2152,50 +2182,20 @@
}
-----------------------------------------------------
-_expression_: Object.seal({})
-{
- "_type": "object",
- "_objectId": "<filtered>",
- "_description": "Object",
- "_preview": {
- "_type": "object",
- "_description": "Object",
- "_lossless": true,
- "_overflow": false,
- "_properties": [],
- "_entries": null
- }
-}
-
------------------------------------------------------
-_expression_: Object.freeze({})
-{
- "_type": "object",
- "_objectId": "<filtered>",
- "_description": "Object",
- "_preview": {
- "_type": "object",
- "_description": "Object",
- "_lossless": true,
- "_overflow": false,
- "_properties": [],
- "_entries": null
- }
-}
-
------------------------------------------------------
_expression_: new Map
{
"_type": "object",
"_subtype": "map",
"_objectId": "<filtered>",
"_description": "Map",
+ "_size": 0,
"_preview": {
"_type": "object",
"_subtype": "map",
"_description": "Map",
"_lossless": true,
"_overflow": false,
+ "_size": 0,
"_properties": [],
"_entries": []
}
@@ -2208,12 +2208,14 @@
"_subtype": "map",
"_objectId": "<filtered>",
"_description": "Map",
+ "_size": 2,
"_preview": {
"_type": "object",
"_subtype": "map",
"_description": "Map",
"_lossless": true,
"_overflow": false,
+ "_size": 2,
"_properties": [],
"_entries": [
{
@@ -2263,12 +2265,14 @@
"_subtype": "map",
"_objectId": "<filtered>",
"_description": "Map",
+ "_size": 2,
"_preview": {
"_type": "object",
"_subtype": "map",
"_description": "Map",
"_lossless": true,
"_overflow": false,
+ "_size": 2,
"_properties": [],
"_entries": [
{
@@ -2340,9 +2344,10 @@
"_value": {
"_type": "object",
"_subtype": "array",
- "_description": "Array[2]",
+ "_description": "Array",
"_lossless": true,
"_overflow": false,
+ "_size": 2,
"_properties": [
{
"_name": "0",
@@ -2369,12 +2374,14 @@
"_subtype": "map",
"_objectId": "<filtered>",
"_description": "Map",
+ "_size": 101,
"_preview": {
"_type": "object",
"_subtype": "map",
"_description": "Map",
"_lossless": false,
"_overflow": true,
+ "_size": 101,
"_properties": [],
"_entries": [
{
@@ -2478,12 +2485,14 @@
"_subtype": "weakmap",
"_objectId": "<filtered>",
"_description": "WeakMap",
+ "_size": 1,
"_preview": {
"_type": "object",
"_subtype": "weakmap",
"_description": "WeakMap",
"_lossless": true,
"_overflow": false,
+ "_size": 1,
"_properties": [],
"_entries": [
{
@@ -2504,9 +2513,10 @@
"_value": {
"_type": "object",
"_subtype": "array",
- "_description": "Array[2]",
+ "_description": "Array",
"_lossless": true,
"_overflow": false,
+ "_size": 2,
"_properties": [
{
"_name": "0",
@@ -2533,12 +2543,14 @@
"_subtype": "set",
"_objectId": "<filtered>",
"_description": "Set",
+ "_size": 0,
"_preview": {
"_type": "object",
"_subtype": "set",
"_description": "Set",
"_lossless": true,
"_overflow": false,
+ "_size": 0,
"_properties": [],
"_entries": []
}
@@ -2551,12 +2563,14 @@
"_subtype": "set",
"_objectId": "<filtered>",
"_description": "Set",
+ "_size": 3,
"_preview": {
"_type": "object",
"_subtype": "set",
"_description": "Set",
"_lossless": true,
"_overflow": false,
+ "_size": 3,
"_properties": [],
"_entries": [
{
@@ -2600,12 +2614,14 @@
"_subtype": "set",
"_objectId": "<filtered>",
"_description": "Set",
+ "_size": 3,
"_preview": {
"_type": "object",
"_subtype": "set",
"_description": "Set",
"_lossless": true,
"_overflow": false,
+ "_size": 3,
"_properties": [],
"_entries": [
{
@@ -2665,9 +2681,10 @@
"_value": {
"_type": "object",
"_subtype": "array",
- "_description": "Array[2]",
+ "_description": "Array",
"_lossless": true,
"_overflow": false,
+ "_size": 2,
"_properties": [
{
"_name": "0",
@@ -2694,12 +2711,14 @@
"_subtype": "set",
"_objectId": "<filtered>",
"_description": "Set",
+ "_size": 101,
"_preview": {
"_type": "object",
"_subtype": "set",
"_description": "Set",
"_lossless": false,
"_overflow": true,
+ "_size": 101,
"_properties": [],
"_entries": [
{
@@ -2895,3 +2914,35 @@
}
}
+-----------------------------------------------------
+_expression_: Object.seal({})
+{
+ "_type": "object",
+ "_objectId": "<filtered>",
+ "_description": "Object",
+ "_preview": {
+ "_type": "object",
+ "_description": "Object",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": [],
+ "_entries": null
+ }
+}
+
+-----------------------------------------------------
+_expression_: Object.freeze({})
+{
+ "_type": "object",
+ "_objectId": "<filtered>",
+ "_description": "Object",
+ "_preview": {
+ "_type": "object",
+ "_description": "Object",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": [],
+ "_entries": null
+ }
+}
+
Modified: trunk/LayoutTests/inspector/model/remote-object.html (181060 => 181061)
--- trunk/LayoutTests/inspector/model/remote-object.html 2015-03-05 02:19:14 UTC (rev 181060)
+++ trunk/LayoutTests/inspector/model/remote-object.html 2015-03-05 02:27:23 UTC (rev 181061)
@@ -116,12 +116,6 @@
{_expression_: "error = null; try { eval('if()'); } catch (e) { error = e; }; error"},
{_expression_: "error = null; try { document.createTextNode('').splitText(100); } catch (e) { error = e; }; error"},
- // Improveable:
-
- // Sealed / Frozen objects.
- {_expression_: "Object.seal({})"},
- {_expression_: "Object.freeze({})"},
-
// Map / WeakMap
{_expression_: "new Map"},
{_expression_: "map = new Map; map.set(1, 2); map.set('key', 'value'); map"},
@@ -142,6 +136,11 @@
{_expression_: "Promise.resolve()"},
{_expression_: "Promise.resolve({result:1})"},
+ // Improveable:
+
+ // Sealed / Frozen objects.
+ {_expression_: "Object.seal({})"},
+ {_expression_: "Object.freeze({})"},
];
if (!window.WebInspector) {
Modified: trunk/LayoutTests/inspector-protocol/runtime/getProperties-expected.txt (181060 => 181061)
--- trunk/LayoutTests/inspector-protocol/runtime/getProperties-expected.txt 2015-03-05 02:19:14 UTC (rev 181060)
+++ trunk/LayoutTests/inspector-protocol/runtime/getProperties-expected.txt 2015-03-05 02:27:23 UTC (rev 181061)
@@ -2,7 +2,7 @@
__proto__ object Number
foo string cat
Properties of array
- __proto__ object Array[0]
+ __proto__ object Array
0 string red
1 string green
2 string blue
@@ -16,7 +16,7 @@
length number 0
name string Number
Internal properties
- boundArgs object Array[1]
+ boundArgs object Array
boundThis object Object
targetFunction function function Number() {
[native code]
Modified: trunk/Source/_javascript_Core/ChangeLog (181060 => 181061)
--- trunk/Source/_javascript_Core/ChangeLog 2015-03-05 02:19:14 UTC (rev 181060)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-03-05 02:27:23 UTC (rev 181061)
@@ -1,3 +1,27 @@
+2015-03-04 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: Array/Collection Sizes should be visible and distinct
+ https://bugs.webkit.org/show_bug.cgi?id=142254
+
+ Reviewed by Timothy Hatcher.
+
+ * runtime/WeakMapData.h:
+ (JSC::WeakMapData::size):
+ * inspector/JSInjectedScriptHost.cpp:
+ (Inspector::JSInjectedScriptHost::weakMapSize):
+ * inspector/JSInjectedScriptHost.h:
+ * inspector/JSInjectedScriptHostPrototype.cpp:
+ (Inspector::JSInjectedScriptHostPrototype::finishCreation):
+ (Inspector::jsInjectedScriptHostPrototypeFunctionWeakMapSize):
+ Add a way to get a WeakMap's size.
+
+ * inspector/protocol/Runtime.json:
+ Include size in RemoteObject and ObjectPreview.
+
+ * inspector/InjectedScriptSource.js:
+ Set the size of RemoteObjects and previews if they
+ are array/collection types.
+
2015-03-04 Andreas Kling <[email protected]>
GC should compute stack bounds and dump registers at the earliest opportunity.
Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js (181060 => 181061)
--- trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js 2015-03-05 02:19:14 UTC (rev 181060)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js 2015-03-05 02:27:23 UTC (rev 181061)
@@ -768,11 +768,8 @@
}
var className = InjectedScriptHost.internalConstructorName(obj);
- if (subtype === "array") {
- if (typeof obj.length === "number")
- className += "[" + obj.length + "]";
+ if (subtype === "array")
return className;
- }
// NodeList in JSC is a function, check for array prior to this.
if (typeof obj === "function")
@@ -904,6 +901,13 @@
this.className = InjectedScriptHost.internalConstructorName(object);
this.description = injectedScript._describe(object);
+ if (subtype === "array")
+ this.size = typeof object.length === "number" ? object.length : 0;
+ else if (subtype === "set" || subtype === "map")
+ this.size = object.size;
+ else if (subtype === "weakmap")
+ this.size = InjectedScriptHost.weakMapSize(object);
+
if (generatePreview && this.type === "object")
this.preview = this._generatePreview(object, undefined, columnNames);
}
@@ -925,6 +929,9 @@
}
}
+ if ("size" in this)
+ preview.size = this.size;
+
return preview;
},
Modified: trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp (181060 => 181061)
--- trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp 2015-03-05 02:19:14 UTC (rev 181060)
+++ trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp 2015-03-05 02:27:23 UTC (rev 181061)
@@ -253,6 +253,19 @@
return jsUndefined();
}
+JSValue JSInjectedScriptHost::weakMapSize(ExecState* exec)
+{
+ if (exec->argumentCount() < 1)
+ return jsUndefined();
+
+ JSValue value = exec->uncheckedArgument(0);
+ JSWeakMap* weakMap = jsDynamicCast<JSWeakMap*>(value);
+ if (!weakMap)
+ return jsUndefined();
+
+ return jsNumber(weakMap->weakMapData()->size());
+}
+
JSValue JSInjectedScriptHost::weakMapEntries(ExecState* exec)
{
if (exec->argumentCount() < 1)
Modified: trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.h (181060 => 181061)
--- trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.h 2015-03-05 02:19:14 UTC (rev 181060)
+++ trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.h 2015-03-05 02:27:23 UTC (rev 181061)
@@ -65,6 +65,7 @@
JSC::JSValue subtype(JSC::ExecState*);
JSC::JSValue functionDetails(JSC::ExecState*);
JSC::JSValue getInternalProperties(JSC::ExecState*);
+ JSC::JSValue weakMapSize(JSC::ExecState*);
JSC::JSValue weakMapEntries(JSC::ExecState*);
protected:
Modified: trunk/Source/_javascript_Core/inspector/JSInjectedScriptHostPrototype.cpp (181060 => 181061)
--- trunk/Source/_javascript_Core/inspector/JSInjectedScriptHostPrototype.cpp 2015-03-05 02:19:14 UTC (rev 181060)
+++ trunk/Source/_javascript_Core/inspector/JSInjectedScriptHostPrototype.cpp 2015-03-05 02:27:23 UTC (rev 181061)
@@ -43,6 +43,7 @@
static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionGetInternalProperties(ExecState*);
static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionInternalConstructorName(ExecState*);
static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionIsHTMLAllCollection(ExecState*);
+static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionWeakMapSize(ExecState*);
static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionWeakMapEntries(ExecState*);
static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeAttributeEvaluate(ExecState*);
@@ -60,6 +61,7 @@
JSC_NATIVE_FUNCTION("getInternalProperties", jsInjectedScriptHostPrototypeFunctionGetInternalProperties, DontEnum, 1);
JSC_NATIVE_FUNCTION("internalConstructorName", jsInjectedScriptHostPrototypeFunctionInternalConstructorName, DontEnum, 1);
JSC_NATIVE_FUNCTION("isHTMLAllCollection", jsInjectedScriptHostPrototypeFunctionIsHTMLAllCollection, DontEnum, 1);
+ JSC_NATIVE_FUNCTION("weakMapSize", jsInjectedScriptHostPrototypeFunctionWeakMapSize, DontEnum, 1);
JSC_NATIVE_FUNCTION("weakMapEntries", jsInjectedScriptHostPrototypeFunctionWeakMapEntries, DontEnum, 1);
Identifier evaluateIdentifier(&vm, "evaluate");
@@ -102,6 +104,17 @@
return JSValue::encode(castedThis->isHTMLAllCollection(exec));
}
+EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionWeakMapSize(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSInjectedScriptHost::info());
+ return JSValue::encode(castedThis->weakMapSize(exec));
+}
+
EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionWeakMapEntries(ExecState* exec)
{
JSValue thisValue = exec->thisValue();
Modified: trunk/Source/_javascript_Core/inspector/protocol/Runtime.json (181060 => 181061)
--- trunk/Source/_javascript_Core/inspector/protocol/Runtime.json 2015-03-05 02:19:14 UTC (rev 181060)
+++ trunk/Source/_javascript_Core/inspector/protocol/Runtime.json 2015-03-05 02:27:23 UTC (rev 181061)
@@ -18,6 +18,7 @@
{ "name": "value", "type": "any", "optional": true, "description": "Remote object value (in case of primitive values or JSON values if it was requested)." },
{ "name": "description", "type": "string", "optional": true, "description": "String representation of the object." },
{ "name": "objectId", "$ref": "RemoteObjectId", "optional": true, "description": "Unique object identifier (for non-primitive values)." },
+ { "name": "size", "type": "integer", "optional": true, "description": "Size of the array/collection. Specified for array/map/set/weakmap object type values only." },
{ "name": "preview", "$ref": "ObjectPreview", "optional": true, "description": "Preview containing abbreviated property values. Specified for <code>object</code> type values only." }
]
},
@@ -32,7 +33,8 @@
{ "name": "lossless", "type": "boolean", "description": "Determines whether preview is lossless (contains all information of the original object)." },
{ "name": "overflow", "type": "boolean", "optional": true, "description": "True iff some of the properties of the original did not fit." },
{ "name": "properties", "type": "array", "items": { "$ref": "PropertyPreview" }, "optional": true, "description": "List of the properties." },
- { "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." }
+ { "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." },
+ { "name": "size", "type": "integer", "optional": true, "description": "Size of the array/collection. Specified for array/map/set/weakmap object type values only." }
]
},
{
Modified: trunk/Source/_javascript_Core/runtime/WeakMapData.h (181060 => 181061)
--- trunk/Source/_javascript_Core/runtime/WeakMapData.h 2015-03-05 02:19:14 UTC (rev 181060)
+++ trunk/Source/_javascript_Core/runtime/WeakMapData.h 2015-03-05 02:27:23 UTC (rev 181061)
@@ -67,6 +67,8 @@
MapType::const_iterator begin() const { return m_map.begin(); }
MapType::const_iterator end() const { return m_map.end(); }
+ int size() const { return m_map.size(); }
+
private:
WeakMapData(VM&);
static void destroy(JSCell*);
Modified: trunk/Source/WebInspectorUI/ChangeLog (181060 => 181061)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-03-05 02:19:14 UTC (rev 181060)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-03-05 02:27:23 UTC (rev 181061)
@@ -1,3 +1,48 @@
+2015-03-04 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: Array/Collection Sizes should be visible and distinct
+ https://bugs.webkit.org/show_bug.cgi?id=142254
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Models/ObjectPreview.js:
+ (WebInspector.ObjectPreview):
+ (WebInspector.ObjectPreview.fromPayload):
+ (WebInspector.ObjectPreview.prototype.get size):
+ (WebInspector.ObjectPreview.prototype.hasSize):
+ * UserInterface/Protocol/RemoteObject.js:
+ (WebInspector.RemoteObject):
+ (WebInspector.RemoteObject.fromPrimitiveValue):
+ (WebInspector.RemoteObject.fromPayload):
+ (WebInspector.RemoteObject.prototype.get size):
+ (WebInspector.RemoteObject.prototype.hasSize):
+ Check if this type has a size and get the size.
+ Gracefully handle construction for legacy protocols.
+
+ * UserInterface/Views/ObjectPreviewView.css:
+ (.object-preview > .size):
+ * UserInterface/Views/FormattedValue.css:
+ (:matches(.formatted-array, .formatted-map, .formatted-set, .formatted-weakmap) > .size):
+ Style the array/collection size.
+
+ * UserInterface/Views/ObjectPreviewView.js:
+ (WebInspector.ObjectPreviewView):
+ * UserInterface/Views/FormattedValue.js:
+ (WebInspector.FormattedValue.createElementForTypesAndValue):
+ (WebInspector.FormattedValue.createElementForRemoteObject):
+ (WebInspector.FormattedValue.createElementForObjectPreview):
+ (WebInspector.FormattedValue.createElementForPropertyPreview):
+ Add an element showing the array/collection size.
+
+ * UserInterface/Views/ObjectTreePropertyTreeElement.js:
+ (WebInspector.ObjectTreePropertyTreeElement.prototype):
+ Remove special handling for Array sizes now that this is handled earlier.
+
+ * UserInterface/Controllers/StorageManager.js:
+ (WebInspector.StorageManager.prototype.processData):
+ (WebInspector.StorageManager.prototype.requestIndexedDatabaseData):
+ Fix what looks like broken RemoteObject construction.
+
2015-03-04 Brian J. Burg <[email protected]>
Web Inspector: TimelineViews should be displayed in a ContentViewContainer
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js (181060 => 181061)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js 2015-03-05 02:19:14 UTC (rev 181060)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js 2015-03-05 02:27:23 UTC (rev 181061)
@@ -150,9 +150,9 @@
for (var entryPayload of entryPayloads) {
var entry = {};
- entry.primaryKey = new WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
- entry.key = new WebInspector.RemoteObject.fromPayload(entryPayload.key);
- entry.value = new WebInspector.RemoteObject.fromPayload(entryPayload.value);
+ entry.primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
+ entry.key = WebInspector.RemoteObject.fromPayload(entryPayload.key);
+ entry.value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
entries.push(entry);
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/ObjectPreview.js (181060 => 181061)
--- trunk/Source/WebInspectorUI/UserInterface/Models/ObjectPreview.js 2015-03-05 02:19:14 UTC (rev 181060)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/ObjectPreview.js 2015-03-05 02:27:23 UTC (rev 181061)
@@ -23,7 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.ObjectPreview = function(type, subtype, description, lossless, overflow, properties, entries)
+WebInspector.ObjectPreview = function(type, subtype, description, lossless, overflow, properties, entries, size)
{
WebInspector.Object.call(this);
@@ -37,6 +37,7 @@
this._description = description || "";
this._lossless = lossless;
this._overflow = overflow || false;
+ this._size = size;
this._properties = properties || null;
this._entries = entries || null;
@@ -50,7 +51,17 @@
if (payload.entries)
payload.entries = payload.entries.map(function(entry) { return WebInspector.CollectionEntryPreview.fromPayload(entry); });
- return new WebInspector.ObjectPreview(payload.type, payload.subtype, payload.description, payload.lossless, payload.overflow, payload.properties, payload.entries);
+ if (payload.subtype === "array") {
+ // COMPATIBILITY (iOS 8): Runtime.ObjectPreview did not have size property,
+ // instead it was tacked onto the end of the description, like "Array[#]".
+ var match = payload.description.match(/\[(\d+)\]$/);
+ if (match) {
+ payload.size = parseInt(match[1]);
+ payload.description = payload.description.replace(/\[\d+\]$/, "");
+ }
+ }
+
+ return new WebInspector.ObjectPreview(payload.type, payload.subtype, payload.description, payload.lossless, payload.overflow, payload.properties, payload.entries, payload.size);
};
WebInspector.ObjectPreview.prototype = {
@@ -92,5 +103,15 @@
get collectionEntryPreviews()
{
return this._entries;
+ },
+
+ get size()
+ {
+ return this._size;
+ },
+
+ hasSize: function()
+ {
+ return this._size !== undefined && (this._subtype === "array" || this._subtype === "set" || this._subtype === "map" || this._subtype === "weakmap");
}
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js (181060 => 181061)
--- trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js 2015-03-05 02:19:14 UTC (rev 181060)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js 2015-03-05 02:27:23 UTC (rev 181061)
@@ -28,7 +28,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.RemoteObject = function(objectId, type, subtype, value, description, preview)
+WebInspector.RemoteObject = function(objectId, type, subtype, value, description, size, preview)
{
// No superclass.
@@ -47,6 +47,7 @@
this._objectId = objectId;
this._description = description;
this._hasChildren = type !== "symbol";
+ this._size = size;
this._preview = preview;
} else {
// Primitive or null.
@@ -61,13 +62,23 @@
WebInspector.RemoteObject.fromPrimitiveValue = function(value)
{
- return new WebInspector.RemoteObject(undefined, typeof value, undefined, value);
+ return new WebInspector.RemoteObject(undefined, typeof value, undefined, undefined, value);
};
WebInspector.RemoteObject.fromPayload = function(payload)
{
console.assert(typeof payload === "object", "Remote object payload should only be an object");
+ if (payload.subtype === "array") {
+ // COMPATIBILITY (iOS 8): Runtime.RemoteObject did not have size property,
+ // instead it was tacked onto the end of the description, like "Array[#]".
+ var match = payload.description.match(/\[(\d+)\]$/);
+ if (match) {
+ payload.size = parseInt(match[1]);
+ payload.description = payload.description.replace(/\[\d+\]$/, "");
+ }
+ }
+
if (payload.preview) {
// COMPATIBILITY (iOS 8): iOS 7 and 8 did not have type/subtype/description on
// Runtime.ObjectPreview. Copy them over from the RemoteObject.
@@ -75,11 +86,12 @@
payload.preview.type = payload.type;
payload.preview.subtype = payload.subtype;
payload.preview.description = payload.description;
+ payload.preview.size = payload.size;
}
payload.preview = WebInspector.ObjectPreview.fromPayload(payload.preview);
}
- return new WebInspector.RemoteObject(payload.objectId, payload.type, payload.subtype, payload.value, payload.description, payload.preview);
+ return new WebInspector.RemoteObject(payload.objectId, payload.type, payload.subtype, payload.value, payload.description, payload.size, payload.preview);
};
WebInspector.RemoteObject.createCallArgument = function(valueOrObject)
@@ -151,11 +163,21 @@
return this._value;
},
+ get size()
+ {
+ return this._size || 0;
+ },
+
get preview()
{
return this._preview;
},
+ hasSize: function()
+ {
+ return this.isArray() || this.isCollectionType();
+ },
+
hasValue: function()
{
return "_value" in this;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.css (181060 => 181061)
--- trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.css 2015-03-05 02:19:14 UTC (rev 181060)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.css 2015-03-05 02:27:23 UTC (rev 181061)
@@ -30,6 +30,11 @@
color: black;
}
+:matches(.formatted-array, .formatted-map, .formatted-set, .formatted-weakmap) > .size {
+ font-style: normal;
+ color: hsl(0, 0%, 67%);
+}
+
.formatted-node > ol {
display: block !important;
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.js (181060 => 181061)
--- trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.js 2015-03-05 02:19:14 UTC (rev 181060)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.js 2015-03-05 02:27:23 UTC (rev 181061)
@@ -69,7 +69,7 @@
return span;
};
-WebInspector.FormattedValue.createElementForTypesAndValue = function(type, subtype, displayString, isPreview, hadException)
+WebInspector.FormattedValue.createElementForTypesAndValue = function(type, subtype, displayString, size, isPreview, hadException)
{
var span = document.createElement("span");
span.classList.add(WebInspector.FormattedValue.classNameForTypes(type, subtype));
@@ -94,22 +94,30 @@
// Everything else, the description/value string.
span.textContent = displayString;
+
+ // If there is a size, include it.
+ if (size !== undefined && (subtype === "array" || subtype === "set" || subtype === "map" || subtype === "weakmap")) {
+ var sizeElement = span.appendChild(document.createElement("span"));
+ sizeElement.className = "size";
+ sizeElement.textContent = " (" + size + ")";
+ }
+
return span;
};
WebInspector.FormattedValue.createElementForRemoteObject = function(object, hadException)
{
- return WebInspector.FormattedValue.createElementForTypesAndValue(object.type, object.subtype, object.description, false, hadException);
+ return WebInspector.FormattedValue.createElementForTypesAndValue(object.type, object.subtype, object.description, object.size, false, hadException);
};
WebInspector.FormattedValue.createElementForObjectPreview = function(objectPreview)
{
- return WebInspector.FormattedValue.createElementForTypesAndValue(objectPreview.type, objectPreview.subtype, objectPreview.description, true, false);
+ return WebInspector.FormattedValue.createElementForTypesAndValue(objectPreview.type, objectPreview.subtype, objectPreview.description, objectPreview.size, true, false);
};
WebInspector.FormattedValue.createElementForPropertyPreview = function(propertyPreview)
{
- return WebInspector.FormattedValue.createElementForTypesAndValue(propertyPreview.type, propertyPreview.subtype, propertyPreview.value, true, false);
+ return WebInspector.FormattedValue.createElementForTypesAndValue(propertyPreview.type, propertyPreview.subtype, propertyPreview.value, undefined, true, false);
};
WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject = function(object, propertyPath)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.css (181060 => 181061)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.css 2015-03-05 02:19:14 UTC (rev 181060)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.css 2015-03-05 02:27:23 UTC (rev 181061)
@@ -38,3 +38,8 @@
.object-preview .name {
color: rgb(136, 19, 145);
}
+
+.object-preview > .size {
+ font-style: normal;
+ color: hsl(0, 0%, 67%);
+}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js (181060 => 181061)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js 2015-03-05 02:19:14 UTC (rev 181060)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js 2015-03-05 02:27:23 UTC (rev 181061)
@@ -44,6 +44,12 @@
this._titleElement.hidden = true;
this._initTitleElement();
+ if (this._preview.hasSize()) {
+ var sizeElement = this._element.appendChild(document.createElement("span"));
+ sizeElement.className = "size";
+ sizeElement.textContent = " (" + this._preview.size + ")";
+ }
+
if (this._lossless)
this._element.classList.add("lossless");
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js (181060 => 181061)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js 2015-03-05 02:19:14 UTC (rev 181060)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js 2015-03-05 02:27:23 UTC (rev 181061)
@@ -375,7 +375,7 @@
if (value.subtype === "regexp")
return "RegExp";
- return value.description.replace(/\[\d+\]$/, "").replace(/Prototype$/, "");
+ return value.description.replace(/Prototype$/, "");
},
_propertyPathString: function(propertyPath)
_______________________________________________ webkit-changes mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-changes
