Bug 190140

Summary: Incorrect "name" property set for class expression without BindingIdentifier
Product: WebKit Reporter: gsouza
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: fpizlo, gsouza, keith_miller, mark.lam, ysuzuki
Priority: P2    
Version: Safari 11   
Hardware: Mac   
OS: macOS 10.13   

gsouza
Reported 2018-10-01 09:31:57 PDT
The "name" property in the constructor function for an anonymous class expression is incorrectly set to an empty string in JavaScriptCore: // Webkit/JavaScriptCore (class {}).hasOwnProperty('name') // true (class extends (class A{}){}).hasOwnProperty('name') // true (class extends(class A{}){}).name // '' // Other spec-compliant JS engines (class {}).hasOwnProperty('name') // false (class extends (class A{}){}).hasOwnProperty('name') // false (class extends(class A{}){}).name // 'A' The ES6 spec states that SetFunctionName(value, className) should only be called when className is not undefined, which isn't the case for anonymous class expressions: http://www.ecma-international.org/ecma-262/6.0/#sec-class-definitions-runtime-semantics-evaluation
Attachments
Note You need to log in before you can comment on or make changes to this bug.