Bug 177024 - Web Inspector: introduce an AppController class and shared instance of it
Summary: Web Inspector: introduce an AppController class and shared instance of it
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: BJ Burg
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-09-15 13:59 PDT by BJ Burg
Modified: 2017-09-27 12:29 PDT (History)
5 users (show)

See Also:


Attachments
Patch (26.57 KB, patch)
2017-09-15 14:12 PDT, BJ Burg
no flags Details | Formatted Diff | Diff
For landing (26.89 KB, patch)
2017-09-18 13:21 PDT, BJ Burg
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description BJ Burg 2017-09-15 13:59:38 PDT
Main.js and Test.js are doing a lot of the same things. We should have a singleton AppController rather than hanging a ton of singleton state off of the WI object.
This is a large project that will be completed incrementally.
Comment 1 BJ Burg 2017-09-15 14:12:09 PDT
Created attachment 320962 [details]
Patch
Comment 2 Matt Baker 2017-09-15 15:13:58 PDT
Comment on attachment 320962 [details]
Patch

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

Nice refactor, Main.js has become increasingly unwieldy. r=me with comments.

> Source/WebInspectorUI/UserInterface/Controllers/AppController.js:48
> +        for (var domain of domains) {

Use `let` throughout.

> Source/WebInspectorUI/UserInterface/Controllers/AppControllerBase.js:38
> +    get hasExtraDomains() { throw new Error("This method must be overridden by a subclass."); }

Since we use this pattern pretty heavily I'd go so far as to add a WI.NotImplementedError that has this text baked in.

> Source/WebInspectorUI/UserInterface/Main.html:829
> +        WI.sharedApp = new WI.AppController;

I'm not sure about this name. Why not simply `WI.appController`?
Comment 3 BJ Burg 2017-09-16 09:42:53 PDT
(In reply to Matt Baker from comment #2)
> Comment on attachment 320962 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=320962&action=review
> 
> Nice refactor, Main.js has become increasingly unwieldy. r=me with comments.
> 
> > Source/WebInspectorUI/UserInterface/Controllers/AppController.js:48
> > +        for (var domain of domains) {
> 
> Use `let` throughout.

Yup, I caught this later in the day.

> > Source/WebInspectorUI/UserInterface/Controllers/AppControllerBase.js:38
> > +    get hasExtraDomains() { throw new Error("This method must be overridden by a subclass."); }
> 
> Since we use this pattern pretty heavily I'd go so far as to add a
> WI.NotImplementedError that has this text baked in.

OK

> 
> > Source/WebInspectorUI/UserInterface/Main.html:829
> > +        WI.sharedApp = new WI.AppController;
> 
> I'm not sure about this name. Why not simply `WI.appController`?

It matches what is done in Cocoa, and it's shorter. It also makes it pretty obvious that this is a singleton.
Comment 4 BJ Burg 2017-09-18 13:21:26 PDT
Created attachment 321123 [details]
For landing
Comment 5 WebKit Commit Bot 2017-09-18 14:33:44 PDT
Comment on attachment 321123 [details]
For landing

Clearing flags on attachment: 321123

Committed r222181: <http://trac.webkit.org/changeset/222181>
Comment 6 WebKit Commit Bot 2017-09-18 14:33:45 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2017-09-27 12:29:57 PDT
<rdar://problem/34693386>