Skip to content

Commit 427f9d9

Browse files
committed
remove unguarded getRootNode call (#26152)
I forgot to guard the `getRootNode` call in #26106 and it fails in IE8 and old jsdom. I consolidated the implementation a bit and removed the unguarded call DiffTrain build for [64acd39](64acd39) [View git log for this commit](https://github.com/facebook/react/commits/64acd3918a26d92773d3dd451a735603ef50d3a7)
1 parent c7ad6cb commit 427f9d9

28 files changed

+96
-104
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2de85d7c712ff0f052d9c92f8129ed476f8ce4d8
1+
64acd3918a26d92773d3dd451a735603ef50d3a7
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2de85d7c712ff0f052d9c92f8129ed476f8ce4d8
1+
64acd3918a26d92773d3dd451a735603ef50d3a7

compiled/facebook-www/React-dev.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (
2727
}
2828
"use strict";
2929

30-
var ReactVersion = "18.3.0-www-classic-2de85d7c7-20230210";
30+
var ReactVersion = "18.3.0-www-classic-64acd3918-20230210";
3131

3232
// ATTENTION
3333
// When adding new symbols to this file,

compiled/facebook-www/React-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (
2727
}
2828
"use strict";
2929

30-
var ReactVersion = "18.3.0-www-modern-2de85d7c7-20230210";
30+
var ReactVersion = "18.3.0-www-modern-64acd3918-20230210";
3131

3232
// ATTENTION
3333
// When adding new symbols to this file,

compiled/facebook-www/React-prod.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,4 +646,4 @@ exports.useSyncExternalStore = function (
646646
);
647647
};
648648
exports.useTransition = useTransition;
649-
exports.version = "18.3.0-www-classic-2de85d7c7-20230210";
649+
exports.version = "18.3.0-www-classic-64acd3918-20230210";

compiled/facebook-www/React-prod.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,4 +638,4 @@ exports.useSyncExternalStore = function (
638638
);
639639
};
640640
exports.useTransition = useTransition;
641-
exports.version = "18.3.0-www-modern-2de85d7c7-20230210";
641+
exports.version = "18.3.0-www-modern-64acd3918-20230210";

compiled/facebook-www/React-profiling.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ exports.useSyncExternalStore = function (
657657
);
658658
};
659659
exports.useTransition = useTransition;
660-
exports.version = "18.3.0-www-classic-2de85d7c7-20230210";
660+
exports.version = "18.3.0-www-classic-64acd3918-20230210";
661661

662662
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
663663
if (

compiled/facebook-www/React-profiling.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ exports.useSyncExternalStore = function (
649649
);
650650
};
651651
exports.useTransition = useTransition;
652-
exports.version = "18.3.0-www-modern-2de85d7c7-20230210";
652+
exports.version = "18.3.0-www-modern-64acd3918-20230210";
653653

654654
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
655655
if (

compiled/facebook-www/ReactART-dev.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
6969
return self;
7070
}
7171

72-
var ReactVersion = "18.3.0-www-classic-2de85d7c7-20230210";
72+
var ReactVersion = "18.3.0-www-classic-64acd3918-20230210";
7373

7474
var LegacyRoot = 0;
7575
var ConcurrentRoot = 1;

compiled/facebook-www/ReactART-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
6969
return self;
7070
}
7171

72-
var ReactVersion = "18.3.0-www-modern-2de85d7c7-20230210";
72+
var ReactVersion = "18.3.0-www-modern-64acd3918-20230210";
7373

7474
var LegacyRoot = 0;
7575
var ConcurrentRoot = 1;

