Changeset 184130 in webkit
- Timestamp:
- May 11, 2015, 4:18:14 PM (11 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 7 edited
-
ChangeLog (modified) (1 diff)
-
UserInterface/Base/Main.js (modified) (3 diffs)
-
UserInterface/Views/ContentView.js (modified) (2 diffs)
-
UserInterface/Views/ContentViewContainer.js (modified) (8 diffs)
-
UserInterface/Views/DebuggerSidebarPanel.js (modified) (3 diffs)
-
UserInterface/Views/NavigationSidebarPanel.js (modified) (10 diffs)
-
UserInterface/Views/TabContentView.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r184108 r184130 1 2015-05-11 Timothy Hatcher <timothy@apple.com> 2 3 Web Inspector: REGRESSION (Tabs): Issues reloading a resource with breakpoints 4 https://bugs.webkit.org/show_bug.cgi?id=144650 5 6 Fix a number of issues with Debugger tab and navigation/reloading: 7 - Close old content views in the Debugger tab when main frame navigates. 8 - Prune old resource tree elements before attempting to restore a cookie that might match an old resource. 9 - Allow breakpoint selections to be restored from a saved cookie. 10 - Fix an assert when closing a content view that isn't the current index, but is the current view. 11 - Avoid calling closed() multiple times when a ContentView is in the back/forward list more than once. 12 - Make restoreStateFromCookie properly set and use the causedByNavigation argument for a longer restore delay. 13 - Create a new cookie object per tab instead of it being cumulative from the previous cookie. 14 15 Reviewed by Brian Burg. 16 17 * UserInterface/Base/Main.js: 18 (WebInspector._mainResourceDidChange): Delay calling _restoreCookieForOpenTabs to give time for sidebars 19 and tabs to respond to the main resource change. 20 (WebInspector._restoreCookieForOpenTabs): Rename causedByReload to causedByNavigation. Nothing special about 21 reload since we restore on all navigation. 22 23 * UserInterface/Views/ContentView.js: 24 (WebInspector.ContentView): Support Breakpoint as a represented object, which happens during a cookie restore. 25 (WebInspector.ContentView.isViewable): Ditto. 26 27 * UserInterface/Views/ContentViewContainer.js: 28 (WebInspector.ContentViewContainer.prototype.closeAllContentViews): Disassociate if the view is current and not just 29 the current entry index. This matches other close functions. This fixes an assert in _disassociateFromContentView. 30 (WebInspector.ContentViewContainer.prototype._disassociateFromContentView): Don't disassociate multiple times. This 31 avoids calling the closed() function on a view more than once. 32 33 * UserInterface/Views/DebuggerSidebarPanel.js: 34 (WebInspector.DebuggerSidebarPanel.prototype.saveStateToCookie): 35 (WebInspector.DebuggerSidebarPanel.prototype._mainResourceDidChange): Renamed from _mainResourceChanged. 36 Close all content views if this is the main frame. Also prune all old resources. Doing this now avoids a flash 37 of having old and new resources in the tree caused by the default delay in NavigationSidebarPanel's _checkForOldResources. 38 39 * UserInterface/Views/NavigationSidebarPanel.js: 40 (WebInspector.NavigationSidebarPanel): Set _autoPruneOldTopLevelResourceTreeElements for later. 41 (WebInspector.NavigationSidebarPanel.prototype.get contentTreeOutlineToAutoPrune): Deleted. 42 (WebInspector.NavigationSidebarPanel.prototype.showDefaultContentView): Fix typo. 43 (WebInspector.NavigationSidebarPanel.prototype.showDefaultContentViewForTreeElement): Fix whitespace. 44 (WebInspector.NavigationSidebarPanel.prototype.pruneOldResourceTreeElements): Added. Broken out from 45 _checkForOldResources.delayedWork so it can be called manually. Also check all visible tree outlines. 46 (WebInspector.NavigationSidebarPanel.prototype._treeElementAddedOrChanged): Pass treeElement in an array. 47 (WebInspector.NavigationSidebarPanel.prototype._checkForOldResourcesIfNeeded): Added. 48 (WebInspector.NavigationSidebarPanel.prototype._checkForOldResources): Call pruneOldResourceTreeElements on a delay. 49 (WebInspector.NavigationSidebarPanel.prototype._checkForOldResources.delayedWork): Deleted. 50 (WebInspector.NavigationSidebarPanel.prototype._checkOutlinesForPendingViewStateCookie): Call _checkForOldResourcesIfNeeded. 51 (WebInspector.NavigationSidebarPanel.prototype._checkElementsForPendingViewStateCookie): Remove array folding code. 52 53 * UserInterface/Views/TabContentView.js: 54 (WebInspector.TabContentView.prototype.restoreStateFromCookie): Rename causedByReload to causedByNavigation. 55 (WebInspector.TabContentView.prototype.saveStateToCookie): Don't allow the cookie to build on the old cookie. 56 1 57 2015-05-11 Timothy Hatcher <timothy@apple.com> 2 58 -
trunk/Source/WebInspectorUI/UserInterface/Base/Main.js
r184045 r184130 1126 1126 this._inProvisionalLoad = false; 1127 1127 1128 this._restoreCookieForOpenTabs(); 1128 // Run cookie restoration after we are sure all of the Tabs and NavigationSidebarPanels 1129 // have updated with respect to the main resource change. 1130 setTimeout(this._restoreCookieForOpenTabs.bind(this, true)); 1129 1131 1130 1132 this._updateDownloadToolbarButton(); … … 1143 1145 }; 1144 1146 1145 WebInspector._restoreCookieForOpenTabs = function(causedBy Reload)1147 WebInspector._restoreCookieForOpenTabs = function(causedByNavigation) 1146 1148 { 1147 1149 for (var tabBarItem of this.tabBar.tabBarItems) { … … 1149 1151 if (!(tabContentView instanceof WebInspector.TabContentView)) 1150 1152 continue; 1151 tabContentView.restoreStateFromCookie(causedBy Reload);1153 tabContentView.restoreStateFromCookie(causedByNavigation); 1152 1154 } 1153 1155 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/ContentView.js
r183816 r184130 58 58 } 59 59 60 if (representedObject instanceof WebInspector.Breakpoint) { 61 if (representedObject.sourceCodeLocation) 62 return new WebInspector.ContentView(representedObject.sourceCodeLocation.displaySourceCode, extraArguments); 63 } 64 60 65 if (representedObject instanceof WebInspector.DOMStorageObject) 61 66 return new WebInspector.DOMStorageContentView(representedObject, extraArguments); … … 148 153 if (representedObject instanceof WebInspector.Timeline) 149 154 return true; 155 if (representedObject instanceof WebInspector.Breakpoint) 156 return representedObject.sourceCodeLocation; 150 157 if (representedObject instanceof WebInspector.DOMStorageObject) 151 158 return true; -
trunk/Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js
r183733 r184130 280 280 } 281 281 282 var oldCurrentContentView = this.currentContentView;282 var visibleContentView = this.currentContentView; 283 283 284 284 var backForwardListDidChange = false; … … 289 289 continue; 290 290 291 if (entry.contentView === oldCurrentContentView)291 if (entry.contentView === visibleContentView) 292 292 this._hideEntry(entry); 293 293 … … 308 308 console.assert(currentEntry || (!currentEntry && this._currentIndex === -1)); 309 309 310 if (currentEntry && currentEntry.contentView !== oldCurrentContentView || backForwardListDidChange) {310 if (currentEntry && currentEntry.contentView !== visibleContentView || backForwardListDidChange) { 311 311 this._showEntry(currentEntry, true); 312 312 this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange); … … 336 336 } 337 337 338 var oldCurrentContentView = this.currentContentView;338 var visibleContentView = this.currentContentView; 339 339 340 340 var backForwardListDidChange = false; … … 345 345 continue; 346 346 347 if (entry.contentView === oldCurrentContentView)347 if (entry.contentView === visibleContentView) 348 348 this._hideEntry(entry); 349 349 … … 364 364 console.assert(currentEntry || (!currentEntry && this._currentIndex === -1)); 365 365 366 if (currentEntry && currentEntry.contentView !== oldCurrentContentView || backForwardListDidChange) {366 if (currentEntry && currentEntry.contentView !== visibleContentView || backForwardListDidChange) { 367 367 this._showEntry(currentEntry, true); 368 368 this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange); … … 376 376 return; 377 377 } 378 379 var visibleContentView = this.currentContentView; 378 380 379 381 // Hide and disassociate with all the content views. 380 382 for (var i = 0; i < this._backForwardList.length; ++i) { 381 383 var entry = this._backForwardList[i]; 382 if ( i === this._currentIndex)384 if (entry.contentView === visibleContentView) 383 385 this._hideEntry(entry); 384 386 this._disassociateFromContentView(entry.contentView); … … 450 452 { 451 453 console.assert(!contentView.visible); 454 455 if (!contentView._parentContainer) 456 return; 452 457 453 458 contentView._parentContainer = null; -
trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js
r183768 r184130 32 32 this.contentBrowser = contentBrowser; 33 33 34 WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResource Changed, this);34 WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this); 35 35 WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceAdded, this); 36 36 … … 228 228 var representedObject = selectedTreeElement.representedObject; 229 229 230 if (representedObject === WebInspector.debuggerManager.allExceptionsBreakpoint) 230 if (representedObject === WebInspector.debuggerManager.allExceptionsBreakpoint) { 231 231 cookie[WebInspector.DebuggerSidebarPanel.SelectedAllExceptionsCookieKey] = true; 232 233 if (representedObject === WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint) 232 return; 233 } 234 235 if (representedObject === WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint) { 234 236 cookie[WebInspector.DebuggerSidebarPanel.SelectedAllUncaughtExceptionsCookieKey] = true; 237 return; 238 } 235 239 236 240 super.saveStateToCookie(cookie); … … 379 383 } 380 384 381 _mainResourceChanged(event) 382 { 385 _mainResourceDidChange(event) 386 { 387 if (event.target.isMainFrame()) { 388 // Aggressively prune resources now so the old resources are removed before 389 // the new main resource is added below. This avoids a visual flash when the 390 // prune normally happens on a later event loop cycle. 391 this.pruneStaleResourceTreeElements(); 392 this.contentBrowser.contentViewContainer.closeAllContentViews(); 393 } 394 383 395 var resource = event.target.mainResource; 384 396 this._addTreeElementForSourceCodeToContentTreeOutline(resource); -
trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js
r184108 r184130 26 26 WebInspector.NavigationSidebarPanel = class NavigationSidebarPanel extends WebInspector.SidebarPanel 27 27 { 28 constructor(identifier, displayName, autoPruneOldTopLevelResourceTreeElements, wantsTopOverflowShadow, element, role, label)28 constructor(identifier, displayName, shouldAutoPruneStaleTopLevelResourceTreeElements, wantsTopOverflowShadow, element, role, label) 29 29 { 30 30 super(identifier, displayName, element, role, label || displayName); … … 69 69 this._generateDisclosureTrianglesIfNeeded(); 70 70 71 if (autoPruneOldTopLevelResourceTreeElements) { 72 WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._checkForOldResources, this); 73 WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasRemoved, this._checkForOldResources, this); 74 WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasRemoved, this._checkForOldResources, this); 71 this._shouldAutoPruneStaleTopLevelResourceTreeElements = shouldAutoPruneStaleTopLevelResourceTreeElements || false; 72 73 if (this._shouldAutoPruneStaleTopLevelResourceTreeElements) { 74 WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._checkForStaleResources, this); 75 WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasRemoved, this._checkForStaleResources, this); 76 WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasRemoved, this._checkForStaleResources, this); 75 77 } 76 78 } … … 120 122 121 123 this._updateFilter(); 122 }123 124 get contentTreeOutlineToAutoPrune()125 {126 return this._contentTreeOutline;127 124 } 128 125 … … 187 184 showDefaultContentView() 188 185 { 189 // Implem neted by subclasses if needed to show a content view when no existing tree element is selected.186 // Implemented by subclasses if needed to show a content view when no existing tree element is selected. 190 187 } 191 188 … … 196 193 if (!treeElement || !treeElement.representedObject) 197 194 return; 195 198 196 this.contentBrowser.showContentViewForRepresentedObject(treeElement.representedObject); 199 197 treeElement.revealAndSelect(true, false, true, true); … … 418 416 } 419 417 418 // Protected 419 420 pruneStaleResourceTreeElements() 421 { 422 if (this._checkForStaleResourcesTimeoutIdentifier) { 423 clearTimeout(this._checkForStaleResourcesTimeoutIdentifier); 424 this._checkForStaleResourcesTimeoutIdentifier = undefined; 425 } 426 427 for (var contentTreeOutline of this._visibleContentTreeOutlines) { 428 // Check all the ResourceTreeElements at the top level to make sure their Resource still has a parentFrame in the frame hierarchy. 429 // 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 430 // we should remove the issues for that resource. 431 for (var i = contentTreeOutline.children.length - 1; i >= 0; --i) { 432 var treeElement = contentTreeOutline.children[i]; 433 if (!(treeElement instanceof WebInspector.ResourceTreeElement)) 434 continue; 435 436 var resource = treeElement.resource; 437 if (!resource.parentFrame || resource.parentFrame.isDetached()) 438 contentTreeOutline.removeChildAtIndex(i, true, true); 439 } 440 } 441 } 442 420 443 // Private 421 444 … … 532 555 533 556 if (this.selected) 534 this._checkElementsForPendingViewStateCookie( treeElement);557 this._checkElementsForPendingViewStateCookie([treeElement]); 535 558 536 559 this.treeElementAddedOrChanged(treeElement); … … 589 612 } 590 613 591 _checkForOldResources(event) 592 { 593 if (this._checkForOldResourcesTimeoutIdentifier) 594 return; 595 596 function delayedWork() 597 { 598 delete this._checkForOldResourcesTimeoutIdentifier; 599 600 var contentTreeOutline = this.contentTreeOutlineToAutoPrune; 601 602 // Check all the ResourceTreeElements at the top level to make sure their Resource still has a parentFrame in the frame hierarchy. 603 // 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 604 // we should remove the issues for that resource. 605 for (var i = contentTreeOutline.children.length - 1; i >= 0; --i) { 606 var treeElement = contentTreeOutline.children[i]; 607 if (!(treeElement instanceof WebInspector.ResourceTreeElement)) 608 continue; 609 610 var resource = treeElement.resource; 611 if (!resource.parentFrame || resource.parentFrame.isDetached()) 612 contentTreeOutline.removeChildAtIndex(i, true, true); 613 } 614 615 if (typeof this._updateEmptyContentPlaceholder === "function") 616 this._updateEmptyContentPlaceholder(); 617 } 618 619 // Check on a delay to coalesce multiple calls to _checkForOldResources. 620 this._checkForOldResourcesTimeoutIdentifier = setTimeout(delayedWork.bind(this), 0); 614 _checkForStaleResourcesIfNeeded() 615 { 616 if (!this._checkForStaleResourcesTimeoutIdentifier || !this._shouldAutoPruneStaleTopLevelResourceTreeElements) 617 return; 618 this.pruneStaleResourceTreeElements(); 619 } 620 621 _checkForStaleResources(event) 622 { 623 console.assert(this._shouldAutoPruneStaleTopLevelResourceTreeElements); 624 625 if (this._checkForStaleResourcesTimeoutIdentifier) 626 return; 627 628 // Check on a delay to coalesce multiple calls to _checkForStaleResources. 629 this._checkForStaleResourcesTimeoutIdentifier = setTimeout(this.pruneStaleResourceTreeElements.bind(this)); 621 630 } 622 631 … … 633 642 if (!this._pendingViewStateCookie) 634 643 return; 644 645 this._checkForStaleResourcesIfNeeded(); 635 646 636 647 var visibleTreeElements = []; … … 678 689 }); 679 690 } 680 681 if (!(treeElements instanceof Array))682 treeElements = [treeElements];683 691 684 692 var matchedElement = null; -
trunk/Source/WebInspectorUI/UserInterface/Views/TabContentView.js
r183340 r184130 108 108 }, 109 109 110 restoreStateFromCookie: function(causedBy Reload)110 restoreStateFromCookie: function(causedByNavigation) 111 111 { 112 112 if (!this.navigationSidebarPanel) 113 113 return; 114 114 115 var matchTypeOnlyDelayFor Reload= 2000;115 var matchTypeOnlyDelayForNavigation = 2000; 116 116 var matchTypeOnlyDelayForReopen = 1000; 117 117 118 var relaxMatchDelay = causedBy Reload ? matchTypeOnlyDelayForReload: matchTypeOnlyDelayForReopen;118 var relaxMatchDelay = causedByNavigation ? matchTypeOnlyDelayForNavigation : matchTypeOnlyDelayForReopen; 119 119 this.navigationSidebarPanel.restoreStateFromCookie(this._cookieSetting.value || {}, relaxMatchDelay); 120 120 }, … … 125 125 return; 126 126 127 var cookie = this._cookieSetting.value ||{};127 var cookie = {}; 128 128 this.navigationSidebarPanel.saveStateToCookie(cookie); 129 129 this._cookieSetting.value = cookie;
Note:
See TracChangeset
for help on using the changeset viewer.