Closed
Bug 1317389
Opened 9 years ago
Closed 9 years ago
GeneratorFunction.prototype.constructor shouldn't be writable
Categories
(Core :: JavaScript: Standard Library, defect)
Core
JavaScript: Standard Library
Tracking
()
RESOLVED
FIXED
mozilla53
Tracking | Status | |
---|---|---|
firefox53 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
14.07 KB,
patch
|
anba
:
review+
|
Details | Diff | Splinter Review |
Test case:
---
var GeneratorFunctionPrototype = Object.getPrototypeOf(function*(){});
assertEq(Object.getOwnPropertyDescriptor(GeneratorFunctionPrototype, "constructor").writable, false);
---
Expected: Passes
Actual: Throws "Error: Assertion failed: got true, expected false"
ES2017 spec:
https://tc39.github.io/ecma262/#sec-generatorfunction.prototype.constructor
Assignee | ||
Comment 1•9 years ago
|
||
The ECMAScript spec treats GeneratorFunction and AsyncFunction as subclasses of Function and therefore it uses different default property attributes for the "constructor" and "prototype" properties.
Assignee: nobody → andrebargull
Status: NEW → ASSIGNED
Attachment #8810950 -
Flags: review?(jwalden+bmo)
Comment 2•9 years ago
|
||
Comment on attachment 8810950 [details] [diff] [review]
bug1317389.patch
Review of attachment 8810950 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/tests/ecma_6/Generators/properties.js
@@ +12,5 @@
> +
> +assertEqArray(Object.getOwnPropertyNames(GeneratorFunction).sort(), ["length", "name", "prototype"]);
> +assertEqArray(Object.getOwnPropertySymbols(GeneratorFunction), []);
> +
> +assertDeepEq(Object.getOwnPropertyDescriptor(GeneratorFunction, "length"), {
Don't encourage use of assertDeepEq, which way overtests stuff and is much worse for debugging stacks and such. Rather, add
function assertOwnDescriptor(obj, prop, expected)
{
var desc = Object.getOwnPropertyDescriptor(obj, prop);
if (desc === undefined)
{
assertEq(expected, undefined);
return;
}
assertEq(desc.enumerable, expected.enumerable);
assertEq(desc.configurable, expected.configurable);
if (Object.hasOwnProperty(desc, "value"))
{
assertEq(desc.value, expected.value);
assertEq(desc.writable, expected.writable);
}
else
{
assertEq(desc.get, expected.get);
assertEq(desc.set, expected.set);
}
}
and use that throughout these functions.
Attachment #8810950 -
Flags: review?(jwalden+bmo) → review+
Assignee | ||
Comment 3•9 years ago
|
||
Updated per review comments, carrying r+ from Waldo.
Attachment #8810950 -
Attachment is obsolete: true
Attachment #8811835 -
Flags: review+
Assignee | ||
Comment 4•9 years ago
|
||
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=e6e9025a3d296b4c267b07c7eeb4711493a7ca45
Keywords: checkin-needed
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/1c66c26641ea
Change property attributes for generator and async functions to match ES2015/2017. r=Waldo
Keywords: checkin-needed
Comment 6•9 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in
before you can comment on or make changes to this bug.
Description
•