Skip to content

Commit 353e727

Browse files
committed
fix: invoke JS subclass property setters
1 parent 241c994 commit 353e727

3 files changed

Lines changed: 45 additions & 9 deletions

File tree

NativeScript/ffi/shared/bridge/HostObjects.mm

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1884,15 +1884,9 @@ NativeApiHostSetResult set(Runtime& runtime, const PropNameID& name, const Value
18841884
class_conformsToProtocol(object_getClass(object_),
18851885
@protocol(NativeApiClassBuilderProtocol));
18861886
if (isEngineExtendedInstance) {
1887-
#ifdef NATIVESCRIPT_NATIVE_API_HOST_EXPLICIT_OVERRIDE
18881887
if (invokeEnginePrototypeSetter(runtime, property, value)) {
18891888
NATIVE_API_SET_RETURN(true);
18901889
}
1891-
#else
1892-
if (enginePrototypeHasSetter(runtime, property)) {
1893-
NATIVE_API_SET_RETURN(false);
1894-
}
1895-
#endif
18961890
}
18971891

18981892
if (Class appearanceClass =

PROGRESS.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,44 @@ TypeScript/UI worklets.
1717

1818
## Latest Update - 2026-06-30
1919

20+
### 2026-06-30 02:42 EDT - JS subclass setters invoke prototype accessors directly on V8
21+
22+
- Scope check:
23+
- Still generic NativeScript runtime behavior required by the RN-module
24+
branch. No RNS-specific native implementation and no direct-engine backend
25+
refactor work.
26+
- Simulator-only rule remains active; no physical devices were used.
27+
- CI finding:
28+
- GitHub Actions run `28424196438` on `241c9943` kept setup, FFI boundary
29+
check, native build, CLI build, and macOS tests green.
30+
- iOS still had one failure:
31+
`ApiTests.js SpecialCaseProperty_When_CustomSelector_ImplementedInJS`.
32+
- `ApiTests.js NSMutableArrayMethods` still passed.
33+
- The failed assertion still showed repeated `getter` output with no
34+
`setter:true`, which means V8 did not continue from a native host setter
35+
miss into the JS prototype setter for this native-instance path.
36+
- Change:
37+
- JS-extended object property writes now invoke JS prototype setters directly
38+
before native metadata/runtime setters on every backend, matching the
39+
getter-side direct resolution behavior.
40+
- Plain unknown JS fields still use the existing expando/fallback behavior;
41+
only an actual JS prototype setter is invoked early.
42+
- Source coverage now guards that setter invocation is not gated by
43+
`NATIVESCRIPT_NATIVE_API_HOST_EXPLICIT_OVERRIDE` and still happens before
44+
native writable-property dispatch.
45+
- Verification:
46+
- Focused construction/property guard test passed:
47+
`node packages/react-native/test/runtime-instance-selector-base-dispatch.test.js`.
48+
- Runtime RN JS tests passed:
49+
`for f in packages/react-native/test/*.test.js; do node "$f" || exit 1; done`.
50+
- `git diff --check` passed.
51+
- `npm run check:ffi-boundaries` passed.
52+
- Existing generated macOS project compile/link passed with
53+
`xcodebuild -project dist/intermediates/macos/NativeScript.xcodeproj ...`.
54+
- Still next:
55+
- Commit/push this direct-setter fix and watch fresh PR CI. If iOS goes
56+
green, resume the RNS simulator parity sweep from this handoff.
57+
2058
### 2026-06-30 02:10 EDT - JS subclass setters prefer prototype accessors before native setters
2159

2260
- Scope check:

packages/react-native/test/runtime-instance-selector-base-dispatch.test.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ for (const relativePath of [
104104
"enginePrototypeHasSetter(runtime, property)",
105105
setIndex,
106106
);
107+
const setterGuardIndex = source.lastIndexOf(
108+
"#ifdef NATIVESCRIPT_NATIVE_API_HOST_EXPLICIT_OVERRIDE",
109+
explicitSetterIndex,
110+
);
107111

108112
assert(
109113
setIndex !== -1 &&
@@ -114,9 +118,9 @@ for (const relativePath of [
114118
fallbackSetterIndex !== -1 &&
115119
setIndex < explicitSetterIndex &&
116120
explicitSetterIndex < writableIndex &&
117-
setIndex < fallbackSetterIndex &&
118-
fallbackSetterIndex < writableIndex,
119-
`${relativePath}: JS-subclassed property writes should prefer prototype setters before native runtime setters on every backend`,
121+
setterGuardIndex < setIndex &&
122+
writableIndex < fallbackSetterIndex,
123+
`${relativePath}: JS-subclassed property writes should invoke prototype setters before native runtime setters on every backend`,
120124
);
121125
}
122126

0 commit comments

Comments
 (0)