fix(runtime): OrdinarySet rejects a receiver-owned accessor instead of firing its setter#6063
Merged
Merged
Conversation
…wned accessor instead of firing its setter OrdinarySetWithOwnDescriptor step 2.d.i: when the descriptor found during the OrdinarySet walk is a data property (or absent, meaning CreateDataProperty) and the write must land on a Receiver that differs from the object walked, a RECEIVER-owned accessor makes the algorithm return false WITHOUT invoking the setter. The receiver's setter only fires when it is the descriptor found by the walk itself (the Accessor arm in `ordinary_set_with_receiver`), never through this CreateDataProperty-on-receiver tail. `create_or_update_receiver_property` previously called the receiver's setter for that sub-case and returned true, so `Reflect.set(target, k, v, receiverWithSetter)` where `target[k]` is a data property mis-fired the receiver's setter and reported success. Together with the typed-array `[[Set]]` fix in the previous commit this makes test262 built-ins/TypedArrayConstructors/internals/Set/key-is-valid-index-reflect-set pass (a typed-array element source, an accessor-bearing receiver). Verified on an internal Linux sweep host with zero regressions across built-ins/Reflect + Proxy + Object (3875 cases) and the broad TypedArray suite.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughIn ChangesProxy Set Path Fix
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OrdinarySetWithOwnDescriptor(sec-ordinarysetwithowndescriptor) step 2 handles the case where the descriptor found during the OrdinarySet walk is a data property (or absent →CreateDataProperty) and the write must land on aReceiverthat differs from the object walked. In that tail the Receiver's own descriptor decides the outcome:{ value }CreateDataPropertyPerry's
create_or_update_receiver_propertytail invoked the receiver's setter for the accessor sub-case (2.d.i) and returnedtrue. So aReflect.set(target, k, v, receiverWithSetter)wheretarget[k]is a data property mis-fired the receiver's setter and reported success. The receiver's setter must only run when it is the descriptor found by the OrdinarySet walk itself — served by the separateAccessorarm inordinary_set_with_receiver, never through thisCreateDataProperty-on-receiver tail. The accessor sub-case now returnsfalsewithout calling the setter.Validation
Built and tested on an internal Linux sweep host (
--release).built-ins/Reflect+Proxy+Object(3875 cases): byte-identical pass/fail between baseline and patched — 0 regressions.built-ins/TypedArray+TypedArrayConstructors(2184 cases): 0 regressions; combined with the typed-array[[Set]]fix merged in fix(runtime): typed-array integer-indexed [[Set]] spec rejection + coercion #6059 this flipsSet/key-is-valid-index-reflect-set.jsto passing (a typed-array element source with an accessor-bearing receiver — the exact data-source / accessor-receiver shape above). On its own the fix touches no other test262 verdict in these dirs but is a prerequisite for that case and is spec-correct.cargo fmt --all -- --checkclean; address-classification audit passes;proxy.rsstays under 2000 lines.Summary by CodeRabbit