Skip to content

Commit 8118544

Browse files
committed
Store instance handles in an internal map behind flag (facebook#35053)
We already append `randomKey` to each handle name to prevent external libraries from accessing and relying on these internals. But more libraries recently have been getting around this by simply iterating over the element properties and using a `startsWith` check. This flag allows us to experiment with moving these handles to an internal map. This PR starts with the two most common internals, the props object and the fiber. We can consider moving additional properties such as the container root and others depending on perf results. DiffTrain build for [a44e750](facebook@a44e750)
1 parent 1e3ab94 commit 8118544

File tree

21 files changed

+374
-374
lines changed

21 files changed

+374
-374
lines changed

compiled-rn/VERSION_NATIVE_FB

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19.3.0-native-fb-5a2205ba-20251105
1+
19.3.0-native-fb-a44e750e-20251106

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<a3451b4c6044a2b624767274c04b6812>>
10+
* @generated SignedSource<<8e61891358f7e0d60ddd466988e2b63b>>
1111
*/
1212

1313
"use strict";
@@ -414,5 +414,5 @@ __DEV__ &&
414414
exports.useFormStatus = function () {
415415
return resolveDispatcher().useHostTransitionStatus();
416416
};
417-
exports.version = "19.3.0-native-fb-5a2205ba-20251105";
417+
exports.version = "19.3.0-native-fb-a44e750e-20251106";
418418
})();

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-prod.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<8083ada4555adb3f59242ece5f1b658f>>
10+
* @generated SignedSource<<0a25e0ffa641467931c94bed1ea89f75>>
1111
*/
1212

