Closed Bug 1084019 Opened 11 years ago Closed 10 years ago

ES6 "name" property of functions should be configurable

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla38

People

(Reporter: bzbarsky, Assigned: till)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete, Whiteboard: [DocArea=JS])

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #911142 +++ Just like bug 911142 but for "name". Simple tests: Object.getOwnPropertyDescriptor(Object, "name").configurable Object.getOwnPropertyDescriptor(function foo(){}, "name").configurable
We had one really short test covering the previous behavior, it seems. I removed that and added tests covering everything I could think of. Slightly bungled (wrong commit message, forgot the reportCompare song-and-dance) try-run without web platform tests here: https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=b6348b75b5b7 New try run with issues fixed, but containing just the web platform tests: https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=3310bb12900e This builds on top of the similar patch for "length", so should land after or with that.
Attachment #8536237 - Flags: review?(jorendorff)
Assignee: nobody → till
Status: NEW → ASSIGNED
Comment on attachment 8536237 [details] [diff] [review] Make the "name" property of function objects configurable Review of attachment 8536237 [details] [diff] [review]: ----------------------------------------------------------------- Cool. Thanks. ::: js/src/jsfun.cpp @@ +489,5 @@ > if (isLength || JSID_IS_ATOM(id, cx->names().name)) { > MOZ_ASSERT(!IsInternalFunctionObject(obj)); > > RootedValue v(cx); > + // Since f.length and f.name are configurable, they could be resolved Blank line before this comment, please, as required by the style guide (except when the preceding line ends with '{'). ::: js/src/tests/ecma_6/Function/function-name.js @@ +6,5 @@ > + assertEq(f.name, ''); > + assertEq(f.hasOwnProperty('name'), false); > + f.name = 'g'; > + assertEq(f.name, ''); > + Object.defineProperty(f, 'name', {value: 'g'}); Could add one more assertion after this, since it should succeed in defining a new 'name' property. assertEq(f.name, 'g'); or something.
Attachment #8536237 - Flags: review?(jorendorff) → review+
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: