Bug 54965 - Web Inspector: factor search logic out of inspector.js
Summary: Web Inspector: factor search logic out of inspector.js
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Andrey Kosyakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-22 09:06 PST by Andrey Kosyakov
Modified: 2011-03-03 07:46 PST (History)
10 users (show)

See Also:


Attachments
patch (29.51 KB, patch)
2011-02-22 09:17 PST, Andrey Kosyakov
pfeldman: review-
pfeldman: commit-queue-
Details | Formatted Diff | Diff
patch (29.67 KB, patch)
2011-02-24 10:22 PST, Andrey Kosyakov
no flags Details | Formatted Diff | Diff
patch (29.24 KB, patch)
2011-02-25 02:24 PST, Andrey Kosyakov
pfeldman: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Kosyakov 2011-02-22 09:06:06 PST
inspector.js is quite overcrowded, getting search logic moved to a separate class might get it a bit more readable.
Comment 1 Andrey Kosyakov 2011-02-22 09:17:04 PST
Created attachment 83332 [details]
patch
Comment 2 Pavel Feldman 2011-02-22 10:48:09 PST
Comment on attachment 83332 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=83332&action=review

> Source/WebCore/inspector/front-end/Object.js:92
> +WebInspector.declareSingleton = function(constructor)

I don't see why search controller is different from domAgent, debuggerAgent, etc. We should simply initialize it onload.

> Source/WebCore/inspector/front-end/ScriptsPanel.js:-1029
> -        WebInspector.updateSearchMatchesCount(0, this);

I think this call is still needed.

> Source/WebCore/inspector/front-end/SearchController.js:198
> +            for (var panelName in this.panels) {

I don't think your controller has panels. Please test this change thoroughly.

> Source/WebCore/inspector/front-end/SearchController.js:224
> +        this.currentQuery = query;

Could you encapsulate this?
Comment 3 Andrey Kosyakov 2011-02-24 10:22:12 PST
Created attachment 83677 [details]
patch
Comment 4 Andrey Kosyakov 2011-02-24 10:23:12 PST
(In reply to comment #2)
> (From update of attachment 83332 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=83332&action=review
> 
> > Source/WebCore/inspector/front-end/Object.js:92
> > +WebInspector.declareSingleton = function(constructor)
> 
> I don't see why search controller is different from domAgent, debuggerAgent, etc. We should simply initialize it onload.

done.

> 
> > Source/WebCore/inspector/front-end/ScriptsPanel.js:-1029
> > -        WebInspector.updateSearchMatchesCount(0, this);
> 
> I think this call is still needed.

Yup, indeed -- we're still calling it directly. Brought it back.

> > Source/WebCore/inspector/front-end/SearchController.js:198
> > +            for (var panelName in this.panels) {
> 
> I don't think your controller has panels. Please test this change thoroughly.

Thanks, fixed!

> 
> > Source/WebCore/inspector/front-end/SearchController.js:224
> > +        this.currentQuery = query;
> 
> Could you encapsulate this?

done.
Comment 5 Pavel Feldman 2011-02-24 10:38:34 PST
Comment on attachment 83677 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=83677&action=review

> Source/WebCore/WebCore.gypi:4772
> +            'inspector/front-end/SearchController.js',

Sc < Se

> Source/WebCore/WebCore.vcproj/WebCore.vcproj:66104
> +					RelativePath="..\inspector\front-end\SearchController.js"

ditto

> Source/WebCore/inspector/front-end/inspector.js:244
> +        if (!this._initializationComplete)

Why do we need this?
Comment 6 Andrey Kosyakov 2011-02-25 00:21:41 PST
(In reply to comment #5)
> (From update of attachment 83677 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=83677&action=review
> 
> > Source/WebCore/WebCore.gypi:4772
> > +            'inspector/front-end/SearchController.js',
> 
> Sc < Se
> 
> > Source/WebCore/WebCore.vcproj/WebCore.vcproj:66104
> > +					RelativePath="..\inspector\front-end\SearchController.js"
> 
> ditto
> 
> > Source/WebCore/inspector/front-end/inspector.js:244
> > +        if (!this._initializationComplete)
> 
> Why do we need this?

we create bulk of WebInspector objects in doLoadedDone, and set attached() is occasionally called before that. We used to check for individual fields there, but as their number is growing, I thought we'd better replace it with a single check for initialization being complete (thought we discussed it).
Comment 7 Andrey Kosyakov 2011-02-25 02:24:39 PST
Created attachment 83788 [details]
patch

- removed calls to resize() methods from set attached() (resize is supposed to be called along with set attached() in case we change attach mode)
- fixed files ordering
Comment 8 Andrey Kosyakov 2011-03-03 07:46:05 PST
Manually committed r80102: http://trac.webkit.org/changeset/80102