1313
"use strict";
@@ -209,4 +209,4 @@ exports.useFormState = function (action, initialState, permalink) {
209209
exports.useFormStatus = function () {
210210
return ReactSharedInternals.H.useHostTransitionStatus();
211211
};
212-
exports.version = "19.3.0-native-fb-5a2205ba-20251105";
212+
exports.version = "19.3.0-native-fb-a44e750e-20251106";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-profiling.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<8083ada4555adb3f59242ece5f1b658f>>
10+
* @generated SignedSource<<0a25e0ffa641467931c94bed1ea89f75>>
1111
*/
1212

1313
"use strict";
@@ -209,4 +209,4 @@ exports.useFormState = function (action, initialState, permalink) {
209209
exports.useFormStatus = function () {
210210
return ReactSharedInternals.H.useHostTransitionStatus();
211211
};
212-
exports.version = "19.3.0-native-fb-5a2205ba-20251105";
212+
exports.version = "19.3.0-native-fb-a44e750e-20251106";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-dev.js

Lines changed: 109 additions & 109 deletions
Large diffs are not rendered by default.

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<bc5cad4d1e7a6f824b84c33b7e5c77c2>>
10+
* @generated SignedSource<<91c4270acbc3574c9ad2fa8c35cbfede>>
1111
*/
1212

1313
/*
@@ -1032,8 +1032,8 @@ function detachDeletedInstance(node) {
10321032
delete node[internalEventHandlesSetKey];
10331033
}
10341034
function getClosestInstanceFromNode(targetNode) {
1035-
var targetInst = targetNode[internalInstanceKey];
1036-
if (targetInst) return targetInst;
1035+
var targetInst;
1036+
if ((targetInst = targetNode[internalInstanceKey])) return targetInst;
10371037
for (var parentNode = targetNode.parentNode; parentNode; ) {
10381038
if (
10391039
(targetInst =
@@ -13130,20 +13130,20 @@ function debounceScrollEnd(targetInst, nativeEvent, nativeEventTarget) {
1313013130
(nativeEventTarget[internalScrollTimer] = targetInst));
1313113131
}
1313213132
for (
13133-
var i$jscomp$inline_1621 = 0;
13134-
i$jscomp$inline_1621 < simpleEventPluginEvents.length;
13135-
i$jscomp$inline_1621++
13133+
var i$jscomp$inline_1622 = 0;
13134+
i$jscomp$inline_1622 < simpleEventPluginEvents.length;
13135+
i$jscomp$inline_1622++
1313613136
) {
13137-
var eventName$jscomp$inline_1622 =
13138-
simpleEventPluginEvents[i$jscomp$inline_1621],
13139-
domEventName$jscomp$inline_1623 =
13140-
eventName$jscomp$inline_1622.toLowerCase(),
13141-
capitalizedEvent$jscomp$inline_1624 =
13142-
eventName$jscomp$inline_1622[0].toUpperCase() +
13143-
eventName$jscomp$inline_1622.slice(1);
13137+
var eventName$jscomp$inline_1623 =
13138+
simpleEventPluginEvents[i$jscomp$inline_1622],
13139+
domEventName$jscomp$inline_1624 =
13140+
eventName$jscomp$inline_1623.toLowerCase(),
13141+
capitalizedEvent$jscomp$inline_1625 =
13142+
eventName$jscomp$inline_1623[0].toUpperCase() +
13143+
eventName$jscomp$inline_1623.slice(1);
1314413144
registerSimpleEvent(
13145-
domEventName$jscomp$inline_1623,
13146-
"on" + capitalizedEvent$jscomp$inline_1624
13145+
domEventName$jscomp$inline_1624,
13146+
"on" + capitalizedEvent$jscomp$inline_1625
1314713147
);
1314813148
}
1314913149
registerSimpleEvent(ANIMATION_END, "onAnimationEnd");
@@ -17483,16 +17483,16 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1748317483
0 === i && attemptExplicitHydrationTarget(target);
1748417484
}
1748517485
};
17486-
var isomorphicReactPackageVersion$jscomp$inline_2036 = React.version;
17486+
var isomorphicReactPackageVersion$jscomp$inline_2037 = React.version;
1748717487
if (
17488-
"19.3.0-native-fb-5a2205ba-20251105" !==
17489-
isomorphicReactPackageVersion$jscomp$inline_2036
17488+
"19.3.0-native-fb-a44e750e-20251106" !==
17489+
isomorphicReactPackageVersion$jscomp$inline_2037
1749017490
)
1749117491
throw Error(
1749217492
formatProdErrorMessage(
1749317493
527,
17494-
isomorphicReactPackageVersion$jscomp$inline_2036,
17495-
"19.3.0-native-fb-5a2205ba-20251105"
17494+
isomorphicReactPackageVersion$jscomp$inline_2037,
17495+
"19.3.0-native-fb-a44e750e-20251106"
1749617496
)
1749717497
);
1749817498
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -17512,24 +17512,24 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1751217512
null === componentOrElement ? null : componentOrElement.stateNode;
1751317513
return componentOrElement;
1751417514
};
17515-
var internals$jscomp$inline_2641 = {
17515+
var internals$jscomp$inline_2642 = {
1751617516
bundleType: 0,
17517-
version: "19.3.0-native-fb-5a2205ba-20251105",
17517+
version: "19.3.0-native-fb-a44e750e-20251106",
1751817518
rendererPackageName: "react-dom",
1751917519
currentDispatcherRef: ReactSharedInternals,
17520-
reconcilerVersion: "19.3.0-native-fb-5a2205ba-20251105"
17520+
reconcilerVersion: "19.3.0-native-fb-a44e750e-20251106"
1752117521
};
1752217522
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
17523-
var hook$jscomp$inline_2642 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
17523+
var hook$jscomp$inline_2643 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
1752417524
if (
17525-
!hook$jscomp$inline_2642.isDisabled &&
17526-
hook$jscomp$inline_2642.supportsFiber
17525+
!hook$jscomp$inline_2643.isDisabled &&
17526+
hook$jscomp$inline_2643.supportsFiber
1752717527
)
1752817528
try {
17529-
(rendererID = hook$jscomp$inline_2642.inject(
17530-
internals$jscomp$inline_2641
17529+
(rendererID = hook$jscomp$inline_2643.inject(
17530+
internals$jscomp$inline_2642
1753117531
)),
17532-
(injectedHook = hook$jscomp$inline_2642);
17532+
(injectedHook = hook$jscomp$inline_2643);
1753317533
} catch (err) {}
1753417534
}
1753517535
exports.createRoot = function (container, options) {
@@ -17624,4 +17624,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1762417624
listenToAllSupportedEvents(container);
1762517625
return new ReactDOMHydrationRoot(initialChildren);
1762617626
};
17627-
exports.version = "19.3.0-native-fb-5a2205ba-20251105";
17627+
exports.version = "19.3.0-native-fb-a44e750e-20251106";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-profiling.js

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<37aed56f2ce29601a23c7143c58d8a9b>>
10+
* @generated SignedSource<<86d767ca9e47a38cad4c471445d40f5e>>
1111
*/
1212

1313
/*
@@ -1112,8 +1112,8 @@ function detachDeletedInstance(node) {
11121112
delete node[internalEventHandlesSetKey];
11131113
}
11141114
function getClosestInstanceFromNode(targetNode) {
1115-
var targetInst = targetNode[internalInstanceKey];
1116-
if (targetInst) return targetInst;
1115+
var targetInst;
1116+
if ((targetInst = targetNode[internalInstanceKey])) return targetInst;
11171117
for (var parentNode = targetNode.parentNode; parentNode; ) {
11181118
if (
11191119
(targetInst =
@@ -15216,20 +15216,20 @@ function debounceScrollEnd(targetInst, nativeEvent, nativeEventTarget) {
1521615216
(nativeEventTarget[internalScrollTimer] = targetInst));
1521715217
}
1521815218
for (
15219-
var i$jscomp$inline_1934 = 0;
15220-
i$jscomp$inline_1934 < simpleEventPluginEvents.length;
15221-
i$jscomp$inline_1934++
15219+
var i$jscomp$inline_1935 = 0;
15220+
i$jscomp$inline_1935 < simpleEventPluginEvents.length;
15221+
i$jscomp$inline_1935++
1522215222
) {
15223-
var eventName$jscomp$inline_1935 =
15224-
simpleEventPluginEvents[i$jscomp$inline_1934],
15225-
domEventName$jscomp$inline_1936 =
15226-
eventName$jscomp$inline_1935.toLowerCase(),
15227-
capitalizedEvent$jscomp$inline_1937 =
15228-
eventName$jscomp$inline_1935[0].toUpperCase() +
15229-
eventName$jscomp$inline_1935.slice(1);
15223+
var eventName$jscomp$inline_1936 =
15224+
simpleEventPluginEvents[i$jscomp$inline_1935],
15225+
domEventName$jscomp$inline_1937 =
15226+
eventName$jscomp$inline_1936.toLowerCase(),
15227+
capitalizedEvent$jscomp$inline_1938 =
15228+
eventName$jscomp$inline_1936[0].toUpperCase() +
15229+
eventName$jscomp$inline_1936.slice(1);
1523015230
registerSimpleEvent(
15231-
domEventName$jscomp$inline_1936,
15232-
"on" + capitalizedEvent$jscomp$inline_1937
15231+
domEventName$jscomp$inline_1937,
15232+
"on" + capitalizedEvent$jscomp$inline_1938
1523315233
);
1523415234
}
1523515235
registerSimpleEvent(ANIMATION_END, "onAnimationEnd");
@@ -19587,16 +19587,16 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1958719587
0 === i && attemptExplicitHydrationTarget(target);
1958819588
}
1958919589
};
19590-
var isomorphicReactPackageVersion$jscomp$inline_2351 = React.version;
19590+
var isomorphicReactPackageVersion$jscomp$inline_2352 = React.version;
1959119591
if (
19592-
"19.3.0-native-fb-5a2205ba-20251105" !==
19593-
isomorphicReactPackageVersion$jscomp$inline_2351
19592+
"19.3.0-native-fb-a44e750e-20251106" !==
19593+
isomorphicReactPackageVersion$jscomp$inline_2352
1959419594
)
1959519595
throw Error(
1959619596
formatProdErrorMessage(
1959719597
527,
19598-
isomorphicReactPackageVersion$jscomp$inline_2351,
19599-
"19.3.0-native-fb-5a2205ba-20251105"
19598+
isomorphicReactPackageVersion$jscomp$inline_2352,
19599+
"19.3.0-native-fb-a44e750e-20251106"
1960019600
)
1960119601
);
1960219602
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -19616,12 +19616,12 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1961619616
null === componentOrElement ? null : componentOrElement.stateNode;
1961719617
return componentOrElement;
1961819618
};
19619-
var internals$jscomp$inline_2358 = {
19619+
var internals$jscomp$inline_2359 = {
1962019620
bundleType: 0,
19621-
version: "19.3.0-native-fb-5a2205ba-20251105",
19621+
version: "19.3.0-native-fb-a44e750e-20251106",
1962219622
rendererPackageName: "react-dom",
1962319623
currentDispatcherRef: ReactSharedInternals,
19624-
reconcilerVersion: "19.3.0-native-fb-5a2205ba-20251105",
19624+
reconcilerVersion: "19.3.0-native-fb-a44e750e-20251106",
1962519625
getLaneLabelMap: function () {
1962619626
for (
1962719627
var map = new Map(), lane = 1, index$326 = 0;
@@ -19639,16 +19639,16 @@ var internals$jscomp$inline_2358 = {
1963919639
}
1964019640
};
1964119641
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
19642-
var hook$jscomp$inline_2967 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
19642+
var hook$jscomp$inline_2968 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
1964319643
if (
19644-
!hook$jscomp$inline_2967.isDisabled &&
19645-
hook$jscomp$inline_2967.supportsFiber
19644+
!hook$jscomp$inline_2968.isDisabled &&
19645+
hook$jscomp$inline_2968.supportsFiber
1964619646
)
1964719647
try {
19648-
(rendererID = hook$jscomp$inline_2967.inject(
19649-
internals$jscomp$inline_2358
19648+
(rendererID = hook$jscomp$inline_2968.inject(
19649+
internals$jscomp$inline_2359
1965019650
)),
19651-
(injectedHook = hook$jscomp$inline_2967);
19651+
(injectedHook = hook$jscomp$inline_2968);
1965219652
} catch (err) {}
1965319653
}
1965419654
exports.createRoot = function (container, options) {
@@ -19744,4 +19744,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1974419744
listenToAllSupportedEvents(container);
1974519745
return new ReactDOMHydrationRoot(initialChildren);
1974619746
};
19747-
exports.version = "19.3.0-native-fb-5a2205ba-20251105";
19747+
exports.version = "19.3.0-native-fb-a44e750e-20251106";

0 commit comments

Comments
 (0)