<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[70989] trunk/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/70989">70989</a></dd>
<dt>Author</dt> <dd>pfeldman@chromium.org</dd>
<dt>Date</dt> <dd>2010-10-30 23:43:11 -0700 (Sat, 30 Oct 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>2010-10-30  Pavel Feldman  &lt;pfeldman@chromium.org&gt;

        Reviewed by Timothy Hatcher.

        Web Inspector: new resources and network panel usability improvements.
        https://bugs.webkit.org/show_bug.cgi?id=48680

        By default, navigation clears network log, added 'preserve log' button,
        that prevents log from being cleared.

        Storing expanded state of all group items, restoring last selected item,
        fall back to main frame's main resource by default.
        Do not list XHRs and redirects in resources.

        * English.lproj/localizedStrings.js:
        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::didLoadResourceFromMemoryCache):
        (WebCore::InspectorController::identifierForInitialRequest):
        * inspector/front-end/NetworkPanel.js:
        (WebInspector.NetworkPanel.prototype.get statusBarItems):
        (WebInspector.NetworkPanel.prototype._positionSummaryBar):
        (WebInspector.NetworkPanel.prototype._updateFilter):
        (WebInspector.NetworkPanel.prototype._createStatusbarButtons):
        (WebInspector.NetworkPanel.prototype._onPreserveLogClicked):
        (WebInspector.NetworkPanel.prototype.reset):
        (WebInspector.NetworkPanel.prototype.refreshResource):
        * inspector/front-end/ResourceManager.js:
        (WebInspector.ResourceManager.prototype.identifierForInitialRequest):
        (WebInspector.ResourceManager.prototype.willSendRequest):
        (WebInspector.ResourceManager.prototype.didLoadResourceFromMemoryCache):
        (WebInspector.ResourceManager.prototype.setOverrideContent):
        (WebInspector.ResourceManager.prototype.didCreateWebSocket):
        * inspector/front-end/StoragePanel.js:
        (WebInspector.StoragePanel):
        (WebInspector.StoragePanel.prototype.show):
        (WebInspector.StoragePanel.prototype._initDefaultSelection):
        (WebInspector.StoragePanel.prototype.reset):
        (WebInspector.StoragePanel.prototype.addResourceToFrame):
        (WebInspector.StoragePanel.prototype.refreshResource):
        (WebInspector.StoragePanel.prototype.showDatabase):
        (WebInspector.BaseStorageTreeElement.prototype.onselect):
        (WebInspector.StorageCategoryTreeElement):
        (WebInspector.StorageCategoryTreeElement.prototype.get itemURL):
        (WebInspector.StorageCategoryTreeElement.prototype.onselect):
        (WebInspector.StorageCategoryTreeElement.prototype.onattach):
        (WebInspector.StorageCategoryTreeElement.prototype.onexpand):
        (WebInspector.StorageCategoryTreeElement.prototype.oncollapse):
        (WebInspector.FrameTreeElement.prototype.get itemURL):
        (WebInspector.FrameTreeElement.prototype.onselect):
        (WebInspector.FrameResourceTreeElement.prototype.get itemURL):
        (WebInspector.FrameResourceTreeElement.prototype.onselect):
        (WebInspector.DatabaseTreeElement.prototype.get itemURL):
        (WebInspector.DatabaseTreeElement.prototype.onselect):
        (WebInspector.DatabaseTableTreeElement.prototype.get itemURL):
        (WebInspector.DatabaseTableTreeElement.prototype.onselect):
        (WebInspector.DOMStorageTreeElement.prototype.get itemURL):
        (WebInspector.DOMStorageTreeElement.prototype.onselect):
        (WebInspector.CookieTreeElement.prototype.get itemURL):
        (WebInspector.CookieTreeElement.prototype.onselect):
        (WebInspector.ApplicationCacheTreeElement.prototype.get itemURL):
        (WebInspector.ApplicationCacheTreeElement.prototype.onselect):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCoreinspectorInspectorControllercpp">trunk/WebCore/inspector/InspectorController.cpp</a></li>
