<!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>[184263] branches/safari-601.1.32-branch/Source/WebInspectorUI</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/184263">184263</a></dd>
<dt>Author</dt> <dd>dburkart@apple.com</dd>
<dt>Date</dt> <dd>2015-05-12 22:33:03 -0700 (Tue, 12 May 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/184130">r184130</a>. rdar://problem/20829494</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari601132branchSourceWebInspectorUIChangeLog">branches/safari-601.1.32-branch/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#branchessafari601132branchSourceWebInspectorUIUserInterfaceBaseMainjs">branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Base/Main.js</a></li>
<li><a href="#branchessafari601132branchSourceWebInspectorUIUserInterfaceViewsContentViewjs">branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ContentView.js</a></li>
<li><a href="#branchessafari601132branchSourceWebInspectorUIUserInterfaceViewsContentViewContainerjs">branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js</a></li>
<li><a href="#branchessafari601132branchSourceWebInspectorUIUserInterfaceViewsDebuggerSidebarPaneljs">branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js</a></li>
<li><a href="#branchessafari601132branchSourceWebInspectorUIUserInterfaceViewsNavigationSidebarPaneljs">branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js</a></li>
<li><a href="#branchessafari601132branchSourceWebInspectorUIUserInterfaceViewsTabContentViewjs">branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/TabContentView.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari601132branchSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.32-branch/Source/WebInspectorUI/ChangeLog (184262 => 184263)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.32-branch/Source/WebInspectorUI/ChangeLog        2015-05-13 05:31:25 UTC (rev 184262)
+++ branches/safari-601.1.32-branch/Source/WebInspectorUI/ChangeLog        2015-05-13 05:33:03 UTC (rev 184263)
</span><span class="lines">@@ -2,27 +2,89 @@
</span><span class="cx"> Dana Burkart <dburkart@apple.com
</span><span class="cx"> dburkart@apple.com>
</span><span class="cx">
</span><del>- Merge r184108. rdar://problem/20903134
</del><ins>+ Merge r184130. rdar://problem/20829494
</ins><span class="cx">
</span><span class="cx"> 2015-05-11 Timothy Hatcher <timothy@apple.com>
</span><span class="cx">
</span><del>- Web Inspector: NavigationSidebarPanel leaks some event listeners
- https://bugs.webkit.org/show_bug.cgi?id=144523
</del><ins>+ Web Inspector: REGRESSION (Tabs): Issues reloading a resource with breakpoints
+ https://bugs.webkit.org/show_bug.cgi?id=144650
</ins><span class="cx">
</span><del>- Reviewed by Joseph Pecoraro.
</del><ins>+ Fix a number of issues with Debugger tab and navigation/reloading:
+ - Close old content views in the Debugger tab when main frame navigates.
+ - Prune old resource tree elements before attempting to restore a cookie that might match an old resource.
+ - Allow breakpoint selections to be restored from a saved cookie.
+ - Fix an assert when closing a content view that isn't the current index, but is the current view.
+ - Avoid calling closed() multiple times when a ContentView is in the back/forward list more than once.
+ - Make restoreStateFromCookie properly set and use the causedByNavigation argument for a longer restore delay.
+ - Create a new cookie object per tab instead of it being cumulative from the previous cookie.
</ins><span class="cx">
</span><ins>+ Reviewed by Brian Burg.
+
+ * UserInterface/Base/Main.js:
+ (WebInspector._mainResourceDidChange): Delay calling _restoreCookieForOpenTabs to give time for sidebars
+ and tabs to respond to the main resource change.
+ (WebInspector._restoreCookieForOpenTabs): Rename causedByReload to causedByNavigation. Nothing special about
+ reload since we restore on all navigation.
+
+ * UserInterface/Views/ContentView.js:
+ (WebInspector.ContentView): Support Breakpoint as a represented object, which happens during a cookie restore.
+ (WebInspector.ContentView.isViewable): Ditto.
+
+ * UserInterface/Views/ContentViewContainer.js:
+ (WebInspector.ContentViewContainer.prototype.closeAllContentViews): Disassociate if the view is current and not just
+ the current entry index. This matches other close functions. This fixes an assert in _disassociateFromContentView.
+ (WebInspector.ContentViewContainer.prototype._disassociateFromContentView): Don't disassociate multiple times. This
+ avoids calling the closed() function on a view more than once.
+
+ * UserInterface/Views/DebuggerSidebarPanel.js:
+ (WebInspector.DebuggerSidebarPanel.prototype.saveStateToCookie):
+ (WebInspector.DebuggerSidebarPanel.prototype._mainResourceDidChange): Renamed from _mainResourceChanged.
+ Close all content views if this is the main frame. Also prune all old resources. Doing this now avoids a flash
+ of having old and new resources in the tree caused by the default delay in NavigationSidebarPanel's _checkForOldResources.
+
</ins><span class="cx"> * UserInterface/Views/NavigationSidebarPanel.js:
</span><del>- (WebInspector.NavigationSidebarPanel):
- (WebInspector.NavigationSidebarPanel.prototype.closed):
- * UserInterface/Views/ResourceSidebarPanel.js:
- (WebInspector.ResourceSidebarPanel.prototype.closed):
- * UserInterface/Views/SearchSidebarPanel.js:
- (WebInspector.SearchSidebarPanel.prototype.closed):
- * UserInterface/Views/StorageSidebarPanel.js:
- (WebInspector.StorageSidebarPanel.prototype.closed):
- * UserInterface/Views/TimelineSidebarPanel.js:
- (WebInspector.TimelineSidebarPanel.prototype.closed):
</del><ins>+ (WebInspector.NavigationSidebarPanel): Set _autoPruneOldTopLevelResourceTreeElements for later.
+ (WebInspector.NavigationSidebarPanel.prototype.get contentTreeOutlineToAutoPrune): Deleted.
+ (WebInspector.NavigationSidebarPanel.prototype.showDefaultContentView): Fix typo.
+ (WebInspector.NavigationSidebarPanel.prototype.showDefaultContentViewForTreeElement): Fix whitespace.
+ (WebInspector.NavigationSidebarPanel.prototype.pruneOldResourceTreeElements): Added. Broken out from
+ _checkForOldResources.delayedWork so it can be called manually. Also check all visible tree outlines.
+ (WebInspector.NavigationSidebarPanel.prototype._treeElementAddedOrChanged): Pass treeElement in an array.
+ (WebInspector.NavigationSidebarPanel.prototype._checkForOldResourcesIfNeeded): Added.
+ (WebInspector.NavigationSidebarPanel.prototype._checkForOldResources): Call pruneOldResourceTreeElements on a delay.
+ (WebInspector.NavigationSidebarPanel.prototype._checkForOldResources.delayedWork): Deleted.
+ (WebInspector.NavigationSidebarPanel.prototype._checkOutlinesForPendingViewStateCookie): Call _checkForOldResourcesIfNeeded.
+ (WebInspector.NavigationSidebarPanel.prototype._checkElementsForPendingViewStateCookie): Remove array folding code.
</ins><span class="cx">
</span><ins>+ * UserInterface/Views/TabContentView.js:
+ (WebInspector.TabContentView.prototype.restoreStateFromCookie): Rename causedByReload to causedByNavigation.
+ (WebInspector.TabContentView.prototype.saveStateToCookie): Don't allow the cookie to build on the old cookie.
+
+ 2015-05-12 Dana Burkart
+ Dana Burkart <dburkart@apple.com
+ dburkart@apple.com>
+
+ Merge r184108. rdar://problem/20903134
+
+ 2015-05-11 Timothy Hatcher <timothy@apple.com>
+
+ Web Inspector: NavigationSidebarPanel leaks some event listeners
+ https://bugs.webkit.org/show_bug.cgi?id=144523
+
+ Reviewed by Joseph Pecoraro.
+
+ * UserInterface/Views/NavigationSidebarPanel.js:
+ (WebInspector.NavigationSidebarPanel):
+ (WebInspector.NavigationSidebarPanel.prototype.closed):
+ * UserInterface/Views/ResourceSidebarPanel.js:
+ (WebInspector.ResourceSidebarPanel.prototype.closed):
+ * UserInterface/Views/SearchSidebarPanel.js:
+ (WebInspector.SearchSidebarPanel.prototype.closed):
+ * UserInterface/Views/StorageSidebarPanel.js:
+ (WebInspector.StorageSidebarPanel.prototype.closed):
+ * UserInterface/Views/TimelineSidebarPanel.js:
+ (WebInspector.TimelineSidebarPanel.prototype.closed):
+
</ins><span class="cx"> 2015-05-06 Matt Baker <mattbaker@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: The text in the left pane overlaps the "Filter Time Events" field in the Timeline after the Web Inspector is resized
</span></span></pre></div>
<a id="branchessafari601132branchSourceWebInspectorUIUserInterfaceBaseMainjs"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Base/Main.js (184262 => 184263)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Base/Main.js        2015-05-13 05:31:25 UTC (rev 184262)
+++ branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Base/Main.js        2015-05-13 05:33:03 UTC (rev 184263)
</span><span class="lines">@@ -1116,7 +1116,9 @@
</span><span class="cx">
</span><span class="cx"> this._inProvisionalLoad = false;
</span><span class="cx">
</span><del>- this._restoreCookieForOpenTabs();
</del><ins>+ // Run cookie restoration after we are sure all of the Tabs and NavigationSidebarPanels
+ // have updated with respect to the main resource change.
+ setTimeout(this._restoreCookieForOpenTabs.bind(this, true));
</ins><span class="cx">
</span><span class="cx"> this._updateDownloadToolbarButton();
</span><span class="cx">
</span><span class="lines">@@ -1133,13 +1135,13 @@
</span><span class="cx"> this._inProvisionalLoad = true;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-WebInspector._restoreCookieForOpenTabs = function(causedByReload)
</del><ins>+WebInspector._restoreCookieForOpenTabs = function(causedByNavigation)
</ins><span class="cx"> {
</span><span class="cx"> for (var tabBarItem of this.tabBar.tabBarItems) {
</span><span class="cx"> var tabContentView = tabBarItem.representedObject;
</span><span class="cx"> if (!(tabContentView instanceof WebInspector.TabContentView))
</span><span class="cx"> continue;
</span><del>- tabContentView.restoreStateFromCookie(causedByReload);
</del><ins>+ tabContentView.restoreStateFromCookie(causedByNavigation);
</ins><span class="cx"> }
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari601132branchSourceWebInspectorUIUserInterfaceViewsContentViewjs"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ContentView.js (184262 => 184263)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ContentView.js        2015-05-13 05:31:25 UTC (rev 184262)
+++ branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ContentView.js        2015-05-13 05:33:03 UTC (rev 184263)
</span><span class="lines">@@ -57,6 +57,11 @@
</span><span class="cx"> return new WebInspector.RenderingFrameTimelineView(representedObject, extraArguments);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (representedObject instanceof WebInspector.Breakpoint) {
+ if (representedObject.sourceCodeLocation)
+ return new WebInspector.ContentView(representedObject.sourceCodeLocation.displaySourceCode, extraArguments);
+ }
+
</ins><span class="cx"> if (representedObject instanceof WebInspector.DOMStorageObject)
</span><span class="cx"> return new WebInspector.DOMStorageContentView(representedObject, extraArguments);
</span><span class="cx">
</span><span class="lines">@@ -147,6 +152,8 @@
</span><span class="cx"> return true;
</span><span class="cx"> if (representedObject instanceof WebInspector.Timeline)
</span><span class="cx"> return true;
</span><ins>+ if (representedObject instanceof WebInspector.Breakpoint)
+ return representedObject.sourceCodeLocation;
</ins><span class="cx"> if (representedObject instanceof WebInspector.DOMStorageObject)
</span><span class="cx"> return true;
</span><span class="cx"> if (representedObject instanceof WebInspector.CookieStorageObject)
</span></span></pre></div>
<a id="branchessafari601132branchSourceWebInspectorUIUserInterfaceViewsContentViewContainerjs"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js (184262 => 184263)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js        2015-05-13 05:31:25 UTC (rev 184262)
+++ branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js        2015-05-13 05:33:03 UTC (rev 184263)
</span><span class="lines">@@ -279,7 +279,7 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- var oldCurrentContentView = this.currentContentView;
</del><ins>+ var visibleContentView = this.currentContentView;
</ins><span class="cx">
</span><span class="cx"> var backForwardListDidChange = false;
</span><span class="cx"> // Hide and disassociate with all the content views that are instances of the constructor.
</span><span class="lines">@@ -288,7 +288,7 @@
</span><span class="cx"> if (!(entry.contentView instanceof constructor))
</span><span class="cx"> continue;
</span><span class="cx">
</span><del>- if (entry.contentView === oldCurrentContentView)
</del><ins>+ if (entry.contentView === visibleContentView)
</ins><span class="cx"> this._hideEntry(entry);
</span><span class="cx">
</span><span class="cx"> if (this._currentIndex >= i) {
</span><span class="lines">@@ -307,7 +307,7 @@
</span><span class="cx"> var currentEntry = this.currentBackForwardEntry;
</span><span class="cx"> console.assert(currentEntry || (!currentEntry && this._currentIndex === -1));
</span><span class="cx">
</span><del>- if (currentEntry && currentEntry.contentView !== oldCurrentContentView || backForwardListDidChange) {
</del><ins>+ if (currentEntry && currentEntry.contentView !== visibleContentView || backForwardListDidChange) {
</ins><span class="cx"> this._showEntry(currentEntry, true);
</span><span class="cx"> this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange);
</span><span class="cx"> }
</span><span class="lines">@@ -335,7 +335,7 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- var oldCurrentContentView = this.currentContentView;
</del><ins>+ var visibleContentView = this.currentContentView;
</ins><span class="cx">
</span><span class="cx"> var backForwardListDidChange = false;
</span><span class="cx"> // Hide and disassociate with all the content views that are the same as contentViewToClose.
</span><span class="lines">@@ -344,7 +344,7 @@
</span><span class="cx"> if (entry.contentView !== contentViewToClose)
</span><span class="cx"> continue;
</span><span class="cx">
</span><del>- if (entry.contentView === oldCurrentContentView)
</del><ins>+ if (entry.contentView === visibleContentView)
</ins><span class="cx"> this._hideEntry(entry);
</span><span class="cx">
</span><span class="cx"> if (this._currentIndex >= i) {
</span><span class="lines">@@ -363,7 +363,7 @@
</span><span class="cx"> var currentEntry = this.currentBackForwardEntry;
</span><span class="cx"> console.assert(currentEntry || (!currentEntry && this._currentIndex === -1));
</span><span class="cx">
</span><del>- if (currentEntry && currentEntry.contentView !== oldCurrentContentView || backForwardListDidChange) {
</del><ins>+ if (currentEntry && currentEntry.contentView !== visibleContentView || backForwardListDidChange) {
</ins><span class="cx"> this._showEntry(currentEntry, true);
</span><span class="cx"> this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange);
</span><span class="cx"> }
</span><span class="lines">@@ -376,10 +376,12 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ var visibleContentView = this.currentContentView;
+
</ins><span class="cx"> // Hide and disassociate with all the content views.
</span><span class="cx"> for (var i = 0; i < this._backForwardList.length; ++i) {
</span><span class="cx"> var entry = this._backForwardList[i];
</span><del>- if (i === this._currentIndex)
</del><ins>+ if (entry.contentView === visibleContentView)
</ins><span class="cx"> this._hideEntry(entry);
</span><span class="cx"> this._disassociateFromContentView(entry.contentView);
</span><span class="cx"> }
</span><span class="lines">@@ -450,6 +452,9 @@
</span><span class="cx"> {
</span><span class="cx"> console.assert(!contentView.visible);
</span><span class="cx">
</span><ins>+ if (!contentView._parentContainer)
+ return;
+
</ins><span class="cx"> contentView._parentContainer = null;
</span><span class="cx">
</span><span class="cx"> var representedObject = contentView.representedObject;
</span></span></pre></div>
<a id="branchessafari601132branchSourceWebInspectorUIUserInterfaceViewsDebuggerSidebarPaneljs"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js (184262 => 184263)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js        2015-05-13 05:31:25 UTC (rev 184262)
+++ branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js        2015-05-13 05:33:03 UTC (rev 184263)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx">
</span><span class="cx"> this.contentBrowser = contentBrowser;
</span><span class="cx">
</span><del>- WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceChanged, this);
</del><ins>+ WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
</ins><span class="cx"> WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceAdded, this);
</span><span class="cx">
</span><span class="cx"> WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange, this._breakpointsEnabledDidChange, this);
</span><span class="lines">@@ -227,11 +227,15 @@
</span><span class="cx">
</span><span class="cx"> var representedObject = selectedTreeElement.representedObject;
</span><span class="cx">
</span><del>- if (representedObject === WebInspector.debuggerManager.allExceptionsBreakpoint)
</del><ins>+ if (representedObject === WebInspector.debuggerManager.allExceptionsBreakpoint) {
</ins><span class="cx"> cookie[WebInspector.DebuggerSidebarPanel.SelectedAllExceptionsCookieKey] = true;
</span><ins>+ return;
+ }
</ins><span class="cx">
</span><del>- if (representedObject === WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint)
</del><ins>+ if (representedObject === WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint) {
</ins><span class="cx"> cookie[WebInspector.DebuggerSidebarPanel.SelectedAllUncaughtExceptionsCookieKey] = true;
</span><ins>+ return;
+ }
</ins><span class="cx">
</span><span class="cx"> super.saveStateToCookie(cookie);
</span><span class="cx"> }
</span><span class="lines">@@ -378,8 +382,16 @@
</span><span class="cx"> this._addIssuesForSourceCode(resource);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- _mainResourceChanged(event)
</del><ins>+ _mainResourceDidChange(event)
</ins><span class="cx"> {
</span><ins>+ if (event.target.isMainFrame()) {
+ // Aggressively prune resources now so the old resources are removed before
+ // the new main resource is added below. This avoids a visual flash when the
+ // prune normally happens on a later event loop cycle.
+ this.pruneStaleResourceTreeElements();
+ this.contentBrowser.contentViewContainer.closeAllContentViews();
+ }
+
</ins><span class="cx"> var resource = event.target.mainResource;
</span><span class="cx"> this._addTreeElementForSourceCodeToContentTreeOutline(resource);
</span><span class="cx"> this._addBreakpointsForSourceCode(resource);
</span></span></pre></div>
<a id="branchessafari601132branchSourceWebInspectorUIUserInterfaceViewsNavigationSidebarPaneljs"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js (184262 => 184263)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js        2015-05-13 05:31:25 UTC (rev 184262)
+++ branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js        2015-05-13 05:33:03 UTC (rev 184263)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx">
</span><span class="cx"> WebInspector.NavigationSidebarPanel = class NavigationSidebarPanel extends WebInspector.SidebarPanel
</span><span class="cx"> {
</span><del>- constructor(identifier, displayName, autoPruneOldTopLevelResourceTreeElements, wantsTopOverflowShadow, element, role, label)
</del><ins>+ constructor(identifier, displayName, shouldAutoPruneStaleTopLevelResourceTreeElements, wantsTopOverflowShadow, element, role, label)
</ins><span class="cx"> {
</span><span class="cx"> super(identifier, displayName, element, role, label || displayName);
</span><span class="cx">
</span><span class="lines">@@ -68,10 +68,12 @@
</span><span class="cx"> this._generateStyleRulesIfNeeded();
</span><span class="cx"> this._generateDisclosureTrianglesIfNeeded();
</span><span class="cx">
</span><del>- if (autoPruneOldTopLevelResourceTreeElements) {
- WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._checkForOldResources, this);
- WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasRemoved, this._checkForOldResources, this);
- WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasRemoved, this._checkForOldResources, this);
</del><ins>+ this._shouldAutoPruneStaleTopLevelResourceTreeElements = shouldAutoPruneStaleTopLevelResourceTreeElements || false;
+
+ if (this._shouldAutoPruneStaleTopLevelResourceTreeElements) {
+ WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._checkForStaleResources, this);
+ WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasRemoved, this._checkForStaleResources, this);
+ WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasRemoved, this._checkForStaleResources, this);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -121,11 +123,6 @@
</span><span class="cx"> this._updateFilter();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- get contentTreeOutlineToAutoPrune()
- {
- return this._contentTreeOutline;
- }
-
</del><span class="cx"> get visibleContentTreeOutlines()
</span><span class="cx"> {
</span><span class="cx"> return this._visibleContentTreeOutlines;
</span><span class="lines">@@ -186,7 +183,7 @@
</span><span class="cx">
</span><span class="cx"> showDefaultContentView()
</span><span class="cx"> {
</span><del>- // Implemneted by subclasses if needed to show a content view when no existing tree element is selected.
</del><ins>+ // Implemented by subclasses if needed to show a content view when no existing tree element is selected.
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> showDefaultContentViewForTreeElement(treeElement)
</span><span class="lines">@@ -195,6 +192,7 @@
</span><span class="cx"> console.assert(treeElement.representedObject);
</span><span class="cx"> if (!treeElement || !treeElement.representedObject)
</span><span class="cx"> return;
</span><ins>+
</ins><span class="cx"> this.contentBrowser.showContentViewForRepresentedObject(treeElement.representedObject);
</span><span class="cx"> treeElement.revealAndSelect(true, false, true, true);
</span><span class="cx"> }
</span><span class="lines">@@ -417,6 +415,31 @@
</span><span class="cx"> this._updateContentOverflowShadowVisibility();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ // Protected
+
+ pruneStaleResourceTreeElements()
+ {
+ if (this._checkForStaleResourcesTimeoutIdentifier) {
+ clearTimeout(this._checkForStaleResourcesTimeoutIdentifier);
+ this._checkForStaleResourcesTimeoutIdentifier = undefined;
+ }
+
+ for (var contentTreeOutline of this._visibleContentTreeOutlines) {
+ // Check all the ResourceTreeElements at the top level to make sure their Resource still has a parentFrame in the frame hierarchy.
+ // If the parentFrame is no longer in the frame hierarchy we know it was removed due to a navigation or some other page change and
+ // we should remove the issues for that resource.
+ for (var i = contentTreeOutline.children.length - 1; i >= 0; --i) {
+ var treeElement = contentTreeOutline.children[i];
+ if (!(treeElement instanceof WebInspector.ResourceTreeElement))
+ continue;
+
+ var resource = treeElement.resource;
+ if (!resource.parentFrame || resource.parentFrame.isDetached())
+ contentTreeOutline.removeChildAtIndex(i, true, true);
+ }
+ }
+ }
+
</ins><span class="cx"> // Private
</span><span class="cx">
</span><span class="cx"> _updateContentOverflowShadowVisibilitySoon()
</span><span class="lines">@@ -531,7 +554,7 @@
</span><span class="cx"> this._updateContentOverflowShadowVisibilitySoon();
</span><span class="cx">
</span><span class="cx"> if (this.selected)
</span><del>- this._checkElementsForPendingViewStateCookie(treeElement);
</del><ins>+ this._checkElementsForPendingViewStateCookie([treeElement]);
</ins><span class="cx">
</span><span class="cx"> this.treeElementAddedOrChanged(treeElement);
</span><span class="cx"> }
</span><span class="lines">@@ -588,36 +611,22 @@
</span><span class="cx"> generateColoredImagesForCSS("Images/DisclosureTriangleSmallClosed.svg", specifications, 13, 13, WebInspector.NavigationSidebarPanel.DisclosureTriangleClosedCanvasIdentifier);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- _checkForOldResources(event)
</del><ins>+ _checkForStaleResourcesIfNeeded()
</ins><span class="cx"> {
</span><del>- if (this._checkForOldResourcesTimeoutIdentifier)
</del><ins>+ if (!this._checkForStaleResourcesTimeoutIdentifier || !this._shouldAutoPruneStaleTopLevelResourceTreeElements)
</ins><span class="cx"> return;
</span><ins>+ this.pruneStaleResourceTreeElements();
+ }
</ins><span class="cx">
</span><del>- function delayedWork()
- {
- delete this._checkForOldResourcesTimeoutIdentifier;
</del><ins>+ _checkForStaleResources(event)
+ {
+ console.assert(this._shouldAutoPruneStaleTopLevelResourceTreeElements);
</ins><span class="cx">
</span><del>- var contentTreeOutline = this.contentTreeOutlineToAutoPrune;
</del><ins>+ if (this._checkForStaleResourcesTimeoutIdentifier)
+ return;
</ins><span class="cx">
</span><del>- // Check all the ResourceTreeElements at the top level to make sure their Resource still has a parentFrame in the frame hierarchy.
- // If the parentFrame is no longer in the frame hierarchy we know it was removed due to a navigation or some other page change and
- // we should remove the issues for that resource.
- for (var i = contentTreeOutline.children.length - 1; i >= 0; --i) {
- var treeElement = contentTreeOutline.children[i];
- if (!(treeElement instanceof WebInspector.ResourceTreeElement))
- continue;
-
- var resource = treeElement.resource;
- if (!resource.parentFrame || resource.parentFrame.isDetached())
- contentTreeOutline.removeChildAtIndex(i, true, true);
- }
-
- if (typeof this._updateEmptyContentPlaceholder === "function")
- this._updateEmptyContentPlaceholder();
- }
-
- // Check on a delay to coalesce multiple calls to _checkForOldResources.
- this._checkForOldResourcesTimeoutIdentifier = setTimeout(delayedWork.bind(this), 0);
</del><ins>+ // Check on a delay to coalesce multiple calls to _checkForStaleResources.
+ this._checkForStaleResourcesTimeoutIdentifier = setTimeout(this.pruneStaleResourceTreeElements.bind(this));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> _isTreeElementWithoutRepresentedObject(treeElement)
</span><span class="lines">@@ -633,6 +642,8 @@
</span><span class="cx"> if (!this._pendingViewStateCookie)
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+ this._checkForStaleResourcesIfNeeded();
+
</ins><span class="cx"> var visibleTreeElements = [];
</span><span class="cx"> this._visibleContentTreeOutlines.forEach(function(outline) {
</span><span class="cx"> var currentTreeElement = outline.hasChildren ? outline.children[0] : null;
</span><span class="lines">@@ -678,9 +689,6 @@
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (!(treeElements instanceof Array))
- treeElements = [treeElements];
-
</del><span class="cx"> var matchedElement = null;
</span><span class="cx"> treeElements.some(function(element) {
</span><span class="cx"> if (treeElementMatchesCookie.call(this, element)) {
</span></span></pre></div>
<a id="branchessafari601132branchSourceWebInspectorUIUserInterfaceViewsTabContentViewjs"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/TabContentView.js (184262 => 184263)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/TabContentView.js        2015-05-13 05:31:25 UTC (rev 184262)
+++ branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/TabContentView.js        2015-05-13 05:33:03 UTC (rev 184263)
</span><span class="lines">@@ -107,15 +107,15 @@
</span><span class="cx"> return false;
</span><span class="cx"> },
</span><span class="cx">
</span><del>- restoreStateFromCookie: function(causedByReload)
</del><ins>+ restoreStateFromCookie: function(causedByNavigation)
</ins><span class="cx"> {
</span><span class="cx"> if (!this.navigationSidebarPanel)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- var matchTypeOnlyDelayForReload = 2000;
</del><ins>+ var matchTypeOnlyDelayForNavigation = 2000;
</ins><span class="cx"> var matchTypeOnlyDelayForReopen = 1000;
</span><span class="cx">
</span><del>- var relaxMatchDelay = causedByReload ? matchTypeOnlyDelayForReload : matchTypeOnlyDelayForReopen;
</del><ins>+ var relaxMatchDelay = causedByNavigation ? matchTypeOnlyDelayForNavigation : matchTypeOnlyDelayForReopen;
</ins><span class="cx"> this.navigationSidebarPanel.restoreStateFromCookie(this._cookieSetting.value || {}, relaxMatchDelay);
</span><span class="cx"> },
</span><span class="cx">
</span><span class="lines">@@ -124,7 +124,7 @@
</span><span class="cx"> if (!this.navigationSidebarPanel)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- var cookie = this._cookieSetting.value || {};
</del><ins>+ var cookie = {};
</ins><span class="cx"> this.navigationSidebarPanel.saveStateToCookie(cookie);
</span><span class="cx"> this._cookieSetting.value = cookie;
</span><span class="cx"> },
</span></span></pre>
</div>
</div>
</body>
</html>