RESOLVED FIXED 142891
Web Inspector: Adopt ES6 Class Syntax for all View Objects.
https://bugs.webkit.org/show_bug.cgi?id=142891
Summary Web Inspector: Adopt ES6 Class Syntax for all View Objects.
Matt Baker
Reported 2015-03-19 18:40:54 PDT
* SUMMARY Adopt ES6 Class Syntax for all View Objects. Some view constructors (I'm looking at you, ContentView) follow an implicit factory pattern whereby the base class constructor returns a concrete type based on the represented object. We should make the factory pattern explicit using a static class method: class ContentView { static create(representedObject) { if (typeof representedObject === "string" || representedObject instanceof String) return new WebInspector.TextContentView(representedObject); // And so on... console.assert(!WebInspector.ContentView.isViewable(representedObject)); throw "Can't make a ContentView for an unknown representedObject."; } } * NOTES The const keyword isn't allowed in strict mode, and ES6 class method scope uses strict mode implicitly. Instances of const will need to be replaced with var.
Attachments
WIP (1.41 MB, patch)
2015-03-25 17:10 PDT, Timothy Hatcher
no flags
WIP (Ignore Space) (1.03 MB, patch)
2015-03-25 17:13 PDT, Timothy Hatcher
no flags
WIP (586.21 KB, patch)
2015-03-27 00:46 PDT, Timothy Hatcher
no flags
Radar WebKit Bug Importer
Comment 1 2015-03-19 18:41:22 PDT
Timothy Hatcher
Comment 2 2015-03-25 17:10:56 PDT
Timothy Hatcher
Comment 3 2015-03-25 17:13:17 PDT
Created attachment 249449 [details] WIP (Ignore Space)
Timothy Hatcher
Comment 4 2015-03-27 00:46:04 PDT
Created attachment 249557 [details] WIP Latest WIP after landing some of the working classes.
Note You need to log in before you can comment on or make changes to this bug.