RESOLVED FIXED 177024
Web Inspector: introduce an AppController class and shared instance of it
https://bugs.webkit.org/show_bug.cgi?id=177024
Summary Web Inspector: introduce an AppController class and shared instance of it
Blaze Burg
Reported 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.
Attachments
Patch (26.57 KB, patch)
2017-09-15 14:12 PDT, Blaze Burg
no flags
For landing (26.89 KB, patch)
2017-09-18 13:21 PDT, Blaze Burg
no flags
Blaze Burg
Comment 1 2017-09-15 14:12:09 PDT
Matt Baker
Comment 2 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`?
Blaze Burg
Comment 3 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.
Blaze Burg
Comment 4 2017-09-18 13:21:26 PDT
Created attachment 321123 [details] For landing
WebKit Commit Bot
Comment 5 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>
WebKit Commit Bot
Comment 6 2017-09-18 14:33:45 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 7 2017-09-27 12:29:57 PDT
Note You need to log in before you can comment on or make changes to this bug.