compiled/facebook-www/ReactART-prod.classic.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9844,7 +9844,7 @@ var slice = Array.prototype.slice,
98449844
return null;
98459845
},
98469846
bundleType: 0,
9847-
version: "18.3.0-www-classic-2de85d7c7-20230210",
9847+
version: "18.3.0-www-classic-64acd3918-20230210",
98489848
rendererPackageName: "react-art"
98499849
};
98509850
var internals$jscomp$inline_1318 = {
@@ -9875,7 +9875,7 @@ var internals$jscomp$inline_1318 = {
98759875
scheduleRoot: null,
98769876
setRefreshHandler: null,
98779877
getCurrentFiber: null,
9878-
reconcilerVersion: "18.3.0-next-2de85d7c7-20230210"
9878+
reconcilerVersion: "18.3.0-next-64acd3918-20230210"
98799879
};
98809880
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
98819881
var hook$jscomp$inline_1319 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled/facebook-www/ReactART-prod.modern.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9509,7 +9509,7 @@ var slice = Array.prototype.slice,
95099509
return null;
95109510
},
95119511
bundleType: 0,
9512-
version: "18.3.0-www-modern-2de85d7c7-20230210",
9512+
version: "18.3.0-www-modern-64acd3918-20230210",
95139513
rendererPackageName: "react-art"
95149514
};
95159515
var internals$jscomp$inline_1309 = {
@@ -9540,7 +9540,7 @@ var internals$jscomp$inline_1309 = {
95409540
scheduleRoot: null,
95419541
setRefreshHandler: null,
95429542
getCurrentFiber: null,
9543-
reconcilerVersion: "18.3.0-next-2de85d7c7-20230210"
9543+
reconcilerVersion: "18.3.0-next-64acd3918-20230210"
95449544
};
95459545
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
95469546
var hook$jscomp$inline_1310 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled/facebook-www/ReactDOM-dev.classic.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9298,7 +9298,7 @@ var Dispatcher = Internals.Dispatcher;
92989298
var lastCurrentDocument = null;
92999299
var previousDispatcher = null;
93009300
function prepareToRenderResources(rootContainer) {
9301-
var rootNode = getRootNode(rootContainer);
9301+
var rootNode = getHoistableRoot(rootContainer);
93029302
lastCurrentDocument = getDocumentFromRoot(rootNode);
93039303
previousDispatcher = Dispatcher.current;
93049304
Dispatcher.current = ReactDOMClientDispatcher;
@@ -9317,7 +9317,7 @@ var ReactDOMClientDispatcher = {
93179317

93189318
var preloadPropsMap = new Map(); // getRootNode is missing from IE and old jsdom versions
93199319

9320-
function getRootNode(container) {
9320+
function getHoistableRoot(container) {
93219321
// $FlowFixMe[method-unbinding]
93229322
return typeof container.getRootNode === "function"
93239323
? /* $FlowFixMe[incompatible-return] Flow types this as returning a `Node`,
@@ -9328,7 +9328,7 @@ function getRootNode(container) {
93289328

93299329
function getCurrentResourceRoot() {
93309330
var currentContainer = getCurrentRootHostContainer();
9331-
return currentContainer ? getRootNode(currentContainer) : null;
9331+
return currentContainer ? getHoistableRoot(currentContainer) : null;
93329332
} // Preloads are somewhat special. Even if we don't have the Document
93339333
// used by the root that is rendering a component trying to insert a preload
93349334
// we can still seed the file cache by doing the preload on any document we have
@@ -9352,11 +9352,6 @@ function getDocumentForPreloads() {
93529352

93539353
function getDocumentFromRoot(root) {
93549354
return root.ownerDocument || root;
9355-
}
9356-
9357-
function getHoistableRoot(container) {
9358-
// Flow thinks getRootNode returns Node but we know it is actualy either a Document or ShadowRoot
9359-
return container.getRootNode();
93609355
} // --------------------------------------
93619356
// ReactDOM.Preload
93629357
// --------------------------------------
@@ -41950,7 +41945,7 @@ function createFiberRoot(
4195041945
return root;
4195141946
}
4195241947

41953-
var ReactVersion = "18.3.0-www-classic-2de85d7c7-20230210";
41948+
var ReactVersion = "18.3.0-www-classic-64acd3918-20230210";
4195441949

4195541950
function createPortal(
4195641951
children,

compiled/facebook-www/ReactDOM-dev.modern.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14037,7 +14037,7 @@ var Dispatcher = Internals.Dispatcher;
1403714037
var lastCurrentDocument = null;
1403814038
var previousDispatcher = null;
1403914039
function prepareToRenderResources(rootContainer) {
14040-
var rootNode = getRootNode(rootContainer);
14040+
var rootNode = getHoistableRoot(rootContainer);
1404114041
lastCurrentDocument = getDocumentFromRoot(rootNode);
1404214042
previousDispatcher = Dispatcher.current;
1404314043
Dispatcher.current = ReactDOMClientDispatcher;
@@ -14056,7 +14056,7 @@ var ReactDOMClientDispatcher = {
1405614056

1405714057
var preloadPropsMap = new Map(); // getRootNode is missing from IE and old jsdom versions
1405814058

14059-
function getRootNode(container) {
14059+
function getHoistableRoot(container) {
1406014060
// $FlowFixMe[method-unbinding]
1406114061
return typeof container.getRootNode === "function"
1406214062
? /* $FlowFixMe[incompatible-return] Flow types this as returning a `Node`,
@@ -14067,7 +14067,7 @@ function getRootNode(container) {
1406714067

1406814068
function getCurrentResourceRoot() {
1406914069
var currentContainer = getCurrentRootHostContainer();
14070-
return currentContainer ? getRootNode(currentContainer) : null;
14070+
return currentContainer ? getHoistableRoot(currentContainer) : null;
1407114071
} // Preloads are somewhat special. Even if we don't have the Document
1407214072
// used by the root that is rendering a component trying to insert a preload
1407314073
// we can still seed the file cache by doing the preload on any document we have
@@ -14091,11 +14091,6 @@ function getDocumentForPreloads() {
1409114091

1409214092
function getDocumentFromRoot(root) {
1409314093
return root.ownerDocument || root;
14094-
}
14095-
14096-
function getHoistableRoot(container) {
14097-
// Flow thinks getRootNode returns Node but we know it is actualy either a Document or ShadowRoot
14098-
return container.getRootNode();
1409914094
} // --------------------------------------
1410014095
// ReactDOM.Preload
1410114096
// --------------------------------------
@@ -41674,7 +41669,7 @@ function createFiberRoot(
4167441669
return root;
4167541670
}
4167641671

41677-
var ReactVersion = "18.3.0-www-modern-2de85d7c7-20230210";
41672+
var ReactVersion = "18.3.0-www-modern-64acd3918-20230210";
4167841673

4167941674
function createPortal(
4168041675
children,

compiled/facebook-www/ReactDOM-prod.classic.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,14 +1961,14 @@ var Dispatcher = Internals.Dispatcher,
19611961
previousDispatcher = null,
19621962
ReactDOMClientDispatcher = { preload: preload, preinit: preinit },
19631963
preloadPropsMap = new Map();
1964-
function getRootNode(container) {
1964+
function getHoistableRoot(container) {
19651965
return "function" === typeof container.getRootNode
19661966
? container.getRootNode()
19671967
: container.ownerDocument;
19681968
}
19691969
function getCurrentResourceRoot() {
19701970
var currentContainer = rootInstanceStackCursor.current;
1971-
return currentContainer ? getRootNode(currentContainer) : null;
1971+
return currentContainer ? getHoistableRoot(currentContainer) : null;
19721972
}
19731973
function getDocumentForPreloads() {
19741974
var root = getCurrentResourceRoot();
@@ -11726,7 +11726,7 @@ function commitMutationEffectsOnFiber(finishedWork, root) {
1172611726
break;
1172711727
case 3:
1172811728
propName = currentHoistableRoot;
11729-
currentHoistableRoot = root.containerInfo.getRootNode();
11729+
currentHoistableRoot = getHoistableRoot(root.containerInfo);
1173011730
recursivelyTraverseMutationEffects(root, finishedWork);
1173111731
currentHoistableRoot = propName;
1173211732
commitReconciliationEffects(finishedWork);
@@ -11739,7 +11739,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) {
1173911739
break;
1174011740
case 4:
1174111741
current = currentHoistableRoot;
11742-
currentHoistableRoot = finishedWork.stateNode.containerInfo.getRootNode();
11742+
currentHoistableRoot = getHoistableRoot(
11743+
finishedWork.stateNode.containerInfo
11744+
);
1174311745
recursivelyTraverseMutationEffects(root, finishedWork);
1174411746
commitReconciliationEffects(finishedWork);
1174511747
currentHoistableRoot = current;
@@ -13349,7 +13351,7 @@ function shouldAttemptToSuspendUntilDataResolves() {
1334913351
: !1;
1335013352
}
1335113353
function pushDispatcher(container) {
13352-
container = getRootNode(container);
13354+
container = getHoistableRoot(container);
1335313355
lastCurrentDocument = container.ownerDocument || container;
1335413356
previousDispatcher = Dispatcher.current;
1335513357
Dispatcher.current = ReactDOMClientDispatcher;
@@ -15433,7 +15435,7 @@ Internals.Events = [
1543315435
var devToolsConfig$jscomp$inline_1743 = {
1543415436
findFiberByHostInstance: getClosestInstanceFromNode,
1543515437
bundleType: 0,
15436-
version: "18.3.0-www-classic-2de85d7c7-20230210",
15438+
version: "18.3.0-www-classic-64acd3918-20230210",
1543715439
rendererPackageName: "react-dom"
1543815440
};
1543915441
var internals$jscomp$inline_2106 = {
@@ -15463,7 +15465,7 @@ var internals$jscomp$inline_2106 = {
1546315465
scheduleRoot: null,
1546415466
setRefreshHandler: null,
1546515467
getCurrentFiber: null,
15466-
reconcilerVersion: "18.3.0-next-2de85d7c7-20230210"
15468+
reconcilerVersion: "18.3.0-next-64acd3918-20230210"
1546715469
};
1546815470
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1546915471
var hook$jscomp$inline_2107 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -15711,4 +15713,4 @@ exports.unstable_renderSubtreeIntoContainer = function (
1571115713
);
1571215714
};
1571315715
exports.unstable_runWithPriority = runWithPriority;
15714-
exports.version = "18.3.0-next-2de85d7c7-20230210";
15716+
exports.version = "18.3.0-next-64acd3918-20230210";

compiled/facebook-www/ReactDOM-prod.modern.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4268,14 +4268,14 @@ var Dispatcher = Internals.Dispatcher,
42684268
previousDispatcher = null,
42694269
ReactDOMClientDispatcher = { preload: preload, preinit: preinit },
42704270
preloadPropsMap = new Map();
4271-
function getRootNode(container) {
4271+
function getHoistableRoot(container) {
42724272
return "function" === typeof container.getRootNode
42734273
? container.getRootNode()
42744274
: container.ownerDocument;
42754275
}
42764276
function getCurrentResourceRoot() {
42774277
var currentContainer = rootInstanceStackCursor.current;
4278-
return currentContainer ? getRootNode(currentContainer) : null;
4278+
return currentContainer ? getHoistableRoot(currentContainer) : null;
42794279
}
42804280
function getDocumentForPreloads() {
42814281
var root = getCurrentResourceRoot();
@@ -11502,7 +11502,7 @@ function commitMutationEffectsOnFiber(finishedWork, root) {
1150211502
break;
1150311503
case 3:
1150411504
propName = currentHoistableRoot;
11505-
currentHoistableRoot = root.containerInfo.getRootNode();
11505+
currentHoistableRoot = getHoistableRoot(root.containerInfo);
1150611506
recursivelyTraverseMutationEffects(root, finishedWork);
1150711507
currentHoistableRoot = propName;
1150811508
commitReconciliationEffects(finishedWork);
@@ -11515,7 +11515,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) {
1151511515
break;
1151611516
case 4:
1151711517
current = currentHoistableRoot;
11518-
currentHoistableRoot = finishedWork.stateNode.containerInfo.getRootNode();
11518+
currentHoistableRoot = getHoistableRoot(
11519+
finishedWork.stateNode.containerInfo
11520+
);
1151911521
recursivelyTraverseMutationEffects(root, finishedWork);
1152011522
commitReconciliationEffects(finishedWork);
1152111523
currentHoistableRoot = current;
@@ -13125,7 +13127,7 @@ function shouldAttemptToSuspendUntilDataResolves() {
1312513127
: !1;
1312613128
}
1312713129
function pushDispatcher(container) {
13128-
container = getRootNode(container);
13130+
container = getHoistableRoot(container);
1312913131
lastCurrentDocument = container.ownerDocument || container;
1313013132
previousDispatcher = Dispatcher.current;
1313113133
Dispatcher.current = ReactDOMClientDispatcher;
@@ -14993,7 +14995,7 @@ Internals.Events = [
1499314995
var devToolsConfig$jscomp$inline_1711 = {
1499414996
findFiberByHostInstance: getClosestInstanceFromNode,
1499514997
bundleType: 0,
14996-
version: "18.3.0-www-modern-2de85d7c7-20230210",
14998+
version: "18.3.0-www-modern-64acd3918-20230210",
1499714999
rendererPackageName: "react-dom"
1499815000
};
1499915001
var internals$jscomp$inline_2081 = {
@@ -15024,7 +15026,7 @@ var internals$jscomp$inline_2081 = {
1502415026
scheduleRoot: null,
1502515027
setRefreshHandler: null,
1502615028
getCurrentFiber: null,
15027-
reconcilerVersion: "18.3.0-next-2de85d7c7-20230210"
15029+
reconcilerVersion: "18.3.0-next-64acd3918-20230210"
1502815030
};
1502915031
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1503015032
var hook$jscomp$inline_2082 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -15212,4 +15214,4 @@ exports.unstable_flushControlled = function (fn) {
1521215214
}
1521315215
};
1521415216
exports.unstable_runWithPriority = runWithPriority;
15215-
exports.version = "18.3.0-next-2de85d7c7-20230210";
15217+
exports.version = "18.3.0-next-64acd3918-20230210";

0 commit comments

Comments
 (0)