+2012-01-18 Ilya Tikhonovsky <loislo@chromium.org>
+
+ [chromium] Web Inspector: highlight DOM nodes from detached DOM trees.
+ https://bugs.webkit.org/show_bug.cgi?id=76545
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/front-end/DetailedHeapshotGridNodes.js:
+ (WebInspector.HeapSnapshotGenericObjectNode):
+ (WebInspector.HeapSnapshotGenericObjectNode.prototype.get data):
+ * inspector/front-end/HeapSnapshot.js:
+ (WebInspector.HeapSnapshotNode.prototype.get isNativeRoot):
+ (WebInspector.HeapSnapshotNode.prototype.get isDetachedDOMTree):
+ (WebInspector.HeapSnapshot.prototype._init):
+ (WebInspector.HeapSnapshot.prototype._markDetachedDOMTreeNodes):
+ (WebInspector.HeapSnapshot.prototype._markQueriableHeapObjects):
+ (WebInspector.HeapSnapshot.prototype._calculateFlags):
+ * inspector/front-end/heapProfiler.css:
+ (.detached-dom-tree-node):
+
2012-01-18 Pavel Feldman <pfeldman@google.com>
Web Inspector: there should be a way to set HTML for given frame.
this.hasHoverMessage = true;
} else if (node.flags & tree.snapshot.nodeFlags.canBeQueried)
this.hasHoverMessage = true;
+ if (node.flags & tree.snapshot.nodeFlags.detachedDOMTreeNode)
+ this.detachedDOMTreeNode = true;
};
WebInspector.HeapSnapshotGenericObjectNode.prototype = {
};
if (this.hasHoverMessage)
valueStyle += " highlight";
+ if (this.detachedDOMTreeNode)
+ valueStyle += " detached-dom-tree-node";
data["object"] = { valueStyle: valueStyle, value: value + " @" + this.snapshotNodeId };
var view = this.dataGrid.snapshotView;
return this.name.substr(0, 9) === "DOMWindow";
},
+ get isNativeRoot()
+ {
+ return this.name === "(Native objects)";
+ },
+
+ get isDetachedDOMTree()
+ {
+ return this.className === "Detached DOM tree";
+ },
+
get isRoot()
{
return this.nodeIndex === this._snapshot._rootNodeIndex;
this._edgeInvisibleType = this._edgeTypes.length;
this._edgeTypes.push("invisible");
- this._nodeFlags = { canBeQueried: 1 };
+ this._nodeFlags = { // bit flags
+ canBeQueried: 1,
+ detachedDOMTreeNode: 2,
+ };
this._markInvisibleEdges();
},
return a < b ? -1 : (a > b ? 1 : 0);
},
- _calculateFlags: function()
+ _markDetachedDOMTreeNodes: function()
+ {
+ var flag = this._nodeFlags.detachedDOMTreeNode;
+ var nativeRoot;
+ for (var iter = this.rootNode.edges; iter.hasNext(); iter.next()) {
+ var node = iter.edge.node;
+ if (node.isNativeRoot) {
+ nativeRoot = node;
+ break;
+ }
+ }
+
+ if (!nativeRoot)
+ return;
+
+ for (var iter = nativeRoot.edges; iter.hasNext(); iter.next()) {
+ var node = iter.edge.node;
+ if (node.isDetachedDOMTree) {
+ for (var edgesIter = node.edges; edgesIter.hasNext(); edgesIter.next())
+ this._flags[edgesIter.edge.node.nodeIndex] |= flag;
+ }
+ }
+ },
+
+ _markQueriableHeapObjects: function()
{
- var flag = this._nodeFlags.canBeQueried;
- this._flags = new Array(this.nodeCount);
// Allow runtime properties query for objects accessible from DOMWindow objects
// via regular properties, and for DOM wrappers. Trying to access random objects
// can cause a crash due to insonsistent state of internal properties of wrappers.
+ var flag = this._nodeFlags.canBeQueried;
+
var list = [];
for (var iter = this.rootNode.edges; iter.hasNext(); iter.next()) {
if (iter.edge.node.isDOMWindow)
while (list.length) {
var node = list.pop();
- if (this._flags[node.nodeIndex])
+ if (this._flags[node.nodeIndex] & flag)
continue;
- this._flags[node.nodeIndex] = flag;
+ this._flags[node.nodeIndex] |= flag;
for (var iter = node.edges; iter.hasNext(); iter.next()) {
var edge = iter.edge;
var node = edge.node;
}
},
+ _calculateFlags: function()
+ {
+ this._flags = new Array(this.nodeCount);
+ this._markDetachedDOMTreeNodes();
+ this._markQueriableHeapObjects();
+ },
+
baseSnapshotHasNode: function(baseSnapshotId, className, nodeId)
{
return this._baseNodeIds[baseSnapshotId][className].binaryIndexOf(nodeId, this._numbersComparator) !== -1;