Title: [199207] trunk/Source/WebInspectorUI
- Revision
- 199207
- Author
- [email protected]
- Date
- 2016-04-07 18:24:47 -0700 (Thu, 07 Apr 2016)
Log Message
Web Inspector: OpenResourceDialog should keep its resources list up-to-date
https://bugs.webkit.org/show_bug.cgi?id=155321
<rdar://problem/25093890>
Reviewed by Timothy Hatcher.
The Quick Open dialog should listen for resource change events, refreshing
the resource list and current query results as needed.
* UserInterface/Views/OpenResourceDialog.js:
(WebInspector.OpenResourceDialog):
(WebInspector.OpenResourceDialog.prototype.didDismissDialog):
Unregister resource event handlers.
(WebInspector.OpenResourceDialog.prototype.didPresentDialog):
Register resource event handlers and add main frame resources.
(WebInspector.OpenResourceDialog.prototype._addResource):
Add resource to the query controller, if valid. Optionally suppress
the potentially expensive filter update, which is useful when adding
multiple resources at once.
(WebInspector.OpenResourceDialog.prototype._addResourcesForFrame):
Add the entire frame resource tree and update dialog filter.
(WebInspector.OpenResourceDialog.prototype._mainResourceDidChange):
(WebInspector.OpenResourceDialog.prototype._resourceWasAdded):
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (199206 => 199207)
--- trunk/Source/WebInspectorUI/ChangeLog 2016-04-08 01:22:11 UTC (rev 199206)
+++ trunk/Source/WebInspectorUI/ChangeLog 2016-04-08 01:24:47 UTC (rev 199207)
@@ -1,3 +1,33 @@
+2016-04-07 Matt Baker <[email protected]>
+
+ Web Inspector: OpenResourceDialog should keep its resources list up-to-date
+ https://bugs.webkit.org/show_bug.cgi?id=155321
+ <rdar://problem/25093890>
+
+ Reviewed by Timothy Hatcher.
+
+ The Quick Open dialog should listen for resource change events, refreshing
+ the resource list and current query results as needed.
+
+ * UserInterface/Views/OpenResourceDialog.js:
+ (WebInspector.OpenResourceDialog):
+ (WebInspector.OpenResourceDialog.prototype.didDismissDialog):
+ Unregister resource event handlers.
+
+ (WebInspector.OpenResourceDialog.prototype.didPresentDialog):
+ Register resource event handlers and add main frame resources.
+
+ (WebInspector.OpenResourceDialog.prototype._addResource):
+ Add resource to the query controller, if valid. Optionally suppress
+ the potentially expensive filter update, which is useful when adding
+ multiple resources at once.
+
+ (WebInspector.OpenResourceDialog.prototype._addResourcesForFrame):
+ Add the entire frame resource tree and update dialog filter.
+
+ (WebInspector.OpenResourceDialog.prototype._mainResourceDidChange):
+ (WebInspector.OpenResourceDialog.prototype._resourceWasAdded):
+
2016-04-07 Joseph Pecoraro <[email protected]>
Web Inspector: ProfileView source links are off by 1 line, worse in pretty printed code
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.js (199206 => 199207)
--- trunk/Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.js 2016-04-08 01:22:11 UTC (rev 199206)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.js 2016-04-08 01:24:47 UTC (rev 199207)
@@ -120,27 +120,22 @@
didDismissDialog()
{
+ WebInspector.Frame.removeEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+ WebInspector.Frame.removeEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
+
this._queryController.reset();
}
didPresentDialog()
{
+ WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+ WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
+
+ if (WebInspector.frameResourceManager.mainFrame)
+ this._addResourcesForFrame(WebInspector.frameResourceManager.mainFrame);
+
this._inputElement.focus();
this._clear();
-
- let frames = [WebInspector.frameResourceManager.mainFrame];
- while (frames.length) {
- let frame = frames.shift();
- let resources = [frame.mainResource].concat(frame.resources);
- for (let resource of resources) {
- if (!this.representedObjectIsValid(resource))
- continue;
-
- this._queryController.addResource(resource);
- }
-
- frames = frames.concat(frame.childFrames);
- }
}
// Private
@@ -248,6 +243,48 @@
this.dismiss(treeElement.representedObject);
}
+
+ _addResource(resource, suppressFilterUpdate)
+ {
+ if (!this.representedObjectIsValid(resource))
+ return;
+
+ this._queryController.addResource(resource);
+ if (suppressFilterUpdate)
+ return;
+
+ this._updateFilter();
+ }
+
+ _addResourcesForFrame(frame)
+ {
+ const suppressFilterUpdate = true;
+
+ let frames = [frame];
+ while (frames.length) {
+ let currentFrame = frames.shift();
+ let resources = [currentFrame.mainResource].concat(currentFrame.resources);
+ for (let resource of resources)
+ this._addResource(resource, suppressFilterUpdate);
+
+ frames = frames.concat(frame.childFrames);
+ }
+
+ this._updateFilter();
+ }
+
+ _mainResourceDidChange(event)
+ {
+ if (event.target.isMainFrame())
+ this._queryController.reset();
+
+ this._addResource(event.target.mainResource);
+ }
+
+ _resourceWasAdded(event)
+ {
+ this._addResource(event.data.resource);
+ }
};
WebInspector.OpenResourceDialog.NonEmptyClassName = "non-empty";
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes