Diff
Modified: branches/safari-601.1.32-branch/Source/WebInspectorUI/ChangeLog (184262 => 184263)
--- 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)
@@ -2,27 +2,89 @@
Dana Burkart <[email protected]
[email protected]>
- Merge r184108. rdar://problem/20903134
+ Merge r184130. rdar://problem/20829494
2015-05-11 Timothy Hatcher <[email protected]>
- Web Inspector: NavigationSidebarPanel leaks some event listeners
- https://bugs.webkit.org/show_bug.cgi?id=144523
+ Web Inspector: REGRESSION (Tabs): Issues reloading a resource with breakpoints
+ https://bugs.webkit.org/show_bug.cgi?id=144650
- Reviewed by Joseph Pecoraro.
+ 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.
+ 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.
+
* 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):
+ (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.
+ * 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 <[email protected]
+ [email protected]>
+
+ Merge r184108. rdar://problem/20903134
+
+ 2015-05-11 Timothy Hatcher <[email protected]>
+
+ 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):
+
2015-05-06 Matt Baker <[email protected]>
Web Inspector: The text in the left pane overlaps the "Filter Time Events" field in the Timeline after the Web Inspector is resized
Modified: branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Base/Main.js (184262 => 184263)
--- 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)
@@ -1116,7 +1116,9 @@
this._inProvisionalLoad = false;
- this._restoreCookieForOpenTabs();
+ // 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));
this._updateDownloadToolbarButton();
@@ -1133,13 +1135,13 @@
this._inProvisionalLoad = true;
};
-WebInspector._restoreCookieForOpenTabs = function(causedByReload)
+WebInspector._restoreCookieForOpenTabs = function(causedByNavigation)
{
for (var tabBarItem of this.tabBar.tabBarItems) {
var tabContentView = tabBarItem.representedObject;
if (!(tabContentView instanceof WebInspector.TabContentView))
continue;
- tabContentView.restoreStateFromCookie(causedByReload);
+ tabContentView.restoreStateFromCookie(causedByNavigation);
}
};
Modified: branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ContentView.js (184262 => 184263)
--- 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)
@@ -57,6 +57,11 @@
return new WebInspector.RenderingFrameTimelineView(representedObject, extraArguments);
}
+ if (representedObject instanceof WebInspector.Breakpoint) {
+ if (representedObject.sourceCodeLocation)
+ return new WebInspector.ContentView(representedObject.sourceCodeLocation.displaySourceCode, extraArguments);
+ }
+
if (representedObject instanceof WebInspector.DOMStorageObject)
return new WebInspector.DOMStorageContentView(representedObject, extraArguments);
@@ -147,6 +152,8 @@
return true;
if (representedObject instanceof WebInspector.Timeline)
return true;
+ if (representedObject instanceof WebInspector.Breakpoint)
+ return representedObject.sourceCodeLocation;
if (representedObject instanceof WebInspector.DOMStorageObject)
return true;
if (representedObject instanceof WebInspector.CookieStorageObject)
Modified: branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js (184262 => 184263)
--- 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)
@@ -279,7 +279,7 @@
return;
}
- var oldCurrentContentView = this.currentContentView;
+ var visibleContentView = this.currentContentView;
var backForwardListDidChange = false;
// Hide and disassociate with all the content views that are instances of the constructor.
@@ -288,7 +288,7 @@
if (!(entry.contentView instanceof constructor))
continue;
- if (entry.contentView === oldCurrentContentView)
+ if (entry.contentView === visibleContentView)
this._hideEntry(entry);
if (this._currentIndex >= i) {
@@ -307,7 +307,7 @@
var currentEntry = this.currentBackForwardEntry;
console.assert(currentEntry || (!currentEntry && this._currentIndex === -1));
- if (currentEntry && currentEntry.contentView !== oldCurrentContentView || backForwardListDidChange) {
+ if (currentEntry && currentEntry.contentView !== visibleContentView || backForwardListDidChange) {
this._showEntry(currentEntry, true);
this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange);
}
@@ -335,7 +335,7 @@
return;
}
- var oldCurrentContentView = this.currentContentView;
+ var visibleContentView = this.currentContentView;
var backForwardListDidChange = false;
// Hide and disassociate with all the content views that are the same as contentViewToClose.
@@ -344,7 +344,7 @@
if (entry.contentView !== contentViewToClose)
continue;
- if (entry.contentView === oldCurrentContentView)
+ if (entry.contentView === visibleContentView)
this._hideEntry(entry);
if (this._currentIndex >= i) {
@@ -363,7 +363,7 @@
var currentEntry = this.currentBackForwardEntry;
console.assert(currentEntry || (!currentEntry && this._currentIndex === -1));
- if (currentEntry && currentEntry.contentView !== oldCurrentContentView || backForwardListDidChange) {
+ if (currentEntry && currentEntry.contentView !== visibleContentView || backForwardListDidChange) {
this._showEntry(currentEntry, true);
this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange);
}
@@ -376,10 +376,12 @@
return;
}
+ var visibleContentView = this.currentContentView;
+
// Hide and disassociate with all the content views.
for (var i = 0; i < this._backForwardList.length; ++i) {
var entry = this._backForwardList[i];
- if (i === this._currentIndex)
+ if (entry.contentView === visibleContentView)
this._hideEntry(entry);
this._disassociateFromContentView(entry.contentView);
}
@@ -450,6 +452,9 @@
{
console.assert(!contentView.visible);
+ if (!contentView._parentContainer)
+ return;
+
contentView._parentContainer = null;
var representedObject = contentView.representedObject;
Modified: branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js (184262 => 184263)
--- 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)
@@ -31,7 +31,7 @@
this.contentBrowser = contentBrowser;
- WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceChanged, this);
+ WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceAdded, this);
WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange, this._breakpointsEnabledDidChange, this);
@@ -227,11 +227,15 @@
var representedObject = selectedTreeElement.representedObject;
- if (representedObject === WebInspector.debuggerManager.allExceptionsBreakpoint)
+ if (representedObject === WebInspector.debuggerManager.allExceptionsBreakpoint) {
cookie[WebInspector.DebuggerSidebarPanel.SelectedAllExceptionsCookieKey] = true;
+ return;
+ }
- if (representedObject === WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint)
+ if (representedObject === WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint) {
cookie[WebInspector.DebuggerSidebarPanel.SelectedAllUncaughtExceptionsCookieKey] = true;
+ return;
+ }
super.saveStateToCookie(cookie);
}
@@ -378,8 +382,16 @@
this._addIssuesForSourceCode(resource);
}
- _mainResourceChanged(event)
+ _mainResourceDidChange(event)
{
+ 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();
+ }
+
var resource = event.target.mainResource;
this._addTreeElementForSourceCodeToContentTreeOutline(resource);
this._addBreakpointsForSourceCode(resource);
Modified: branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js (184262 => 184263)
--- 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)
@@ -25,7 +25,7 @@
WebInspector.NavigationSidebarPanel = class NavigationSidebarPanel extends WebInspector.SidebarPanel
{
- constructor(identifier, displayName, autoPruneOldTopLevelResourceTreeElements, wantsTopOverflowShadow, element, role, label)
+ constructor(identifier, displayName, shouldAutoPruneStaleTopLevelResourceTreeElements, wantsTopOverflowShadow, element, role, label)
{
super(identifier, displayName, element, role, label || displayName);
@@ -68,10 +68,12 @@
this._generateStyleRulesIfNeeded();
this._generateDisclosureTrianglesIfNeeded();
- 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);
+ 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);
}
}
@@ -121,11 +123,6 @@
this._updateFilter();
}
- get contentTreeOutlineToAutoPrune()
- {
- return this._contentTreeOutline;
- }
-
get visibleContentTreeOutlines()
{
return this._visibleContentTreeOutlines;
@@ -186,7 +183,7 @@
showDefaultContentView()
{
- // Implemneted by subclasses if needed to show a content view when no existing tree element is selected.
+ // Implemented by subclasses if needed to show a content view when no existing tree element is selected.
}
showDefaultContentViewForTreeElement(treeElement)
@@ -195,6 +192,7 @@
console.assert(treeElement.representedObject);
if (!treeElement || !treeElement.representedObject)
return;
+
this.contentBrowser.showContentViewForRepresentedObject(treeElement.representedObject);
treeElement.revealAndSelect(true, false, true, true);
}
@@ -417,6 +415,31 @@
this._updateContentOverflowShadowVisibility();
}
+ // 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);
+ }
+ }
+ }
+
// Private
_updateContentOverflowShadowVisibilitySoon()
@@ -531,7 +554,7 @@
this._updateContentOverflowShadowVisibilitySoon();
if (this.selected)
- this._checkElementsForPendingViewStateCookie(treeElement);
+ this._checkElementsForPendingViewStateCookie([treeElement]);
this.treeElementAddedOrChanged(treeElement);
}
@@ -588,36 +611,22 @@
generateColoredImagesForCSS("Images/DisclosureTriangleSmallClosed.svg", specifications, 13, 13, WebInspector.NavigationSidebarPanel.DisclosureTriangleClosedCanvasIdentifier);
}
- _checkForOldResources(event)
+ _checkForStaleResourcesIfNeeded()
{
- if (this._checkForOldResourcesTimeoutIdentifier)
+ if (!this._checkForStaleResourcesTimeoutIdentifier || !this._shouldAutoPruneStaleTopLevelResourceTreeElements)
return;
+ this.pruneStaleResourceTreeElements();
+ }
- function delayedWork()
- {
- delete this._checkForOldResourcesTimeoutIdentifier;
+ _checkForStaleResources(event)
+ {
+ console.assert(this._shouldAutoPruneStaleTopLevelResourceTreeElements);
- var contentTreeOutline = this.contentTreeOutlineToAutoPrune;
+ if (this._checkForStaleResourcesTimeoutIdentifier)
+ return;
- // 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);
+ // Check on a delay to coalesce multiple calls to _checkForStaleResources.
+ this._checkForStaleResourcesTimeoutIdentifier = setTimeout(this.pruneStaleResourceTreeElements.bind(this));
}
_isTreeElementWithoutRepresentedObject(treeElement)
@@ -633,6 +642,8 @@
if (!this._pendingViewStateCookie)
return;
+ this._checkForStaleResourcesIfNeeded();
+
var visibleTreeElements = [];
this._visibleContentTreeOutlines.forEach(function(outline) {
var currentTreeElement = outline.hasChildren ? outline.children[0] : null;
@@ -678,9 +689,6 @@
});
}
- if (!(treeElements instanceof Array))
- treeElements = [treeElements];
-
var matchedElement = null;
treeElements.some(function(element) {
if (treeElementMatchesCookie.call(this, element)) {
Modified: branches/safari-601.1.32-branch/Source/WebInspectorUI/UserInterface/Views/TabContentView.js (184262 => 184263)
--- 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)
@@ -107,15 +107,15 @@
return false;
},
- restoreStateFromCookie: function(causedByReload)
+ restoreStateFromCookie: function(causedByNavigation)
{
if (!this.navigationSidebarPanel)
return;
- var matchTypeOnlyDelayForReload = 2000;
+ var matchTypeOnlyDelayForNavigation = 2000;
var matchTypeOnlyDelayForReopen = 1000;
- var relaxMatchDelay = causedByReload ? matchTypeOnlyDelayForReload : matchTypeOnlyDelayForReopen;
+ var relaxMatchDelay = causedByNavigation ? matchTypeOnlyDelayForNavigation : matchTypeOnlyDelayForReopen;
this.navigationSidebarPanel.restoreStateFromCookie(this._cookieSetting.value || {}, relaxMatchDelay);
},
@@ -124,7 +124,7 @@
if (!this.navigationSidebarPanel)
return;
- var cookie = this._cookieSetting.value || {};
+ var cookie = {};
this.navigationSidebarPanel.saveStateToCookie(cookie);
this._cookieSetting.value = cookie;
},