Closed
Bug 1125437
Opened 10 years ago
Closed 10 years ago
Get rid of SetPropertyAttributes and use DefineProperty to follow ES6 specification
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla38
Tracking | Status | |
---|---|---|
firefox38 | --- | fixed |
People
(Reporter: evilpie, Assigned: evilpie)
References
(Blocks 1 open bug)
Details
Attachments
(2 files, 2 obsolete files)
23.91 KB,
patch
|
efaust
:
review+
|
Details | Diff | Splinter Review |
8.72 KB,
patch
|
efaust
:
review+
|
Details | Diff | Splinter Review |
Bug 1122619 Comment 5
> Please file a bug, if you haven't already, blocking the es6 tracking bug: this
> doesn't follow the spec. We should get rid of SetPropertyAttributes and use
> JSPROP_IGNORE_ENUMERATE and JSPROP_IGNORE_VALUE to do this sort of partial
> DefineProperty.
Assignee | ||
Comment 1•10 years ago
|
||
I had to add checks for TypedArray, this should probably be a different bug.
Two tests:
ecma_5/extensions/reviver-mutates-holder-object-nonnative.js
ecma_5/extensions/reviver-mutates-holder-array-nonnative.js
Fail, but they are probably flawed, because you can't define something with configurable: true. Which should happen in the CreateDataProperty call per Spec.
Something weird that I noticed is that:
Object.defineProperty(t, 0, {configurable: true}) doesn't throw.
Assignee | ||
Comment 2•10 years ago
|
||
Oh and this didn't work either before:
x = new Int8Array(2)
Object.defineProperty(x, 0, {value: 2})
x[0] == 2
Assignee | ||
Comment 3•10 years ago
|
||
This fails less tests, because I moved the TypedArray checks into StandardDefineProperty in bug 1125628.
Assignee | ||
Updated•10 years ago
|
Attachment #8554179 -
Attachment is obsolete: true
Assignee | ||
Comment 4•10 years ago
|
||
Oh and I would much rather use the PropDesc version of StandardDefineProperty, but we first need to invent a good syntax for e.g. "enumerable" is absent/true/false.
Assignee | ||
Comment 5•10 years ago
|
||
Added tests and step annotations.
Attachment #8554282 -
Attachment is obsolete: true
Attachment #8554282 -
Flags: review?(jorendorff)
Attachment #8559126 -
Flags: review?(jorendorff)
Comment 6•10 years ago
|
||
Comment on attachment 8559126 [details] [diff] [review]
v2 - Remove SetPropertyAttributes
Review of attachment 8559126 [details] [diff] [review]:
-----------------------------------------------------------------
Stealing, as discussed on IRC. This is great. Glad to see this go. Drop-in attribute changes were unappropriately checked. r=me
::: js/src/jsobj.cpp
@@ +1152,5 @@
> RootedId id(cx);
> Rooted<PropertyDescriptor> desc(cx);
> +
> + const unsigned AllowConfigure = JSPROP_IGNORE_ENUMERATE | JSPROP_IGNORE_READONLY |
> + JSPROP_IGNORE_VALUE;
Man, I didn't expect people would actually *use* these when I added them. What a hack. Oh well, it's a useful stopgap.
Attachment #8559126 -
Flags: review?(jorendorff) → review+
Assignee | ||
Comment 7•10 years ago
|
||
Oh nice, getting this landed is going to be royal pain: https://treeherder.mozilla.org/#/jobs?repo=try&revision=be37a8a5539e
Assignee | ||
Comment 8•10 years ago
|
||
Okay I think I found the problem. When invoking defineProperty on a scripted proxy we forward to DirectProxyHandler::defineProperty, which uses CheckDefineProperty. This function doesn't handle JSPROP_IGNORE_VALUE, so it complains when trying to change a non-configurable and non-writable property.
e.g. QueryInterface is such a property, we invoke defineProperty(.., {configurable: false, writable: false}). But CheckDefineProperty sees a value of `undefined`, which is different from the QueryInterface function.
I am not quite sure why DirectProxyHandler::defineProperty uses CheckDefineProperty, instead of StandardDefineProperty. If we can't fix that we should at least change ScriptedDirectProxyHandler to call StandardDefineProperty instead.
Assignee | ||
Comment 9•10 years ago
|
||
Attachment #8562894 -
Flags: review?(efaustbmo)
Comment 10•10 years ago
|
||
Comment on attachment 8562894 [details] [diff] [review]
Remove CheckDefineProperty use StandardDefineProperty instead
Review of attachment 8562894 [details] [diff] [review]:
-----------------------------------------------------------------
Yes yes yes yes yes yes yes. So happy to see this go. It was horribly wrong, relative to the current spec.
Attachment #8562894 -
Flags: review?(efaustbmo) → review+
Assignee | ||
Comment 11•10 years ago
|
||
Comment 12•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/f4de5e527fbf
https://hg.mozilla.org/mozilla-central/rev/c93e99adfc7d
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
status-firefox38:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in
before you can comment on or make changes to this bug.
Description
•