Changeset 183713 in webkit
- Timestamp:
- May 2, 2015 2:36:12 AM (9 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r183671 r183713 1 2015-05-02 Timothy Hatcher <timothy@apple.com> 2 3 Web Inspector: REGRESSION: Resources section doesn't update after changes are made to a local file 4 https://bugs.webkit.org/show_bug.cgi?id=144512 5 6 The content view was being associated with the wrong represented object. This caused the code to use 7 the old main resource when showing the frame again. 8 9 Reviewed by Joseph Pecoraro. 10 11 * UserInterface/Base/Main.js: 12 (WebInspector._frameWasAdded.delayedWork): 13 (WebInspector._frameWasAdded): 14 With the changes in ResourceSidebarPanel, we need to delay showing the frame. 15 16 * UserInterface/Views/ContentBrowserTabContentView.js: 17 (WebInspector.ContentBrowserTabContentView.prototype.showRepresentedObject): 18 Avoid restoring state by calling cancelRestoringState(). Not fully related to this bug, 19 but it was preventing testing the cases. 20 21 * UserInterface/Views/ContentViewContainer.js: 22 (WebInspector.ContentViewContainer.prototype.contentViewForRepresentedObject): 23 This fixes the bug. Don't associate the content view with the Frame, associate it with 24 the Resource that we actually show. 25 26 * UserInterface/Views/NavigationSidebarPanel.js: 27 (WebInspector.NavigationSidebarPanel.prototype.cancelRestoringState): Added. 28 29 * UserInterface/Views/ResourceSidebarPanel.js: 30 (WebInspector.ResourceSidebarPanel): Remove unused _waitingForInitialMainFrame. 31 (WebInspector.ResourceSidebarPanel.prototype.treeElementForRepresentedObject): 32 (WebInspector.ResourceSidebarPanel.prototype._mainResourceDidChange): 33 (WebInspector.ResourceSidebarPanel.prototype._mainFrameDidChange): 34 (WebInspector.ResourceSidebarPanel.prototype._mainFrameMainResourceDidChange.delayedWork): 35 (WebInspector.ResourceSidebarPanel.prototype._mainFrameMainResourceDidChange): 36 Clean up how we show the main frame in the sidebar. This was a two step mess before. 37 1 38 2015-04-29 Timothy Hatcher <timothy@apple.com> 2 39 -
trunk/Source/WebInspectorUI/UserInterface/Base/Main.js
r183642 r183713 1093 1093 return; 1094 1094 1095 this.showSourceCodeForFrame(frame.id); 1095 function delayedWork() 1096 { 1097 this.showSourceCodeForFrame(frame.id); 1098 } 1099 1100 // Delay showing the frame since FrameWasAdded is called before MainFrameChanged. 1101 // Calling showSourceCodeForFrame before MainFrameChanged will show the frame then close it. 1102 setTimeout(delayedWork.bind(this)); 1096 1103 }; 1097 1104 -
trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowserTabContentView.js
r183642 r183713 181 181 showRepresentedObject: function(representedObject, cookie) 182 182 { 183 if (this.navigationSidebarPanel) 184 this.navigationSidebarPanel.cancelRestoringState(); 183 185 this.contentBrowser.showContentViewForRepresentedObject(representedObject, cookie); 184 186 }, -
trunk/Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js
r183422 r183713 115 115 return null; 116 116 117 // The representedObject can change in the constructor for ContentView. Remember the 118 // contentViews on the real representedObject and not the one originally supplied. 119 // The main case for this is a Frame being passed in and the main Resource being used. 120 representedObject = contentView.representedObject; 121 117 122 // Remember this content view for future calls. 118 123 if (!representedObject.__contentViews) -
trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js
r183579 r183713 140 140 } 141 141 142 cancelRestoringState() 143 { 144 if (!this._finalAttemptToRestoreViewStateTimeout) 145 return; 146 147 clearTimeout(this._finalAttemptToRestoreViewStateTimeout); 148 this._finalAttemptToRestoreViewStateTimeout = undefined; 149 } 150 142 151 createContentTreeOutline(dontHideByDefault, suppressFiltering) 143 152 { -
trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js
r183671 r183713 34 34 this.filterBar.placeholder = WebInspector.UIString("Filter Resource List"); 35 35 36 this._waitingForInitialMainFrame = true;36 WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this); 37 37 38 38 WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange, this._mainFrameDidChange, this); … … 111 111 112 112 // Only special case Script objects. 113 if (!(representedObject instanceof WebInspector.Script)) 113 if (!(representedObject instanceof WebInspector.Script)) { 114 console.error("Didn't find a TreeElement for representedObject", representedObject); 114 115 return null; 116 } 115 117 116 118 // If the Script has a URL we should have found it earlier. … … 140 142 // Private 141 143 144 _mainResourceDidChange(event) 145 { 146 if (!event.target.isMainFrame()) 147 return; 148 149 this._mainFrameMainResourceDidChange(event.target); 150 } 151 142 152 _mainFrameDidChange(event) 143 153 { 154 this._mainFrameMainResourceDidChange(WebInspector.frameResourceManager.mainFrame); 155 } 156 157 _mainFrameMainResourceDidChange(mainFrame) 158 { 159 this.contentBrowser.contentViewContainer.closeAllContentViews(); 160 144 161 if (this._mainFrameTreeElement) { 145 this._mainFrameTreeElement.frame.removeEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainFrameMainResourceDidChange, this);146 162 this.contentTreeOutline.removeChild(this._mainFrameTreeElement); 147 163 this._mainFrameTreeElement = null; 148 164 } 149 165 150 var newFrame = WebInspector.frameResourceManager.mainFrame; 151 if (newFrame) { 152 newFrame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainFrameMainResourceDidChange, this); 153 this._mainFrameTreeElement = new WebInspector.FrameTreeElement(newFrame); 154 this.contentTreeOutline.insertChild(this._mainFrameTreeElement, 0); 155 156 // Select a tree element by default. Allow onselect if we aren't showing a content view. 166 if (!mainFrame) 167 return; 168 169 this._mainFrameTreeElement = new WebInspector.FrameTreeElement(mainFrame); 170 this.contentTreeOutline.insertChild(this._mainFrameTreeElement, 0); 171 172 function delayedWork() 173 { 157 174 if (!this.contentTreeOutline.selectedTreeElement) { 158 175 var currentContentView = this.contentBrowser.currentContentView; … … 164 181 } 165 182 166 // The navigation path needs update when the main frame changes, since all resources are under the main frame. 167 this.contentBrowser.updateHierarchicalPathForCurrentContentView(); 168 169 // We only care about the first time the main frame changes. 170 if (!this._waitingForInitialMainFrame) 171 return; 172 173 // Only if there is a main frame. 174 if (!newFrame) 175 return; 176 177 this._waitingForInitialMainFrame = false; 178 } 179 180 _mainFrameMainResourceDidChange(event) 181 { 182 this.contentBrowser.contentViewContainer.closeAllContentViews(); 183 184 function delayedWork() 185 { 186 // Show the main frame since there is no content view showing. 187 // Cookie restoration will attempt to re-select the resource we were showing. 188 if (!this.contentBrowser.currentContentView) { 189 // NOTE: This selection, during provisional loading, won't be saved, so it is 190 // safe to do and not-clobber cookie restoration. 191 this.showDefaultContentViewForTreeElement(this._mainFrameTreeElement); 192 } 193 } 194 195 // Delay this work because other listeners of this event might not have fired yet. So selecting the main frame 196 // before those listeners do their work might cause the content of the old page to show instead of the new page. 197 setTimeout(delayedWork.bind(this), 0); 183 // Cookie restoration will attempt to re-select the resource we were showing. 184 // Give it time to do that before selecting the main frame resource. 185 setTimeout(delayedWork.bind(this)); 198 186 } 199 187
Note: See TracChangeset
for help on using the changeset viewer.