Diff
Modified: trunk/LayoutTests/ChangeLog (200424 => 200425)
--- trunk/LayoutTests/ChangeLog 2016-05-04 19:51:16 UTC (rev 200424)
+++ trunk/LayoutTests/ChangeLog 2016-05-04 20:00:21 UTC (rev 200425)
@@ -1,3 +1,14 @@
+2016-05-04 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: GC Root Path sometimes does not go up to Window
+ https://bugs.webkit.org/show_bug.cgi?id=156768
+ <rdar://problem/25816131>
+
+ Reviewed by Geoffrey Garen.
+
+ * inspector/unit-tests/heap-snapshot-expected.txt:
+ * inspector/unit-tests/heap-snapshot.html:
+
2016-05-04 Ryan Haddad <[email protected]>
Rebaseline inspector/model/remote-object.html after r200422
Modified: trunk/LayoutTests/inspector/unit-tests/heap-snapshot-expected.txt (200424 => 200425)
--- trunk/LayoutTests/inspector/unit-tests/heap-snapshot-expected.txt 2016-05-04 19:51:16 UTC (rev 200424)
+++ trunk/LayoutTests/inspector/unit-tests/heap-snapshot-expected.txt 2016-05-04 20:00:21 UTC (rev 200425)
@@ -39,5 +39,6 @@
-- Running test case: HeapSnapshotNodeProxy.prototype.retainers
PASS: Number of retainer nodes should match.
+PASS: Number of edges should match the number of nodes.
PASS: Node values should match.
Modified: trunk/LayoutTests/inspector/unit-tests/heap-snapshot.html (200424 => 200425)
--- trunk/LayoutTests/inspector/unit-tests/heap-snapshot.html 2016-05-04 19:51:16 UTC (rev 200424)
+++ trunk/LayoutTests/inspector/unit-tests/heap-snapshot.html 2016-05-04 20:00:21 UTC (rev 200425)
@@ -246,10 +246,11 @@
let expectedNodes = testSnapshotNodeForWindowObject.incomingEdges.map((edge) => edge.from);
expectedNodes.sort((a, b) => a.id - b.id);
- snapshotNodeForWindowObject.retainers((nodes) => {
+ snapshotNodeForWindowObject.retainers((nodes, edges) => {
nodes.sort((a, b) => a.id - b.id);
InspectorTest.assert(nodes.length > 0, "Test only makes since if there are retainer nodes");
InspectorTest.expectThat(nodes.length === expectedNodes.length, "Number of retainer nodes should match.");
+ InspectorTest.expectThat(nodes.length === edges.length, "Number of edges should match the number of nodes.");
InspectorTest.expectThat(nodes.every((node, i) => compareNodes(node, expectedNodes[i])), "Node values should match.");
resolve();
});
Modified: trunk/Source/WebInspectorUI/ChangeLog (200424 => 200425)
--- trunk/Source/WebInspectorUI/ChangeLog 2016-05-04 19:51:16 UTC (rev 200424)
+++ trunk/Source/WebInspectorUI/ChangeLog 2016-05-04 20:00:21 UTC (rev 200425)
@@ -1,3 +1,24 @@
+2016-05-04 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: GC Root Path sometimes does not go up to Window
+ https://bugs.webkit.org/show_bug.cgi?id=156768
+ <rdar://problem/25816131>
+
+ Reviewed by Geoffrey Garen.
+
+ * UserInterface/Proxies/HeapSnapshotNodeProxy.js:
+ (WebInspector.HeapSnapshotNodeProxy.prototype.retainers):
+ Include paths for debugging.
+
+ * UserInterface/Workers/HeapSnapshot/HeapSnapshot.js:
+ (HeapSnapshot.prototype.shortestGCRootPath):
+ (HeapSnapshot.prototype._isNodeGlobalObject):
+ Prefer the shortest GC Root Path that contains a known
+ global object, otherwise fallback to the shortest.
+
+ (HeapSnapshot.prototype.retainers):
+ Include paths for debugging.
+
2016-05-03 Nikita Vasilyev <[email protected]>
Web Inspector: Adding a new console message shouldn't modify DOM when the console log is hidden
Modified: trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotNodeProxy.js (200424 => 200425)
--- trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotNodeProxy.js 2016-05-04 19:51:16 UTC (rev 200424)
+++ trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotNodeProxy.js 2016-05-04 20:00:21 UTC (rev 200425)
@@ -89,8 +89,10 @@
retainers(callback)
{
- WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "retainers", this.id, (serializedNodes) => {
- callback(serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null, this._proxyObjectId)));
+ WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "retainers", this.id, ({retainers: serializedNodes, edges: serializedEdges}) => {
+ let deserializedNodes = serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null, this._proxyObjectId));
+ let deserializedEdges = serializedEdges.map(WebInspector.HeapSnapshotEdgeProxy.deserialize.bind(null, this._proxyObjectId));
+ callback(deserializedNodes, deserializedEdges);
});
}
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshot.js (200424 => 200425)
--- trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshot.js 2016-05-04 19:51:16 UTC (rev 200424)
+++ trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshot.js 2016-05-04 20:00:21 UTC (rev 200425)
@@ -238,7 +238,7 @@
shortestGCRootPath(nodeIdentifier)
{
// Returns an array from this node to a gcRoot node.
- // E.g. [Node, Edge, Node, Edge, Node].
+ // E.g. [Node (target), Edge, Node, Edge, Node (root)].
// Internal nodes are avoided, so if the path is empty this
// node is either a gcRoot or only reachable via Internal nodes.
@@ -247,8 +247,17 @@
return [];
paths.sort((a, b) => a.length - b.length);
- let shortestPath = paths[0];
+ let shortestPathWithGlobalObject = null;
+ for (let path of paths) {
+ let lastNodeIndex = path[path.length - 1].node;
+ if (this._isNodeGlobalObject(lastNodeIndex)) {
+ shortestPathWithGlobalObject = path;
+ break;
+ }
+ }
+
+ let shortestPath = shortestPathWithGlobalObject || paths[0];
console.assert("node" in shortestPath[0], "Path should start with a node");
console.assert("node" in shortestPath[shortestPath.length - 1], "Path should end with a node");
@@ -296,6 +305,7 @@
retainers(nodeIdentifier)
{
let retainers = [];
+ let edges = [];
let nodeOrdinal = this._nodeIdentifierToOrdinal.get(nodeIdentifier);
let incomingEdgeIndex = this._nodeOrdinalToFirstIncomingEdge[nodeOrdinal];
@@ -304,9 +314,13 @@
let fromNodeOrdinal = this._incomingNodes[edgeIndex];
let fromNodeIndex = fromNodeOrdinal * nodeFieldCount;
retainers.push(fromNodeIndex);
+ edges.push(this._incomingEdges[edgeIndex]);
}
- return retainers.map(this.serializeNode, this);
+ return {
+ retainers: retainers.map(this.serializeNode, this),
+ edges: edges.map(this.serializeEdge, this),
+ };
}
// Public
@@ -410,7 +424,7 @@
let count = this._nodeOrdinalToFirstIncomingEdge[nodeOrdinal];
this._nodeOrdinalToFirstIncomingEdge[nodeOrdinal] = runningFirstIndex;
this._incomingNodes[runningFirstIndex] = count;
- runningFirstIndex += count;
+ runningFirstIndex += count;
}
// Fill in the incoming edges list. Use the count as an offset when placing edges in the list.
@@ -518,7 +532,7 @@
dominators.fill(noEntry);
// Mark the root's dominator value.
- dominators[rootPostOrderIndex] = rootPostOrderIndex;
+ dominators[rootPostOrderIndex] = rootPostOrderIndex;
// Affect the root's children. Also use this opportunity to mark them as GC roots.
let rootEdgeIndex = this._nodeOrdinalToFirstOutgoingEdge[rootNodeOrdinal];
@@ -605,6 +619,14 @@
}
}
+ _isNodeGlobalObject(nodeIndex)
+ {
+ let className = this._nodeClassNamesTable[this._nodes[nodeIndex + nodeClassNameOffset]];
+ return className === "Window"
+ || className === "JSDOMWindowShell"
+ || className === "GlobalObject";
+ }
+
_gcRootPathes(nodeIdentifier)
{
let targetNodeOrdinal = this._nodeIdentifierToOrdinal.get(nodeIdentifier);