<li><a href="#trunkWebCoreinspectorfrontendNetworkPaneljs">trunk/WebCore/inspector/front-end/NetworkPanel.js</a></li>
<li><a href="#trunkWebCoreinspectorfrontendResourceManagerjs">trunk/WebCore/inspector/front-end/ResourceManager.js</a></li>
<li><a href="#trunkWebCoreinspectorfrontendSettingsjs">trunk/WebCore/inspector/front-end/Settings.js</a></li>
<li><a href="#trunkWebCoreinspectorfrontendStoragePaneljs">trunk/WebCore/inspector/front-end/StoragePanel.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (70988 => 70989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2010-10-30 23:08:31 UTC (rev 70988)
+++ trunk/WebCore/ChangeLog        2010-10-31 06:43:11 UTC (rev 70989)
</span><span class="lines">@@ -1,3 +1,65 @@
</span><ins>+2010-10-30  Pavel Feldman  &lt;pfeldman@chromium.org&gt;
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: new resources and network panel usability improvements.
+        https://bugs.webkit.org/show_bug.cgi?id=48680
+
+        By default, navigation clears network log, added 'preserve log' button,
+        that prevents log from being cleared.
+
+        Storing expanded state of all group items, restoring last selected item,
+        fall back to main frame's main resource by default.
+        Do not list XHRs and redirects in resources.
+
+        * English.lproj/localizedStrings.js:
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::didLoadResourceFromMemoryCache):
+        (WebCore::InspectorController::identifierForInitialRequest):
+        * inspector/front-end/NetworkPanel.js:
+        (WebInspector.NetworkPanel.prototype.get statusBarItems):
+        (WebInspector.NetworkPanel.prototype._positionSummaryBar):
+        (WebInspector.NetworkPanel.prototype._updateFilter):
+        (WebInspector.NetworkPanel.prototype._createStatusbarButtons):
+        (WebInspector.NetworkPanel.prototype._onPreserveLogClicked):
+        (WebInspector.NetworkPanel.prototype.reset):
+        (WebInspector.NetworkPanel.prototype.refreshResource):
+        * inspector/front-end/ResourceManager.js:
+        (WebInspector.ResourceManager.prototype.identifierForInitialRequest):
+        (WebInspector.ResourceManager.prototype.willSendRequest):
+        (WebInspector.ResourceManager.prototype.didLoadResourceFromMemoryCache):
+        (WebInspector.ResourceManager.prototype.setOverrideContent):
+        (WebInspector.ResourceManager.prototype.didCreateWebSocket):
+        * inspector/front-end/StoragePanel.js:
+        (WebInspector.StoragePanel):
+        (WebInspector.StoragePanel.prototype.show):
+        (WebInspector.StoragePanel.prototype._initDefaultSelection):
+        (WebInspector.StoragePanel.prototype.reset):
+        (WebInspector.StoragePanel.prototype.addResourceToFrame):
+        (WebInspector.StoragePanel.prototype.refreshResource):
+        (WebInspector.StoragePanel.prototype.showDatabase):
+        (WebInspector.BaseStorageTreeElement.prototype.onselect):
+        (WebInspector.StorageCategoryTreeElement):
+        (WebInspector.StorageCategoryTreeElement.prototype.get itemURL):
+        (WebInspector.StorageCategoryTreeElement.prototype.onselect):
+        (WebInspector.StorageCategoryTreeElement.prototype.onattach):
+        (WebInspector.StorageCategoryTreeElement.prototype.onexpand):
+        (WebInspector.StorageCategoryTreeElement.prototype.oncollapse):
+        (WebInspector.FrameTreeElement.prototype.get itemURL):
+        (WebInspector.FrameTreeElement.prototype.onselect):
+        (WebInspector.FrameResourceTreeElement.prototype.get itemURL):
+        (WebInspector.FrameResourceTreeElement.prototype.onselect):
+        (WebInspector.DatabaseTreeElement.prototype.get itemURL):
+        (WebInspector.DatabaseTreeElement.prototype.onselect):
+        (WebInspector.DatabaseTableTreeElement.prototype.get itemURL):
+        (WebInspector.DatabaseTableTreeElement.prototype.onselect):
+        (WebInspector.DOMStorageTreeElement.prototype.get itemURL):
+        (WebInspector.DOMStorageTreeElement.prototype.onselect):
+        (WebInspector.CookieTreeElement.prototype.get itemURL):
+        (WebInspector.CookieTreeElement.prototype.onselect):
+        (WebInspector.ApplicationCacheTreeElement.prototype.get itemURL):
+        (WebInspector.ApplicationCacheTreeElement.prototype.onselect):
+
</ins><span class="cx"> 2010-10-30  Patrick Gansterer  &lt;paroga@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, build fix after r70846.
</span></span></pre></div>
<a id="trunkWebCoreinspectorInspectorControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/inspector/InspectorController.cpp (70988 => 70989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/inspector/InspectorController.cpp        2010-10-30 23:08:31 UTC (rev 70988)
+++ trunk/WebCore/inspector/InspectorController.cpp        2010-10-31 06:43:11 UTC (rev 70989)
</span><span class="lines">@@ -908,6 +908,8 @@
</span><span class="cx">     if (!enabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ensureSettingsLoaded();
+
</ins><span class="cx"> #if LEGACY_RESOURCE_TRACKING_ENABLED
</span><span class="cx">     // If the resource URL is already known, we don't need to add it again since this is just a cached load.
</span><span class="cx">     if (m_knownResources.contains(cachedResource-&gt;url()))
</span><span class="lines">@@ -915,7 +917,6 @@
</span><span class="cx"> 
</span><span class="cx">     ASSERT(m_inspectedPage);
</span><span class="cx">     bool isMainResource = isMainResourceLoader(loader, KURL(ParsedURLString, cachedResource-&gt;url()));
</span><del>-    ensureSettingsLoaded();
</del><span class="cx">     if (!isMainResource &amp;&amp; !resourceTrackingEnabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -946,9 +947,9 @@
</span><span class="cx">     if (isMainResource)
</span><span class="cx">         m_mainResourceIdentifier = identifier;
</span><span class="cx"> 
</span><ins>+    ensureSettingsLoaded();
+
</ins><span class="cx"> #if LEGACY_RESOURCE_TRACKING_ENABLED
</span><del>-
-    ensureSettingsLoaded();
</del><span class="cx">     if (!isMainResource &amp;&amp; !resourceTrackingEnabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCoreinspectorfrontendNetworkPaneljs"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/inspector/front-end/NetworkPanel.js (70988 => 70989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/inspector/front-end/NetworkPanel.js        2010-10-30 23:08:31 UTC (rev 70988)
+++ trunk/WebCore/inspector/front-end/NetworkPanel.js        2010-10-31 06:43:11 UTC (rev 70989)
</span><span class="lines">@@ -83,7 +83,7 @@
</span><span class="cx"> 
</span><span class="cx">     get statusBarItems()
</span><span class="cx">     {
</span><del>-        return [this._largerResourcesButton.element, this._clearButton.element, this._filterBarElement];
</del><ins>+        return [this._largerResourcesButton.element, this._preserveLogToggle.element, this._clearButton.element, this._filterBarElement];
</ins><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     isCategoryVisible: function(categoryName)
</span><span class="lines">@@ -126,13 +126,9 @@
</span><span class="cx">     _positionSummaryBar: function()
</span><span class="cx">     {
</span><span class="cx">         // Position the total bar.
</span><del>-        const rowHeight = 22;
-        const summaryBarHeight = 22;
-        var offsetHeight = this.element.offsetHeight;
</del><span class="cx"> 
</span><del>-        var parentElement = this._summaryBarElement.parentElement;
-
-        if (this._summaryBarElement.parentElement !== this.element &amp;&amp; offsetHeight &gt; (this._dataGrid.children.length - 1) * rowHeight + summaryBarHeight) {
</del><ins>+        var fillerRow = this._dataGrid.dataTableBody.lastChild;
+        if (this._summaryBarElement.parentElement !== this.element &amp;&amp; fillerRow.offsetHeight &gt; 0) {
</ins><span class="cx">             // Glue status to bottom.
</span><span class="cx">             if (this._summaryBarRowNode) {
</span><span class="cx">                 this._dataGrid.removeChild(this._summaryBarRowNode);
</span><span class="lines">@@ -144,7 +140,7 @@
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (!this._summaryBarRowNode &amp;&amp; offsetHeight - summaryBarHeight &lt; this._dataGrid.children.length * rowHeight) {
</del><ins>+        if (!this._summaryBarRowNode &amp;&amp; !fillerRow.offsetHeight) {
</ins><span class="cx">             // Glue status to table.
</span><span class="cx">             this._summaryBarRowNode = new WebInspector.NetworkTotalGridNode(this._summaryBarElement);
</span><span class="cx">             this._summaryBarElement.removeStyleClass(&quot;network-summary-bar-bottom&quot;);
</span><span class="lines">@@ -427,9 +423,7 @@
</span><span class="cx">             selectMultiple = true;
</span><span class="cx"> 
</span><span class="cx">         this._filter(e.target, selectMultiple);
</span><del>-
-        var searchField = document.getElementById(&quot;search&quot;);
-        WebInspector.doPerformSearch(searchField.value, WebInspector.shortSearchWasForcedByKeyEvent, false, true);
</del><ins>+        this._positionSummaryBar();
</ins><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     _filter: function(target, selectMultiple)
</span><span class="lines">@@ -611,6 +605,9 @@
</span><span class="cx"> 
</span><span class="cx">     _createStatusbarButtons: function()
</span><span class="cx">     {
</span><ins>+        this._preserveLogToggle = new WebInspector.StatusBarButton(WebInspector.UIString(&quot;Preserve Log upon Navigation&quot;), &quot;record-profile-status-bar-item&quot;);
+        this._preserveLogToggle.addEventListener(&quot;click&quot;, this._onPreserveLogClicked.bind(this), false);
+
</ins><span class="cx">         this._clearButton = new WebInspector.StatusBarButton(WebInspector.UIString(&quot;Clear&quot;), &quot;clear-status-bar-item&quot;);
</span><span class="cx">         this._clearButton.addEventListener(&quot;click&quot;, this._reset.bind(this), false);
</span><span class="cx"> 
</span><span class="lines">@@ -747,6 +744,17 @@
</span><span class="cx">         this._dataGrid.updateWidths();
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    _onPreserveLogClicked: function(e)
+    {
+        this._preserveLogToggle.toggled = !this._preserveLogToggle.toggled;
+    },
+
+    reset: function()
+    {
+        if (!this._preserveLogToggle.toggled)
+            this._reset();
+    },
+
</ins><span class="cx">     _reset: function()
</span><span class="cx">     {
</span><span class="cx">         this._popoverHelper.hidePopup();
</span><span class="lines">@@ -780,17 +788,22 @@
</span><span class="cx">         return this._resourcesById;
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    addResource: function(resource)
</del><ins>+    refreshResource: function(resource)
</ins><span class="cx">     {
</span><del>-        this._resources.push(resource);
</del><span class="cx">         if (!resource.identifier)
</span><span class="cx">             resource.identifier = &quot;network:&quot; + this._lastIdentifier++;
</span><del>-        this._resourcesById[resource.identifier] = resource;
-        this.refreshResource(resource);
-    },
</del><span class="cx"> 
</span><del>-    refreshResource: function(resource)
-    {
</del><ins>+        if (!this._resourcesById[resource.identifier]) {
+            this._resources.push(resource);
+            this._resourcesById[resource.identifier] = resource;
+
+            // Pull all the redirects of the main resource upon commit load.
+            if (resource.redirects) {
+                for (var i = 0; i &lt; resource.redirects.length; ++i)
+                    this.refreshResource(resource.redirects[i]);
+            }
+        }
+
</ins><span class="cx">         this._staleResources.push(resource);
</span><span class="cx">         this._scheduleRefresh();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCoreinspectorfrontendResourceManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/inspector/front-end/ResourceManager.js (70988 => 70989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/inspector/front-end/ResourceManager.js        2010-10-30 23:08:31 UTC (rev 70988)
+++ trunk/WebCore/inspector/front-end/ResourceManager.js        2010-10-31 06:43:11 UTC (rev 70989)
</span><span class="lines">@@ -71,7 +71,7 @@
</span><span class="cx">         // It is important to bind resource url early (before scripts compile).
</span><span class="cx">         this._bindResourceURL(resource);
</span><span class="cx"> 
</span><del>-        WebInspector.panels.network.addResource(resource);
</del><ins>+        WebInspector.panels.network.refreshResource(resource);
</ins><span class="cx">         WebInspector.panels.audits.resourceStarted(resource);
</span><span class="cx">     },
</span><span class="cx"> 
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx">         resource.startTime = time;
</span><span class="cx"> 
</span><span class="cx">         if (isRedirect) {
</span><del>-            WebInspector.panels.network.addResource(resource);
</del><ins>+            WebInspector.panels.network.refreshResource(resource);
</ins><span class="cx">             WebInspector.panels.audits.resourceStarted(resource);
</span><span class="cx">         } else 
</span><span class="cx">             WebInspector.panels.network.refreshResource(resource);
</span><span class="lines">@@ -230,7 +230,7 @@
</span><span class="cx">         resource.cached = true;
</span><span class="cx">         resource.startTime = resource.responseReceivedTime = resource.endTime = time;
</span><span class="cx"> 
</span><del>-        WebInspector.panels.network.addResource(resource);
</del><ins>+        WebInspector.panels.network.refreshResource(resource);
</ins><span class="cx">         WebInspector.panels.audits.resourceStarted(resource);
</span><span class="cx">         WebInspector.panels.audits.resourceFinished(resource);
</span><span class="cx">         this._resourceTreeModel.addResourceToFrame(resource.loader.frameId, resource);
</span><span class="lines">@@ -251,6 +251,7 @@
</span><span class="cx"> 
</span><span class="cx">         resource.type = WebInspector.Resource.Type[type];
</span><span class="cx">         resource.content = sourceString;
</span><ins>+        WebInspector.panels.storage.refreshResource(resource);
</ins><span class="cx">         WebInspector.panels.network.refreshResource(resource);
</span><span class="cx">     },
</span><span class="cx"> 
</span><span class="lines">@@ -270,7 +271,7 @@
</span><span class="cx">         var resource = this._resourcesById[identifier];
</span><span class="cx">         resource.type = WebInspector.Resource.Type.WebSocket;
</span><span class="cx"> 
</span><del>-        WebInspector.panels.network.addResource(resource);
</del><ins>+        WebInspector.panels.network.refreshResource(resource);
</ins><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     willSendWebSocketHandshakeRequest: function(identifier, time, request)
</span></span></pre></div>
<a id="trunkWebCoreinspectorfrontendSettingsjs"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/inspector/front-end/Settings.js (70988 => 70989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/inspector/front-end/Settings.js        2010-10-30 23:08:31 UTC (rev 70988)
+++ trunk/WebCore/inspector/front-end/Settings.js        2010-10-31 06:43:11 UTC (rev 70989)
</span><span class="lines">@@ -70,6 +70,9 @@
</span><span class="cx"> WebInspector.Settings.prototype = {
</span><span class="cx">     installApplicationSetting: function(key, defaultValue)
</span><span class="cx">     {
</span><ins>+        if (key in this)
+            return;
+
</ins><span class="cx">         this.__defineGetter__(key, this._get.bind(this, key, defaultValue));
</span><span class="cx">         this.__defineSetter__(key, this._set.bind(this, key));
</span><span class="cx">     },
</span></span></pre></div>
<a id="trunkWebCoreinspectorfrontendStoragePaneljs"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/inspector/front-end/StoragePanel.js (70988 => 70989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/inspector/front-end/StoragePanel.js        2010-10-30 23:08:31 UTC (rev 70988)
+++ trunk/WebCore/inspector/front-end/StoragePanel.js        2010-10-31 06:43:11 UTC (rev 70989)
</span><span class="lines">@@ -31,36 +31,32 @@
</span><span class="cx"> {
</span><span class="cx">     WebInspector.Panel.call(this, &quot;storage&quot;);
</span><span class="cx"> 
</span><ins>+    WebInspector.applicationSettings.installApplicationSetting(&quot;resourcesLastSelectedItem&quot;, {});
+
</ins><span class="cx">     this.createSidebar();
</span><span class="cx">     this.sidebarElement.addStyleClass(&quot;outline-disclosure filter-all children small&quot;);
</span><span class="cx">     this.sidebarTreeElement.removeStyleClass(&quot;sidebar-tree&quot;);
</span><span class="cx"> 
</span><span class="cx">     if (Preferences.networkPanelEnabled) {
</span><del>-        this.resourcesListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString(&quot;Frames&quot;), &quot;frame-storage-tree-item&quot;);
</del><ins>+        this.resourcesListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString(&quot;Frames&quot;), &quot;Frames&quot;, &quot;frame-storage-tree-item&quot;);
</ins><span class="cx">         this.sidebarTree.appendChild(this.resourcesListTreeElement);
</span><del>-        this.resourcesListTreeElement.expand();
</del><span class="cx">         this._treeElementForFrameId = {};
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    this.databasesListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString(&quot;Databases&quot;), &quot;database-storage-tree-item&quot;);
</del><ins>+    this.databasesListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString(&quot;Databases&quot;), &quot;Databases&quot;, &quot;database-storage-tree-item&quot;);
</ins><span class="cx">     this.sidebarTree.appendChild(this.databasesListTreeElement);
</span><del>-    this.databasesListTreeElement.expand();
</del><span class="cx"> 
</span><del>-    this.localStorageListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString(&quot;Local Storage&quot;), &quot;domstorage-storage-tree-item local-storage&quot;);
</del><ins>+    this.localStorageListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString(&quot;Local Storage&quot;), &quot;LocalStorage&quot;, &quot;domstorage-storage-tree-item local-storage&quot;);
</ins><span class="cx">     this.sidebarTree.appendChild(this.localStorageListTreeElement);
</span><del>-    this.localStorageListTreeElement.expand();
</del><span class="cx"> 
</span><del>-    this.sessionStorageListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString(&quot;Session Storage&quot;), &quot;domstorage-storage-tree-item session-storage&quot;);
</del><ins>+    this.sessionStorageListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString(&quot;Session Storage&quot;), &quot;SessionStorage&quot;, &quot;domstorage-storage-tree-item session-storage&quot;);
</ins><span class="cx">     this.sidebarTree.appendChild(this.sessionStorageListTreeElement);
</span><del>-    this.sessionStorageListTreeElement.expand();
</del><span class="cx"> 
</span><del>-    this.cookieListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString(&quot;Cookies&quot;), &quot;cookie-storage-tree-item&quot;);
</del><ins>+    this.cookieListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString(&quot;Cookies&quot;), &quot;Cookies&quot;, &quot;cookie-storage-tree-item&quot;);
</ins><span class="cx">     this.sidebarTree.appendChild(this.cookieListTreeElement);
</span><del>-    this.cookieListTreeElement.expand();
-    
-    this.applicationCacheListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString(&quot;Application Cache&quot;), &quot;application-cache-storage-tree-item&quot;);
</del><ins>+
+    this.applicationCacheListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString(&quot;Application Cache&quot;), &quot;ApplicationCache&quot;, &quot;application-cache-storage-tree-item&quot;);
</ins><span class="cx">     this.sidebarTree.appendChild(this.applicationCacheListTreeElement);
</span><del>-    this.applicationCacheListTreeElement.expand();
</del><span class="cx"> 
</span><span class="cx">     if (Preferences.fileSystemEnabled) {
</span><span class="cx">         this.fileSystemListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString(&quot;File System&quot;), &quot;file-system-storage-tree-item&quot;);
</span><span class="lines">@@ -78,6 +74,7 @@
</span><span class="cx">     this._databases = [];
</span><span class="cx">     this._domStorage = [];
</span><span class="cx">     this._cookieViews = {};
</span><ins>+    this._domains = {};
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebInspector.StoragePanel.prototype = {
</span><span class="lines">@@ -91,8 +88,35 @@
</span><span class="cx">         return [this.storageViewStatusBarItemsContainer];
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    show: function()
+    {
+        WebInspector.Panel.prototype.show.call(this);
+        if (this._initializedDefaultSelection)
+            return;
+
+        this._initializedDefaultSelection = true;
+        var itemURL = WebInspector.applicationSettings.resourcesLastSelectedItem;
+        if (itemURL) {
+            for (var treeElement = this.sidebarTree.children[0]; treeElement; treeElement = treeElement.traverseNextTreeElement(false, this.sidebarTree, true)) {
+                if (treeElement.itemURL === itemURL) {
+                    treeElement.select();
+                    treeElement.reveal();
+                    return;
+                }
+            }
+        }
+        this._initDefaultSelection();
+    },
+
+    _initDefaultSelection: function()
+    {
+        if (WebInspector.mainResource &amp;&amp; this.resourcesListTreeElement &amp;&amp; this.resourcesListTreeElement.expanded)
+            this.showResource(WebInspector.mainResource);
+    },
+
</ins><span class="cx">     reset: function()
</span><span class="cx">     {
</span><ins>+        this._domains = {};
</ins><span class="cx">         for (var i = 0; i &lt; this._databases.length; ++i) {
</span><span class="cx">             var database = this._databases[i];
</span><span class="cx">             delete database._tableViews;
</span><span class="lines">@@ -174,6 +198,15 @@
</span><span class="cx"> 
</span><span class="cx">     addResourceToFrame: function(frameId, resource)
</span><span class="cx">     {
</span><ins>+        if (!this._domains[resource.domain]) {
+            this._domains[resource.domain] = true;
+            this.addCookieDomain(resource.domain);
+            this.addApplicationCache(resource.domain);
+        }
+
+        if (resource.statusCode &gt;= 301 &amp;&amp; resource.statusCode &lt;= 303)
+            return;
+
</ins><span class="cx">         var frameTreeElement = this._treeElementForFrameId[frameId];
</span><span class="cx">         if (!frameTreeElement) {
</span><span class="cx">             // This is a frame's main resource, it will be retained
</span><span class="lines">@@ -206,6 +239,15 @@
</span><span class="cx">             frameTreeElement.removeChildren();
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    refreshResource: function(resource)
+    {
+        // FIXME: do not add XHR in the first place based on the native instrumentation.
+        if (resource.type === WebInspector.Resource.Type.XHR) {
+            var resourceTreeElement = this._findTreeElementForResource(resource);
+            resourceTreeElement.parent.removeChild(resourceTreeElement);
+        }
+    },
+
</ins><span class="cx">     addDatabase: function(database)
</span><span class="cx">     {
</span><span class="cx">         this._databases.push(database);
</span><span class="lines">@@ -306,7 +348,7 @@
</span><span class="cx">     {
</span><span class="cx">         if (!database)
</span><span class="cx">             return;
</span><del>-
</del><ins>+            
</ins><span class="cx">         var view;
</span><span class="cx">         if (tableName) {
</span><span class="cx">             if (!(&quot;_tableViews&quot; in database))
</span><span class="lines">@@ -683,6 +725,13 @@
</span><span class="cx">         this.listItemElement.appendChild(this.titleElement);
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    onselect: function()
+    {
+        var itemURL = this.itemURL;
+        if (itemURL)
+            WebInspector.applicationSettings.resourcesLastSelectedItem = itemURL;
+    },
+
</ins><span class="cx">     onreveal: function()
</span><span class="cx">     {
</span><span class="cx">         if (this.listItemElement)
</span><span class="lines">@@ -708,16 +757,41 @@
</span><span class="cx"> 
</span><span class="cx"> WebInspector.BaseStorageTreeElement.prototype.__proto__ = TreeElement.prototype;
</span><span class="cx"> 
</span><del>-WebInspector.StorageCategoryTreeElement = function(storagePanel, categoryName, iconClass)
</del><ins>+WebInspector.StorageCategoryTreeElement = function(storagePanel, categoryName, settingsKey, iconClass)
</ins><span class="cx"> {
</span><span class="cx">     WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, categoryName, iconClass, true);
</span><ins>+    this._expandedSettingKey = &quot;resources&quot; + settingsKey + &quot;Expanded&quot;;
+    WebInspector.applicationSettings.installApplicationSetting(this._expandedSettingKey, settingsKey === &quot;Frames&quot;);
</ins><span class="cx">     this._categoryName = categoryName;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebInspector.StorageCategoryTreeElement.prototype = {
</span><ins>+    get itemURL()
+    {
+        return &quot;category://&quot; + this._categoryName;
+    },
+
</ins><span class="cx">     onselect: function()
</span><span class="cx">     {
</span><ins>+        WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
</ins><span class="cx">         this._storagePanel.showCategoryView(this._categoryName);
</span><ins>+    },
+
+    onattach: function()
+    {
+        WebInspector.BaseStorageTreeElement.prototype.onattach.call(this);
+        if (WebInspector.applicationSettings[this._expandedSettingKey])
+            this.expand();
+    },
+
+    onexpand: function()
+    {
+        WebInspector.applicationSettings[this._expandedSettingKey] = true;
+    },
+
+    oncollapse: function()
+    {
+        WebInspector.applicationSettings[this._expandedSettingKey] = false;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> WebInspector.StorageCategoryTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
</span><span class="lines">@@ -730,8 +804,14 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebInspector.FrameTreeElement.prototype = {
</span><ins>+    get itemURL()
+    {
+        return &quot;frame://&quot; + encodeURI(this._displayName);
+    },
+
</ins><span class="cx">     onselect: function()
</span><span class="cx">     {
</span><ins>+        WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
</ins><span class="cx">         this._storagePanel.showCategoryView(this._displayName);
</span><span class="cx">     },
</span><span class="cx"> 
</span><span class="lines">@@ -757,8 +837,14 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebInspector.FrameResourceTreeElement.prototype = {
</span><ins>+    get itemURL()
+    {
+        return this._resource.url;
+    },
+
</ins><span class="cx">     onselect: function()
</span><span class="cx">     {
</span><ins>+        WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
</ins><span class="cx">         this._storagePanel._showResourceView(this._resource);
</span><span class="cx">     },
</span><span class="cx"> 
</span><span class="lines">@@ -869,8 +955,14 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebInspector.DatabaseTreeElement.prototype = {
</span><ins>+    get itemURL()
+    {
+        return &quot;database://&quot; + encodeURI(this._database.name);
+    },
+
</ins><span class="cx">     onselect: function()
</span><span class="cx">     {
</span><ins>+        WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
</ins><span class="cx">         this._storagePanel.showDatabase(this._database);
</span><span class="cx">     },
</span><span class="cx"> 
</span><span class="lines">@@ -905,8 +997,14 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebInspector.DatabaseTableTreeElement.prototype = {
</span><ins>+    get itemURL()
+    {
+        return &quot;database://&quot; + encodeURI(this._database.name) + &quot;/&quot; + encodeURI(this._tableName);
+    },
+
</ins><span class="cx">     onselect: function()
</span><span class="cx">     {
</span><ins>+        WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
</ins><span class="cx">         this._storagePanel.showDatabase(this._database, this._tableName);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -919,8 +1017,14 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebInspector.DOMStorageTreeElement.prototype = {
</span><ins>+    get itemURL()
+    {
+        return &quot;storage://&quot; + this._domStorage.domain + &quot;/&quot; + (this._domStorage.isLocalStorage ? &quot;local&quot; : &quot;session&quot;);
+    },
+
</ins><span class="cx">     onselect: function()
</span><span class="cx">     {
</span><ins>+        WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
</ins><span class="cx">         this._storagePanel.showDOMStorage(this._domStorage);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -933,8 +1037,14 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebInspector.CookieTreeElement.prototype = {
</span><ins>+    get itemURL()
+    {
+        return &quot;cookies://&quot; + this._cookieDomain;
+    },
+
</ins><span class="cx">     onselect: function()
</span><span class="cx">     {
</span><ins>+        WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
</ins><span class="cx">         this._storagePanel.showCookies(this, this._cookieDomain);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -947,8 +1057,14 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebInspector.ApplicationCacheTreeElement.prototype = {
</span><ins>+    get itemURL()
+    {
+        return &quot;appcache://&quot; + this._appcacheDomain;
+    },
+
</ins><span class="cx">     onselect: function()
</span><span class="cx">     {
</span><ins>+        WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
</ins><span class="cx">         this._storagePanel.showApplicationCache(this, this._appcacheDomain);
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>