Closed
Bug 1138499
Opened 10 years ago
Closed 10 years ago
Assert descriptor sanity on entry to DefineProperty and exit from GetOwnPropertyDescriptor
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
mozilla40
Tracking | Status | |
---|---|---|
firefox40 | --- | fixed |
People
(Reporter: jorendorff, Assigned: jorendorff)
References
(Blocks 1 open bug)
Details
Attachments
(4 files)
1.87 KB,
patch
|
Waldo
:
review+
|
Details | Diff | Splinter Review |
15.52 KB,
patch
|
Waldo
:
review+
|
Details | Diff | Splinter Review |
8.56 KB,
patch
|
Waldo
:
review+
|
Details | Diff | Splinter Review |
1.19 KB,
patch
|
Waldo
:
review+
|
Details | Diff | Splinter Review |
JSPropertyDescriptor has too many degrees of freedom relative to the spec. We need to start nailing some of this down.
Assignee | ||
Updated•10 years ago
|
Blocks: es6internalmethods
Assignee | ||
Comment 2•10 years ago
|
||
Assignee | ||
Comment 3•10 years ago
|
||
Assignee | ||
Comment 4•10 years ago
|
||
Attachment #8582009 -
Flags: review?(jwalden+bmo)
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → jorendorff
Status: NEW → ASSIGNED
Assignee | ||
Comment 5•10 years ago
|
||
Attachment #8583441 -
Flags: review?(jwalden+bmo)
Assignee | ||
Updated•10 years ago
|
Attachment #8582009 -
Attachment is obsolete: true
Attachment #8582009 -
Flags: review?(jwalden+bmo)
Assignee | ||
Comment 6•10 years ago
|
||
Attachment #8583442 -
Flags: review?(jwalden+bmo)
Assignee | ||
Comment 7•10 years ago
|
||
Attachment #8583444 -
Flags: review?(jwalden+bmo)
Assignee | ||
Updated•10 years ago
|
Attachment #8582009 -
Attachment is obsolete: false
Attachment #8582009 -
Flags: review?(jwalden+bmo)
Comment 8•10 years ago
|
||
Comment on attachment 8583441 [details] [diff] [review]
part 1 - Assert some basic rules on property descriptors on entry to DefineProperty and exit from GetOwnPropertyDescriptor
Review of attachment 8583441 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/jsapi-tests/testDefinePropertyIgnoredAttributes.cpp
@@ +48,2 @@
> CHECK(JS_DefineProperty(cx, obj, "foo", defineValue,
> + JSPROP_IGNORE_ENUMERATE | JSPROP_IGNORE_PERMANENT | JSPROP_SHARED,
Guh, these are so unreadable. :-( Can't wait until we make people construct descriptors to define or redefine properties, only.
@@ +78,5 @@
> CHECK(JS_GetPropertyDescriptor(cx, obj, "baz", &desc));
> CHECK(CheckDescriptor(desc, DataDescriptor, false, false, false));
>
> // Now again with a configurable property
> + CHECK(JS_DefineProperty(cx, obj, "quox", defineValue,
Hmm, someone misspelled quux.
::: js/src/proxy/BaseProxyHandler.cpp
@@ +54,5 @@
> if (!desc.object()) {
> vp.setUndefined();
> return true;
> }
> + desc.assertComplete();
Nothing against these, but why not add assertCompleteIfFound calls to getPropertyDescriptor and getOwnPropertyDescriptor directly, so that all callers get these enforced?
Attachment #8583441 -
Flags: review?(jwalden+bmo) → review+
Updated•10 years ago
|
Attachment #8583442 -
Flags: review?(jwalden+bmo) → review+
Comment 9•10 years ago
|
||
Comment on attachment 8583444 [details] [diff] [review]
part 3 - Flip JS_CHECK_ACCESSOR_FLAGS from a blacklist to a whitelist
Review of attachment 8583444 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/jsapi.h
@@ +2102,5 @@
> (static_cast<void>(sizeof(JS::detail::CheckIsCharacterLiteral(s))), \
> reinterpret_cast<To>(s))
>
> #define JS_CHECK_ACCESSOR_FLAGS(flags) \
> + (static_cast<mozilla::EnableIf<!((flags) & ~(JSPROP_ENUMERATE | JSPROP_PERMANENT))>::Type>(0), \
Minor preference for == 0 versus a ! there, since you're not testing something inherently boolean.
Attachment #8583444 -
Flags: review?(jwalden+bmo) → review+
Updated•10 years ago
|
Attachment #8582009 -
Flags: review?(jwalden+bmo) → review+
Assignee | ||
Comment 10•10 years ago
|
||
(In reply to Jeff Walden [:Waldo] (remove +bmo to email) from comment #8)
> ::: js/src/proxy/BaseProxyHandler.cpp
> > + desc.assertComplete();
>
> Nothing against these, but why not add assertCompleteIfFound calls to
> getPropertyDescriptor and getOwnPropertyDescriptor directly, so that all
> callers get these enforced?
Because they're virtual methods, with overloads scattered throughout the codebase. Also, many implementation have multiple returns. It would be too easy (for both me and later hackers) to forget to add the assertion somewhere, particularly when writing a new overload or adding a new path to an existing one, exactly the cases where the assertion is most wanted.
Assignee | ||
Comment 11•10 years ago
|
||
> Hmm, someone misspelled quux.
Fixed! :D
Assignee | ||
Comment 12•10 years ago
|
||
Backed out (along with every other patch from that massive push) in https://hg.mozilla.org/integration/mozilla-inbound/rev/386c8b5b73c0 for talos other timeouts:
https://treeherder.mozilla.org/#/jobs?repo=mozilla-inbound&revision=3fc49391f7fe&filter-searchStr=talos oth
Flags: needinfo?(jorendorff)
Assignee | ||
Comment 14•10 years ago
|
||
Assignee | ||
Updated•10 years ago
|
Flags: needinfo?(jorendorff)
Assignee | ||
Comment 15•10 years ago
|
||
Comment 16•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/725dbd169e90
https://hg.mozilla.org/mozilla-central/rev/f9c99e8ce207
https://hg.mozilla.org/mozilla-central/rev/034027f41aaf
https://hg.mozilla.org/mozilla-central/rev/b3ef9fce0df5
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
status-firefox40:
--- → fixed
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
Comment 17•10 years ago
|
||
This has caused topcrash regression 1150906 in nightly. Can you please either address that bug today or back this one out to get nightly back on good footing?
Flags: needinfo?(jorendorff)
Comment 19•10 years ago
|
||
Before bothering the sheriff, Jeff, could you backout this change?
Thanks
Flags: needinfo?(ryanvm) → needinfo?(jwalden+bmo)
Assignee | ||
Comment 21•10 years ago
|
||
I have a patch for this. More details to come in bug 1150906.
Updated•10 years ago
|
Flags: needinfo?(jwalden+bmo)
You need to log in
before you can comment on or make changes to this bug.
Description
•