| Summary: |
Web Inspector: Adopt ES6 Class Syntax for all View Objects. |
| Product: |
WebKit
|
Reporter: |
Matt Baker <mattbaker> |
| Component: |
Web Inspector | Assignee: |
Nobody <webkit-unassigned> |
| Status: |
RESOLVED
FIXED
|
|
|
| Severity: |
Normal
|
CC: |
bburg, graouts, joepeck, jonowells, mattbaker, nvasilyev, timothy, webkit-bug-importer
|
| Priority: |
P2
|
Keywords: |
InRadar |
| Version: |
528+ (Nightly build) | |
|
| Hardware: |
All | |
|
| OS: |
All | |
|
| Bug Depends on: |
143106, 143107, 143108, 143111, 143127, 143128, 147439, 147534, 147658
|
|
|
| Bug Blocks: |
147409
|
|
|
| Attachments: |
|
* 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.