Skip to content

Commit 8994451

Browse files
committed
Allow empty string to be passed to formAction (#26379)
We disallow empty strings for `href` and `src` since they're common mistakes that end up loading the current page as a preload, image or link. We also disallow it for `action`. You have to pass `null` which is the same. However, for `formAction` passing `null` is not the same as passing empty string. Passing empty string overrides the form's action to be the current page even if the form's action was set to something else. There's no easy way to express the same thing `#` show up in the user visible URLs and `?` clears the search params. Since this is also not a common mistake, we can just allow this. DiffTrain build for [2788d0d](2788d0d)
1 parent 6b8da26 commit 8994451

25 files changed

+232
-52
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
131768166b60b3bc271b54a3f93f011f310519de
1+
2788d0d8dd95ed57e2dbb148853fe69010e992fe

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-052eefbf";
30+
var ReactVersion = "18.3.0-www-modern-f236d170";
3131

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

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-e28878a7";
72+
var ReactVersion = "18.3.0-www-classic-dd1bbdc2";
7373

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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9555,7 +9555,7 @@ var slice = Array.prototype.slice,
95559555
return null;
95569556
},
95579557
bundleType: 0,
9558-
version: "18.3.0-www-modern-10cf7e02",
9558+
version: "18.3.0-www-modern-6722015e",
95599559
rendererPackageName: "react-art"
95609560
};
95619561
var internals$jscomp$inline_1283 = {
@@ -9586,7 +9586,7 @@ var internals$jscomp$inline_1283 = {
95869586
scheduleRoot: null,
95879587
setRefreshHandler: null,
95889588
getCurrentFiber: null,
9589-
reconcilerVersion: "18.3.0-www-modern-10cf7e02"
9589+
reconcilerVersion: "18.3.0-www-modern-6722015e"
95909590
};
95919591
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
95929592
var hook$jscomp$inline_1284 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,7 +1811,18 @@ properties[xlinkHref] = new PropertyInfoRecord(
18111811
true, // sanitizeURL
18121812
false
18131813
);
1814-
["src", "href", "action", "formAction"].forEach(function (attributeName) {
1814+
var formAction = "formAction"; // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
1815+
1816+
properties[formAction] = new PropertyInfoRecord(
1817+
"formAction",
1818+
STRING,
1819+
false, // mustUseProperty
1820+
"formaction", // attributeName
1821+
null, // attributeNamespace
1822+
true, // sanitizeURL
1823+
false
1824+
);
1825+
["src", "href", "action"].forEach(function (attributeName) {
18151826
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
18161827
properties[attributeName] = new PropertyInfoRecord(
18171828
attributeName,
@@ -42601,7 +42612,7 @@ function createFiberRoot(
4260142612
return root;
4260242613
}
4260342614

42604-
var ReactVersion = "18.3.0-www-classic-bab45118";
42615+
var ReactVersion = "18.3.0-www-classic-e6bf1439";
4260542616

4260642617
function createPortal$1(
4260742618
children,

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,18 @@ properties[xlinkHref] = new PropertyInfoRecord(
12071207
true, // sanitizeURL
12081208
false
12091209
);
1210-
["src", "href", "action", "formAction"].forEach(function (attributeName) {
1210+
var formAction = "formAction"; // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
1211+
1212+
properties[formAction] = new PropertyInfoRecord(
1213+
"formAction",
1214+
STRING,
1215+
false, // mustUseProperty
1216+
"formaction", // attributeName
1217+
null, // attributeNamespace
1218+
true, // sanitizeURL
1219+
false
1220+
);
1221+
["src", "href", "action"].forEach(function (attributeName) {
12111222
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
12121223
properties[attributeName] = new PropertyInfoRecord(
12131224
attributeName,
@@ -42205,7 +42216,7 @@ function createFiberRoot(
4220542216
return root;
4220642217
}
4220742218

42208-
var ReactVersion = "18.3.0-www-modern-10cf7e02";
42219+
var ReactVersion = "18.3.0-www-modern-6722015e";
4220942220

4221042221
function createPortal$1(
4221142222
children,

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,16 @@ properties.xlinkHref = new PropertyInfoRecord(
595595
!0,
596596
!1
597597
);
598-
["src", "href", "action", "formAction"].forEach(function (attributeName) {
598+
properties.formAction = new PropertyInfoRecord(
599+
"formAction",
600+
1,
601+
!1,
602+
"formaction",
603+
null,
604+
!0,
605+
!1
606+
);
607+
["src", "href", "action"].forEach(function (attributeName) {
599608
properties[attributeName] = new PropertyInfoRecord(
600609
attributeName,
601610
1,
@@ -15716,7 +15725,7 @@ Internals.Events = [
1571615725
var devToolsConfig$jscomp$inline_1761 = {
1571715726
findFiberByHostInstance: getClosestInstanceFromNode,
1571815727
bundleType: 0,
15719-
version: "18.3.0-www-classic-a5e3f87b",
15728+
version: "18.3.0-www-classic-90a2338a",
1572015729
rendererPackageName: "react-dom"
1572115730
};
1572215731
var internals$jscomp$inline_2156 = {
@@ -15746,7 +15755,7 @@ var internals$jscomp$inline_2156 = {
1574615755
scheduleRoot: null,
1574715756
setRefreshHandler: null,
1574815757
getCurrentFiber: null,
15749-
reconcilerVersion: "18.3.0-www-classic-a5e3f87b"
15758+
reconcilerVersion: "18.3.0-www-classic-90a2338a"
1575015759
};
1575115760
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1575215761
var hook$jscomp$inline_2157 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -16002,4 +16011,4 @@ exports.unstable_renderSubtreeIntoContainer = function (
1600216011
);
1600316012
};
1600416013
exports.unstable_runWithPriority = runWithPriority;
16005-
exports.version = "18.3.0-www-classic-a5e3f87b";
16014+
exports.version = "18.3.0-www-classic-90a2338a";

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,16 @@ properties.xlinkHref = new PropertyInfoRecord(
409409
!0,
410410
!1
411411
);
412-
["src", "href", "action", "formAction"].forEach(function (attributeName) {
412+
properties.formAction = new PropertyInfoRecord(
413+
"formAction",
414+
1,
415+
!1,
416+
"formaction",
417+
null,
418+
!0,
419+
!1
420+
);
421+
["src", "href", "action"].forEach(function (attributeName) {
413422
properties[attributeName] = new PropertyInfoRecord(
414423
attributeName,
415424
1,
@@ -15243,7 +15252,7 @@ Internals.Events = [
1524315252
var devToolsConfig$jscomp$inline_1720 = {
1524415253
findFiberByHostInstance: getClosestInstanceFromNode,
1524515254
bundleType: 0,
15246-
version: "18.3.0-www-modern-46c135c4",
15255+
version: "18.3.0-www-modern-8420e676",
1524715256
rendererPackageName: "react-dom"
1524815257
};
1524915258
var internals$jscomp$inline_2120 = {
@@ -15274,7 +15283,7 @@ var internals$jscomp$inline_2120 = {
1527415283
scheduleRoot: null,
1527515284
setRefreshHandler: null,
1527615285
getCurrentFiber: null,
15277-
reconcilerVersion: "18.3.0-www-modern-46c135c4"
15286+
reconcilerVersion: "18.3.0-www-modern-8420e676"
1527815287
};
1527915288
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1528015289
var hook$jscomp$inline_2121 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -15459,4 +15468,4 @@ exports.unstable_flushControlled = function (fn) {
1545915468
}
1546015469
};
1546115470
exports.unstable_runWithPriority = runWithPriority;
15462-
exports.version = "18.3.0-www-modern-46c135c4";
15471+
exports.version = "18.3.0-www-modern-8420e676";

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,16 @@ properties.xlinkHref = new PropertyInfoRecord(
609609
!0,
610610
!1
611611
);
612-
["src", "href", "action", "formAction"].forEach(function (attributeName) {
612+
properties.formAction = new PropertyInfoRecord(
613+
"formAction",
614+
1,
615+
!1,
616+
"formaction",
617+
null,
618+
!0,
619+
!1
620+
);
621+
["src", "href", "action"].forEach(function (attributeName) {
613622
properties[attributeName] = new PropertyInfoRecord(
614623
attributeName,
615624
1,
@@ -16493,7 +16502,7 @@ Internals.Events = [
1649316502
var devToolsConfig$jscomp$inline_1841 = {
1649416503
findFiberByHostInstance: getClosestInstanceFromNode,
1649516504
bundleType: 0,
16496-
version: "18.3.0-www-classic-471dc273",
16505+
version: "18.3.0-www-classic-ac5c9cb7",
1649716506
rendererPackageName: "react-dom"
1649816507
};
1649916508
(function (internals) {
@@ -16537,7 +16546,7 @@ var devToolsConfig$jscomp$inline_1841 = {
1653716546
scheduleRoot: null,
1653816547
setRefreshHandler: null,
1653916548
getCurrentFiber: null,
16540-
reconcilerVersion: "18.3.0-www-classic-471dc273"
16549+
reconcilerVersion: "18.3.0-www-classic-ac5c9cb7"
1654116550
});
1654216551
assign(Internals, {
1654316552
ReactBrowserEventEmitter: {
@@ -16780,7 +16789,7 @@ exports.unstable_renderSubtreeIntoContainer = function (
1678016789
);
1678116790
};
1678216791
exports.unstable_runWithPriority = runWithPriority;
16783-
exports.version = "18.3.0-www-classic-471dc273";
16792+
exports.version = "18.3.0-www-classic-ac5c9cb7";
1678416793

1678516794
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
1678616795
if (

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,16 @@ properties.xlinkHref = new PropertyInfoRecord(
423423
!0,
424424
!1
425425
);
426-
["src", "href", "action", "formAction"].forEach(function (attributeName) {
426+
properties.formAction = new PropertyInfoRecord(
427+
"formAction",
428+
1,
429+
!1,
430+
"formaction",
431+
null,
432+
!0,
433+
!1
434+
);
435+
["src", "href", "action"].forEach(function (attributeName) {
427436
properties[attributeName] = new PropertyInfoRecord(
428437
attributeName,
429438
1,
@@ -16010,7 +16019,7 @@ Internals.Events = [
1601016019
var devToolsConfig$jscomp$inline_1800 = {
1601116020
findFiberByHostInstance: getClosestInstanceFromNode,
1601216021
bundleType: 0,
16013-
version: "18.3.0-www-modern-2d8a876e",
16022+
version: "18.3.0-www-modern-0b070620",
1601416023
rendererPackageName: "react-dom"
1601516024
};
1601616025
(function (internals) {
@@ -16055,7 +16064,7 @@ var devToolsConfig$jscomp$inline_1800 = {
1605516064
scheduleRoot: null,
1605616065
setRefreshHandler: null,
1605716066
getCurrentFiber: null,
16058-
reconcilerVersion: "18.3.0-www-modern-2d8a876e"
16067+
reconcilerVersion: "18.3.0-www-modern-0b070620"
1605916068
});
1606016069
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
1606116070
exports.createPortal = function (children, container) {
@@ -16227,7 +16236,7 @@ exports.unstable_flushControlled = function (fn) {
1622716236
}
1622816237
};
1622916238
exports.unstable_runWithPriority = runWithPriority;
16230-
exports.version = "18.3.0-www-modern-2d8a876e";
16239+
exports.version = "18.3.0-www-modern-0b070620";
1623116240

1623216241
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
1623316242
if (

0 commit comments

Comments
 (0)