Repository navigation
fix(patches): own-property lookups through a non-masking interceptor - #11
Merged
Merged
Conversation
If a receiver has a kNonMasking named interceptor and an object on its
prototype chain has a named interceptor of its own, an own-property
lookup on the receiver ended on that prototype instead of NOT_FOUND.
LookupIterator::NextInternal meant to treat the prototype's interceptor
as invisible, but it `continue`d inside `do { } while (!IsFound())`
while the state was still INTERCEPTOR, so the walk stopped there.
Prototype properties then read as own, `delete obj.m` removed `m` from
the prototype, and sets and defineProperty reached the prototype's
interceptor instead of the receiver's.
v8_nonmasking_own_lookup.patch steps past the invisible interceptor (or
a passed access check) within the same holder, so its real properties
still count, and only moves on when nothing is found there. Indexed
interceptors are no longer skipped, matching upstream since
892dda71342. Reported upstream as crbug 585053531; applied on every
platform.
The iOS runtime's wrapper canary mode puts kNonMasking interceptors on
ObjC instances, whose prototypes already carry a named interceptor.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
edusperoni
marked this pull request as ready for review
November 12, 2026 23:12
edusperoni
added a commit
to NativeScript/android
that referenced
this pull request
Nov 22, 2026
### Description Bottom of a stacked series that ports the iOS wrapper lifetime modes (NativeScript/ios#558, #559's config, #561, #563; #576's leak probe is redesigned in #2130) to Android. Not ported: #559's `rooted` mode (it reads retain counts, which Java does not have) and #578 (a native-setter fast path in the canary write handler; on Android a write to a Java field still goes through V8 after the handler declines). No PR in the series has performance numbers yet. This PR changes only the V8 pin, so the new binary can be validated, and reverted, on its own. `V8_RELEASE` moves from `v8-14.9.207.39-7` to `-12`. Same V8 version and the same Android patches (`v8_resurrecting_finalizers.patch`, the JS dispatch table reservation, the Android build patch), plus two fixes for named interceptors and a fast path for stores a masking interceptor declines: - **`-10`, NativeScript/v8-buildscripts#11** (`v8_nonmasking_own_lookup.patch`, crbug 585053531): an own-property lookup on an object with a `kNonMasking` interceptor could end on a prototype's interceptor (`Object.hasOwn` true for a prototype-only name, `delete` reaching the prototype). - **`-11`, NativeScript/v8-buildscripts#13** (`v8_create_data_property_interceptor.patch`, `v8_interceptor_define_descriptor.patch`): `JSObject::CreateDataProperty` (define-semantics class fields once warm, `v8::Object::CreateDataProperty`) bypassed named interceptors, and a definer received a plain data property with every attribute inverted. - **`-12`, NativeScript/v8-buildscripts#15** (`v8_declined_interceptor_store_fast_path.patch`): when a masking named interceptor declines a store and the receiver already has that name as an own data field, the store IC overwrites the field directly instead of going through `Runtime_StorePropertyPastInterceptor`. Behind `--store-ic-declined-interceptor-fast-path`, on by default. On a phone, an expando overwrite on a canary goes from 178 to 105 ns; adding a property, writes that end at a prototype accessor, and everything else are unchanged. The canary mode later in this stack puts a masking named interceptor (setter, deleter, definer) on wrapper templates, and needs both. Nothing on Android uses a named interceptor on an instance template today, so this PR alone changes no behaviour. `-8` and `-9` add only Apple TV and Mac Catalyst variants. ### Testing Full suite on an arm64 API 35 emulator with the `-11` arm64 libraries: 1773 specs, 0 failures. With the `-12` patch (the #15 CI arm64 library), at the top of this stack on `main` at a59e6ba: 1895 / 1895 / 1909 specs, 0 failures, in `canary`/`all`, `canary`/`extended` and `resurrecting`. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Chores** * Updated the V8 release from 14.9.207.39-11 to 14.9.207.39-12. * V8 installations now verify that each requested ABI matches the selected release and record the release for each installed ABI. Libraries and release stamps that do not match the selected release are removed during installation. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.
Adds
v8_nonmasking_own_lookup.patch, a fix for a V8 lookup bug reported upstream as crbug 585053531. The iOS runtime needs it for an upcoming wrapper lifetime mode that putskNonMaskinginterceptors on ObjC instances.The bug
If a receiver has a
kNonMaskingnamed interceptor and an object on its prototype chain has a named interceptor of its own, an own-property lookup on the receiver ends on that prototype instead ofNOT_FOUND:Object.hasOwn(obj, "m")istruefor a prototype-onlym, andgetOwnPropertyDescriptorreturns a descriptor with novalue;delete obj.mdeletesmfrom the prototype, for every object sharing it;obj.x = vandObject.defineProperty(obj, "x", …)reach the prototype's setter or definer interceptor instead of the receiver's.In
LookupIterator::NextInternal, the visibility walk means to skip the prototype's interceptor (WebIDL named-property visibility), but itcontinues insidedo { } while (!IsFound())whilestate_is stillINTERCEPTOR, so the loop exits on the prototype.The patch
It steps past the invisible interceptor (or a passed access check) within the same holder, so that holder's real properties still count, and moves to the next holder only when nothing is found there. Indexed interceptors are no longer skipped, which is what upstream main has done since 892dda71342.
When upstream fixes it, the patch is dropped on the next V8 bump.