Title: [116959] trunk/Source/WebCore
Revision
116959
Author
[email protected]
Date
2012-05-14 10:12:11 -0700 (Mon, 14 May 2012)

Log Message

Web Inspector: do not update $0-$4 console variables for the objects from loaded from file heap snapshot.
https://bugs.webkit.org/show_bug.cgi?id=86371

When the user selects an object in HeapSnapshot we are updating $0 variable in console API.
But if the snapshot was loaded from file then we can't map object id for the selected obect
from the snapshot to the live objects in the inspected page.

Reviewed by Yury Semikhatsky.

* inspector/front-end/HeapSnapshotView.js:
(WebInspector.HeapSnapshotView.prototype._inspectedObjectChanged):
(WebInspector.HeapSnapshotView.prototype._updateFilterOptions):
(WebInspector.HeapProfileHeader):
(WebInspector.HeapProfileHeader.prototype.canSaveToFile):
(WebInspector.HeapProfileHeader.prototype.saveToFile):
* inspector/front-end/ProfilesPanel.js:
(WebInspector.ProfileHeader):
(WebInspector.ProfileHeader.prototype.loadFromFile):
(WebInspector.ProfileHeader.prototype.fromFile):
(WebInspector.ProfilesPanel.prototype._loadFromFile):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (116958 => 116959)


--- trunk/Source/WebCore/ChangeLog	2012-05-14 16:44:19 UTC (rev 116958)
+++ trunk/Source/WebCore/ChangeLog	2012-05-14 17:12:11 UTC (rev 116959)
@@ -1,3 +1,26 @@
+2012-05-14  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: do not update $0-$4 console variables for the objects from loaded from file heap snapshot.
+        https://bugs.webkit.org/show_bug.cgi?id=86371
+
+        When the user selects an object in HeapSnapshot we are updating $0 variable in console API.
+        But if the snapshot was loaded from file then we can't map object id for the selected obect
+        from the snapshot to the live objects in the inspected page.
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/front-end/HeapSnapshotView.js:
+        (WebInspector.HeapSnapshotView.prototype._inspectedObjectChanged):
+        (WebInspector.HeapSnapshotView.prototype._updateFilterOptions):
+        (WebInspector.HeapProfileHeader):
+        (WebInspector.HeapProfileHeader.prototype.canSaveToFile):
+        (WebInspector.HeapProfileHeader.prototype.saveToFile):
+        * inspector/front-end/ProfilesPanel.js:
+        (WebInspector.ProfileHeader):
+        (WebInspector.ProfileHeader.prototype.loadFromFile):
+        (WebInspector.ProfileHeader.prototype.fromFile):
+        (WebInspector.ProfilesPanel.prototype._loadFromFile):
+
 2012-05-14  Andrey Kosyakov  <[email protected]>
 
         Web Inspector: [Extensions API] allow extensions to evaluate in the context of their content scripts

Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js (116958 => 116959)


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js	2012-05-14 16:44:19 UTC (rev 116958)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js	2012-05-14 17:12:11 UTC (rev 116959)
@@ -452,7 +452,7 @@
     _inspectedObjectChanged: function(event)
     {
         var selectedNode = event.target.selectedNode;
-        if (selectedNode instanceof WebInspector.HeapSnapshotGenericObjectNode)
+        if (!this.profile.fromFile() && selectedNode instanceof WebInspector.HeapSnapshotGenericObjectNode)
             ConsoleAgent.addInspectedHeapObject(selectedNode.snapshotNodeId);
     },
 
@@ -559,6 +559,8 @@
 
     _resolveObjectForPopover: function(element, showCallback, objectGroupName)
     {
+        if (this.profile.fromFile())
+            return;
         element.node.queryObjectContent(showCallback, objectGroupName);
     },
 
@@ -688,7 +690,7 @@
             this.filterSelectElement.appendChild(filterOption);
         }
 
-        if (this.profile._fromFile)
+        if (this.profile.fromFile())
             return;
         for (var i = this.filterSelectElement.length - 1, n = list.length; i < n; ++i) {
             var profile = ""
@@ -793,7 +795,6 @@
     WebInspector.ProfileHeader.call(this, WebInspector.HeapSnapshotProfileType.TypeId, title, uid);
     this.maxJSObjectId = maxJSObjectId;
     this._loaded = false;
-    this._fromFile = false;
     this._totalNumberOfChunks = 0;
 }
 
@@ -884,7 +885,7 @@
      */
     canSaveToFile: function()
     {
-        return !this._fromFile && this._loaded && !this._savedChunksCount && WebInspector.fileManager.canAppend();
+        return !this.fromFile() && this._loaded && !this._savedChunksCount && WebInspector.fileManager.canAppend();
     },
 
     /**
@@ -907,7 +908,7 @@
             ProfilerAgent.getProfile(this.typeId, this.uid);
         }
 
-        this._fileName = this._fileName || "Heap-" + new Date().toISO8601Compact() + ".json";
+        this._fileName = this._fileName || "Heap-" + new Date().toISO8601Compact() + ".heapsnapshot";
         WebInspector.fileManager.addEventListener(WebInspector.FileManager.EventTypes.SavedURL, startSavingSnapshot, this);
         WebInspector.fileManager.save(this._fileName, "", true);
     },
@@ -942,7 +943,6 @@
             }
         }
 
-        this._fromFile = true;
         this.title = file.name;
         this.sidebarElement.subtitle = WebInspector.UIString("Loading\u2026");
         this.sidebarElement.wait = true;

Modified: trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js (116958 => 116959)


--- trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js	2012-05-14 16:44:19 UTC (rev 116958)
+++ trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js	2012-05-14 17:12:11 UTC (rev 116959)
@@ -139,6 +139,7 @@
         this.uid = uid;
         this.isTemporary = false;
     }
+    this._fromFile = false;
 }
 
 WebInspector.ProfileHeader.prototype = {
@@ -162,7 +163,12 @@
     /**
      * @param {File} file
      */
-    loadFromFile: function(file) { throw new Error("Needs implemented"); }
+    loadFromFile: function(file) { throw new Error("Needs implemented"); },
+
+    /**
+     * @return {boolean}
+     */
+    fromFile: function() { return this._fromFile; }
 }
 
 /**
@@ -269,6 +275,7 @@
         var temporaryProfile = profileType.createTemporaryProfile(UserInitiatedProfileName + "." + file.name);
         this.addProfileHeader(temporaryProfile);
 
+        temporaryProfile._fromFile = true;
         temporaryProfile.loadFromFile(file);
         this._createFileSelectorElement();
     },
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to