Web Inspector: Heap: logging an object from a snapshot shouldn't use the "special...
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Apr 2019 18:47:38 +0000 (18:47 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Apr 2019 18:47:38 +0000 (18:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196889
<rdar://problem/49870693>

Reviewed by Joseph Pecoraro.

* UserInterface/Views/HeapSnapshotInstanceDataGridNode.js:
(WI.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244275 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstanceDataGridNode.js

index 926a85c..31306c8 100644 (file)
@@ -1,5 +1,16 @@
 2019-04-15  Devin Rousso  <drousso@apple.com>
 
+        Web Inspector: Heap: logging an object from a snapshot shouldn't use the "special" style if the object is reachable
+        https://bugs.webkit.org/show_bug.cgi?id=196889
+        <rdar://problem/49870693>
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Views/HeapSnapshotInstanceDataGridNode.js:
+        (WI.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode):
+
+2019-04-15  Devin Rousso  <drousso@apple.com>
+
         Web Inspector: Debugger: deleting a special breakpoint should disable it
         https://bugs.webkit.org/show_bug.cgi?id=196737
         <rdar://problem/49740680>
index 3248826..54846f5 100644 (file)
@@ -52,11 +52,10 @@ WI.HeapSnapshotInstanceDataGridNode = class HeapSnapshotInstanceDataGridNode ext
 
     static logHeapSnapshotNode(node)
     {
-        let heapObjectIdentifier = node.id;
-        let shouldRevealConsole = true;
-        let text = WI.UIString("Heap Snapshot Object (%s)").format("@" + heapObjectIdentifier);
-
         node.shortestGCRootPath((gcRootPath) => {
+            let text = WI.UIString("Heap Snapshot Object (%s)").format("@" + node.id);
+            let addSpecialUserLogClass = !gcRootPath.length;
+
             if (gcRootPath.length) {
                 gcRootPath = gcRootPath.slice().reverse();
                 let windowIndex = gcRootPath.findIndex((x) => {
@@ -73,19 +72,23 @@ WI.HeapSnapshotInstanceDataGridNode = class HeapSnapshotInstanceDataGridNode ext
                         heapSnapshotRootPath = heapSnapshotRootPath.appendEdge(component);
                 }
 
-                if (!heapSnapshotRootPath.isFullPathImpossible())
+                if (heapSnapshotRootPath.isFullPathImpossible())
+                    addSpecialUserLogClass = true;
+                else
                     text = heapSnapshotRootPath.fullPath;
             }
 
+            const shouldRevealConsole = true;
+
             if (node.className === "string") {
-                HeapAgent.getPreview(heapObjectIdentifier, function(error, string, functionDetails, objectPreviewPayload) {
+                HeapAgent.getPreview(node.id, function(error, string, functionDetails, objectPreviewPayload) {
                     let remoteObject = error ? WI.RemoteObject.fromPrimitiveValue(undefined) : WI.RemoteObject.fromPrimitiveValue(string);
-                    WI.consoleLogViewController.appendImmediateExecutionWithResult(text, remoteObject, shouldRevealConsole);
+                    WI.consoleLogViewController.appendImmediateExecutionWithResult(text, remoteObject, addSpecialUserLogClass, shouldRevealConsole);
                 });
             } else {
-                HeapAgent.getRemoteObject(heapObjectIdentifier, WI.RuntimeManager.ConsoleObjectGroup, function(error, remoteObjectPayload) {
+                HeapAgent.getRemoteObject(node.id, WI.RuntimeManager.ConsoleObjectGroup, function(error, remoteObjectPayload) {
                     let remoteObject = error ? WI.RemoteObject.fromPrimitiveValue(undefined) : WI.RemoteObject.fromPayload(remoteObjectPayload, WI.assumingMainTarget());
-                    WI.consoleLogViewController.appendImmediateExecutionWithResult(text, remoteObject, shouldRevealConsole);
+                    WI.consoleLogViewController.appendImmediateExecutionWithResult(text, remoteObject, addSpecialUserLogClass, shouldRevealConsole);
                 });
             }
         });