[Webkit-unassigned] [Bug 142891] New: Web Inspector: Adopt ES6 Class Syntax for all View Objects.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Mar 19 18:40:54 PDT 2015


https://bugs.webkit.org/show_bug.cgi?id=142891

            Bug ID: 142891
           Summary: Web Inspector: Adopt ES6 Class Syntax for all View
                    Objects.
    Classification: Unclassified
           Product: WebKit
           Version: 528+ (Nightly build)
          Hardware: All
                OS: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Web Inspector
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mattbaker at apple.com
                CC: graouts at webkit.org, joepeck at webkit.org,
                    jonowells at apple.com, mattbaker at apple.com,
                    nvasilyev at apple.com, timothy at apple.com,
                    webkit-bug-importer at group.apple.com

* 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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150320/dffe89a2/attachment-0002.html>


More information about the webkit-unassigned mailing list