Diff
Modified: branches/safari-601.1.46-branch/LayoutTests/ChangeLog (193452 => 193453)
--- branches/safari-601.1.46-branch/LayoutTests/ChangeLog 2015-12-04 20:53:33 UTC (rev 193452)
+++ branches/safari-601.1.46-branch/LayoutTests/ChangeLog 2015-12-04 20:53:40 UTC (rev 193453)
@@ -1,5 +1,20 @@
2015-12-04 Timothy Hatcher <timo...@apple.com>
+ Merge r188403. rdar://problem/23581597
+
+ 2015-08-13 Joseph Pecoraro <pecor...@apple.com>
+
+ Web Inspector: A {Map, WeakMap, Set, WeakSet} object contains itself will hang the console
+ https://bugs.webkit.org/show_bug.cgi?id=147966
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/model/remote-object.html:
+ * inspector/model/remote-object-expected.txt:
+ Add tests for a cylic array, set, and map.
+
+2015-12-04 Timothy Hatcher <timo...@apple.com>
+
Merge r187897. rdar://problem/23581597
2015-08-04 Joseph Pecoraro <pecor...@apple.com>
Modified: branches/safari-601.1.46-branch/LayoutTests/inspector/model/remote-object-expected.txt (193452 => 193453)
--- branches/safari-601.1.46-branch/LayoutTests/inspector/model/remote-object-expected.txt 2015-12-04 20:53:33 UTC (rev 193452)
+++ branches/safari-601.1.46-branch/LayoutTests/inspector/model/remote-object-expected.txt 2015-12-04 20:53:40 UTC (rev 193453)
@@ -843,6 +843,33 @@
}
-----------------------------------------------------
+_expression_: arr = []; arr[0] = arr; arr
+{
+ "_type": "object",
+ "_subtype": "array",
+ "_objectId": "<filtered>",
+ "_description": "Array",
+ "_size": 1,
+ "_preview": {
+ "_type": "object",
+ "_subtype": "array",
+ "_description": "Array",
+ "_lossless": false,
+ "_overflow": false,
+ "_size": 1,
+ "_properties": [
+ {
+ "_name": "0",
+ "_type": "object",
+ "_subtype": "array",
+ "_value": "Array"
+ }
+ ],
+ "_entries": null
+ }
+}
+
+-----------------------------------------------------
_expression_: arr = []; arr.length = 100; arr
{
"_type": "object",
@@ -2260,7 +2287,7 @@
"_type": "object",
"_subtype": "map",
"_description": "Map",
- "_lossless": true,
+ "_lossless": false,
"_overflow": false,
"_size": 2,
"_properties": [],
@@ -2469,6 +2496,49 @@
}
-----------------------------------------------------
+_expression_: map = new Map; map.set(map, map); map
+{
+ "_type": "object",
+ "_subtype": "map",
+ "_objectId": "<filtered>",
+ "_description": "Map",
+ "_size": 1,
+ "_preview": {
+ "_type": "object",
+ "_subtype": "map",
+ "_description": "Map",
+ "_lossless": false,
+ "_overflow": false,
+ "_size": 1,
+ "_properties": [],
+ "_entries": [
+ {
+ "_key": {
+ "_type": "object",
+ "_subtype": "map",
+ "_description": "Map",
+ "_lossless": false,
+ "_overflow": true,
+ "_size": 1,
+ "_properties": [],
+ "_entries": []
+ },
+ "_value": {
+ "_type": "object",
+ "_subtype": "map",
+ "_description": "Map",
+ "_lossless": false,
+ "_overflow": true,
+ "_size": 1,
+ "_properties": [],
+ "_entries": []
+ }
+ }
+ ]
+ }
+}
+
+-----------------------------------------------------
_expression_: map = new WeakMap; strongKey = {id:1}; map.set(strongKey, [1,2]); map
{
"_type": "object",
@@ -2609,7 +2679,7 @@
"_type": "object",
"_subtype": "set",
"_description": "Set",
- "_lossless": true,
+ "_lossless": false,
"_overflow": false,
"_size": 3,
"_properties": [],
@@ -2766,6 +2836,39 @@
}
-----------------------------------------------------
+_expression_: set = new Set; set.add(set); set
+{
+ "_type": "object",
+ "_subtype": "set",
+ "_objectId": "<filtered>",
+ "_description": "Set",
+ "_size": 1,
+ "_preview": {
+ "_type": "object",
+ "_subtype": "set",
+ "_description": "Set",
+ "_lossless": false,
+ "_overflow": false,
+ "_size": 1,
+ "_properties": [],
+ "_entries": [
+ {
+ "_value": {
+ "_type": "object",
+ "_subtype": "set",
+ "_description": "Set",
+ "_lossless": false,
+ "_overflow": true,
+ "_size": 1,
+ "_properties": [],
+ "_entries": []
+ }
+ }
+ ]
+ }
+}
+
+-----------------------------------------------------
_expression_: set = new WeakSet; strongKey = {id:1}; set.add(strongKey); set
{
"_type": "object",
Modified: branches/safari-601.1.46-branch/LayoutTests/inspector/model/remote-object.html (193452 => 193453)
--- branches/safari-601.1.46-branch/LayoutTests/inspector/model/remote-object.html 2015-12-04 20:53:33 UTC (rev 193452)
+++ branches/safari-601.1.46-branch/LayoutTests/inspector/model/remote-object.html 2015-12-04 20:53:40 UTC (rev 193453)
@@ -79,6 +79,7 @@
{_expression_: "[[undefined]]"},
{_expression_: "[{a:1}, {b:2}, {c:2}]"},
{_expression_: "[[{a:1}, {b:2}, {c:2}]]"},
+ {_expression_: "arr = []; arr[0] = arr; arr"}, // cyclic
{_expression_: "arr = []; arr.length = 100; arr"}, // 100 empty elements
{_expression_: "arr = []; arr.length = 100; arr.fill(1)"}, // 100 full elements
{_expression_: "arr = []; arr.length = 100; arr[10] = 1; arr"}, // sparse
@@ -94,7 +95,7 @@
{_expression_: "({a: 1})"},
{_expression_: "({a: 1, b: 0, c: -0})"},
{_expression_: "({a: 1, b: \"string\", c: /regex/, d: Symbol('sym')})"},
- {_expression_: "o = {a:1}; o.b = o; o"}, // Cyclic.
+ {_expression_: "o = {a:1}; o.b = o; o"}, // cyclic
{_expression_: "({a:function a(){}, b:function b(){}, get getter(){}, set setter(v){}})"},
{_expression_: "function Foo() {}; new Foo"},
{_expression_: "var Foo2 = function() {}; new Foo2"},
@@ -132,6 +133,7 @@
{_expression_: "map = new Map; map.set(1, 2); map.set('key', 'value'); map"},
{_expression_: "map = new Map; map.set({a:1}, {b:2}); map.set(document.body, [1,2]); map"},
{_expression_: "map = new Map; for (var i = 0; i <= 100; i++) map.set(i, i); map"},
+ {_expression_: "map = new Map; map.set(map, map); map"},
{_expression_: "map = new WeakMap; strongKey = {id:1}; map.set(strongKey, [1,2]); map"},
// Set / WeakSet
@@ -139,6 +141,7 @@
{_expression_: "set = new Set; set.add(1); set.add(2); set.add('key'); set"},
{_expression_: "set = new Set; set.add({a:1}); set.add(document.body); set.add([1,2]); set"},
{_expression_: "set = new Set; for (var i = 0; i <= 100; i++) set.add(i); set"},
+ {_expression_: "set = new Set; set.add(set); set"},
{_expression_: "set = new WeakSet; strongKey = {id:1}; set.add(strongKey); set"},
// Iterators
Modified: branches/safari-601.1.46-branch/Source/_javascript_Core/ChangeLog (193452 => 193453)
--- branches/safari-601.1.46-branch/Source/_javascript_Core/ChangeLog 2015-12-04 20:53:33 UTC (rev 193452)
+++ branches/safari-601.1.46-branch/Source/_javascript_Core/ChangeLog 2015-12-04 20:53:40 UTC (rev 193453)
@@ -1,5 +1,35 @@
2015-12-04 Timothy Hatcher <timo...@apple.com>
+ Merge r188403. rdar://problem/23581597
+
+ 2015-08-13 Joseph Pecoraro <pecor...@apple.com>
+
+ Web Inspector: A {Map, WeakMap, Set, WeakSet} object contains itself will hang the console
+ https://bugs.webkit.org/show_bug.cgi?id=147966
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/InjectedScriptSource.js:
+ (InjectedScript.prototype._initialPreview):
+ Renamed to initial preview. This is not a complete preview for
+ this object, and it needs some processing in order to be a
+ complete accurate preview.
+
+ (InjectedScript.RemoteObject.prototype._emptyPreview):
+ This attempts to be an accurate empty preview for the given object.
+ For types with entries, it adds an empty entries list and updates
+ the overflow and lossless properties.
+
+ (InjectedScript.RemoteObject.prototype._createObjectPreviewForValue):
+ Take a generatePreview parameter to generate a full preview or empty preview.
+
+ (InjectedScript.RemoteObject.prototype._appendPropertyPreviews):
+ (InjectedScript.RemoteObject.prototype._appendEntryPreviews):
+ (InjectedScript.RemoteObject.prototype._isPreviewableObject):
+ Take care to avoid cycles.
+
+2015-12-04 Timothy Hatcher <timo...@apple.com>
+
Merge r187897. rdar://problem/23581597
2015-08-04 Joseph Pecoraro <pecor...@apple.com>
Modified: branches/safari-601.1.46-branch/Source/_javascript_Core/inspector/InjectedScriptSource.js (193452 => 193453)
--- branches/safari-601.1.46-branch/Source/_javascript_Core/inspector/InjectedScriptSource.js 2015-12-04 20:53:33 UTC (rev 193452)
+++ branches/safari-601.1.46-branch/Source/_javascript_Core/inspector/InjectedScriptSource.js 2015-12-04 20:53:40 UTC (rev 193453)
@@ -1018,7 +1018,7 @@
}
InjectedScript.RemoteObject.prototype = {
- _emptyPreview: function()
+ _initialPreview: function()
{
var preview = {
type: this.type,
@@ -1040,9 +1040,24 @@
return preview;
},
- _createObjectPreviewForValue: function(value)
+ _emptyPreview: function()
{
- var remoteObject = new InjectedScript.RemoteObject(value, undefined, false, true, undefined);
+ var preview = this._initialPreview();
+
+ if (this.subtype === "map" || this.subtype === "set" || this.subtype === "weakmap" || this.subtype === "weakset" || this.subtype === "iterator") {
+ if (this.size) {
+ preview.entries = [];
+ preview.lossless = false;
+ preview.overflow = true;
+ }
+ }
+
+ return preview;
+ },
+
+ _createObjectPreviewForValue: function(value, generatePreview)
+ {
+ var remoteObject = new InjectedScript.RemoteObject(value, undefined, false, generatePreview, undefined);
if (remoteObject.objectId)
injectedScript.releaseObject(remoteObject.objectId);
if (remoteObject.classPrototype && remoteObject.classPrototype.objectId)
@@ -1053,7 +1068,7 @@
_generatePreview: function(object, firstLevelKeys, secondLevelKeys)
{
- var preview = this._emptyPreview();
+ var preview = this._initialPreview();
// Primitives just have a value.
if (this.type !== "object")
@@ -1077,7 +1092,7 @@
// Internal Properties.
var internalPropertyDescriptors = injectedScript._internalPropertyDescriptors(object, true);
if (internalPropertyDescriptors) {
- this._appendPropertyPreviews(preview, internalPropertyDescriptors, true, propertiesThreshold, firstLevelKeys, secondLevelKeys);
+ this._appendPropertyPreviews(object, preview, internalPropertyDescriptors, true, propertiesThreshold, firstLevelKeys, secondLevelKeys);
if (propertiesThreshold.indexes < 0 || propertiesThreshold.properties < 0)
return preview;
}
@@ -1087,7 +1102,7 @@
// Properties.
var descriptors = injectedScript._propertyDescriptors(object, InjectedScript.CollectionMode.AllProperties);
- this._appendPropertyPreviews(preview, descriptors, false, propertiesThreshold, firstLevelKeys, secondLevelKeys);
+ this._appendPropertyPreviews(object, preview, descriptors, false, propertiesThreshold, firstLevelKeys, secondLevelKeys);
if (propertiesThreshold.indexes < 0 || propertiesThreshold.properties < 0)
return preview;
} catch (e) {
@@ -1097,7 +1112,7 @@
return preview;
},
- _appendPropertyPreviews: function(preview, descriptors, internal, propertiesThreshold, firstLevelKeys, secondLevelKeys)
+ _appendPropertyPreviews: function(object, preview, descriptors, internal, propertiesThreshold, firstLevelKeys, secondLevelKeys)
{
for (var descriptor of descriptors) {
// Seen enough.
@@ -1180,9 +1195,9 @@
property.subtype = subtype;
// Second level.
- if ((secondLevelKeys === null || secondLevelKeys) || this._isPreviewableObject(value)) {
+ if ((secondLevelKeys === null || secondLevelKeys) || this._isPreviewableObject(value, object)) {
// FIXME: If we want secondLevelKeys filter to continue we would need some refactoring.
- var subPreview = this._createObjectPreviewForValue(value);
+ var subPreview = this._createObjectPreviewForValue(value, value !== object);
property.valuePreview = subPreview;
if (!subPreview.lossless)
preview.lossless = false;
@@ -1240,17 +1255,25 @@
preview.lossless = false;
}
+ function updateMainPreview(subPreview) {
+ if (!subPreview.lossless)
+ preview.lossless = false;
+ }
+
preview.entries = entries.map(function(entry) {
- entry.value = this._createObjectPreviewForValue(entry.value);
- if ("key" in entry)
- entry.key = this._createObjectPreviewForValue(entry.key);
+ entry.value = this._createObjectPreviewForValue(entry.value, entry.value !== object);
+ updateMainPreview(entry.value);
+ if ("key" in entry) {
+ entry.key = this._createObjectPreviewForValue(entry.key, entry.key !== object);
+ updateMainPreview(entry.key);
+ }
return entry;
}, this);
},
- _isPreviewableObject: function(object)
+ _isPreviewableObject: function(value, object)
{
- return this._isPreviewableObjectInternal(object, new Set, 1);
+ return this._isPreviewableObjectInternal(value, new Set([object]), 1);
},
_isPreviewableObjectInternal: function(object, knownObjects, depth)
Modified: branches/safari-601.1.46-branch/Source/WebInspectorUI/ChangeLog (193452 => 193453)
--- branches/safari-601.1.46-branch/Source/WebInspectorUI/ChangeLog 2015-12-04 20:53:33 UTC (rev 193452)
+++ branches/safari-601.1.46-branch/Source/WebInspectorUI/ChangeLog 2015-12-04 20:53:40 UTC (rev 193453)
@@ -1,3 +1,20 @@
+2015-12-04 Timothy Hatcher <timo...@apple.com>
+
+ Merge r188403. rdar://problem/23581597
+
+ 2015-08-13 Joseph Pecoraro <pecor...@apple.com>
+
+ Web Inspector: A {Map, WeakMap, Set, WeakSet} object contains itself will hang the console
+ https://bugs.webkit.org/show_bug.cgi?id=147966
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Views/ObjectPreviewView.js:
+ (WebInspector.ObjectPreviewView.prototype._appendEntryPreviews):
+ (WebInspector.ObjectPreviewView.prototype._appendPropertyPreviews):
+ For empty overflow previews, don't show ", ..." if we didn't show any
+ values; just show "..." in these cases.
+
2015-12-02 Timothy Hatcher <timo...@apple.com>
Merge r191967. rdar://problem/23221163
Modified: branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js (193452 => 193453)
--- branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js 2015-12-04 20:53:33 UTC (rev 193452)
+++ branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js 2015-12-04 20:53:40 UTC (rev 193453)
@@ -177,10 +177,14 @@
overflow = true;
}
- if (overflow)
- element.appendChild(document.createTextNode(", \u2026"));
- element.appendChild(document.createTextNode(isIterator ? "]" : "}"));
+ if (overflow) {
+ if (limit > 0)
+ element.append(", ");
+ element.append("\u2026");
+ }
+ element.append(isIterator ? "]" : "}");
+
return lossless;
}
@@ -238,10 +242,14 @@
overflow = true;
}
- if (overflow)
- element.appendChild(document.createTextNode(", \u2026"));
- element.appendChild(document.createTextNode(isArray ? "]" : "}"));
+ if (overflow) {
+ if (limit > 0)
+ element.append(", ");
+ element.append("\u2026");
+ }
+ element.append(isArray ? "]" : "}");
+
return lossless;
}