Changeset 199207 in webkit
- Timestamp:
- Apr 7, 2016 6:24:47 PM (8 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r199201 r199207 1 2016-04-07 Matt Baker <mattbaker@apple.com> 2 3 Web Inspector: OpenResourceDialog should keep its resources list up-to-date 4 https://bugs.webkit.org/show_bug.cgi?id=155321 5 <rdar://problem/25093890> 6 7 Reviewed by Timothy Hatcher. 8 9 The Quick Open dialog should listen for resource change events, refreshing 10 the resource list and current query results as needed. 11 12 * UserInterface/Views/OpenResourceDialog.js: 13 (WebInspector.OpenResourceDialog): 14 (WebInspector.OpenResourceDialog.prototype.didDismissDialog): 15 Unregister resource event handlers. 16 17 (WebInspector.OpenResourceDialog.prototype.didPresentDialog): 18 Register resource event handlers and add main frame resources. 19 20 (WebInspector.OpenResourceDialog.prototype._addResource): 21 Add resource to the query controller, if valid. Optionally suppress 22 the potentially expensive filter update, which is useful when adding 23 multiple resources at once. 24 25 (WebInspector.OpenResourceDialog.prototype._addResourcesForFrame): 26 Add the entire frame resource tree and update dialog filter. 27 28 (WebInspector.OpenResourceDialog.prototype._mainResourceDidChange): 29 (WebInspector.OpenResourceDialog.prototype._resourceWasAdded): 30 1 31 2016-04-07 Joseph Pecoraro <pecoraro@apple.com> 2 32 -
trunk/Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.js
r199143 r199207 121 121 didDismissDialog() 122 122 { 123 WebInspector.Frame.removeEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this); 124 WebInspector.Frame.removeEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this); 125 123 126 this._queryController.reset(); 124 127 } … … 126 129 didPresentDialog() 127 130 { 131 WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this); 132 WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this); 133 134 if (WebInspector.frameResourceManager.mainFrame) 135 this._addResourcesForFrame(WebInspector.frameResourceManager.mainFrame); 136 128 137 this._inputElement.focus(); 129 138 this._clear(); 130 131 let frames = [WebInspector.frameResourceManager.mainFrame];132 while (frames.length) {133 let frame = frames.shift();134 let resources = [frame.mainResource].concat(frame.resources);135 for (let resource of resources) {136 if (!this.representedObjectIsValid(resource))137 continue;138 139 this._queryController.addResource(resource);140 }141 142 frames = frames.concat(frame.childFrames);143 }144 139 } 145 140 … … 249 244 this.dismiss(treeElement.representedObject); 250 245 } 246 247 _addResource(resource, suppressFilterUpdate) 248 { 249 if (!this.representedObjectIsValid(resource)) 250 return; 251 252 this._queryController.addResource(resource); 253 if (suppressFilterUpdate) 254 return; 255 256 this._updateFilter(); 257 } 258 259 _addResourcesForFrame(frame) 260 { 261 const suppressFilterUpdate = true; 262 263 let frames = [frame]; 264 while (frames.length) { 265 let currentFrame = frames.shift(); 266 let resources = [currentFrame.mainResource].concat(currentFrame.resources); 267 for (let resource of resources) 268 this._addResource(resource, suppressFilterUpdate); 269 270 frames = frames.concat(frame.childFrames); 271 } 272 273 this._updateFilter(); 274 } 275 276 _mainResourceDidChange(event) 277 { 278 if (event.target.isMainFrame()) 279 this._queryController.reset(); 280 281 this._addResource(event.target.mainResource); 282 } 283 284 _resourceWasAdded(event) 285 { 286 this._addResource(event.data.resource); 287 } 251 288 }; 252 289
Note: See TracChangeset
for help on using the changeset viewer.