Skip to content

Commit

Permalink
Update preload links to support nonce and fetchpriority (#26826)
Browse files Browse the repository at this point in the history
Currently when React generates rel=preload link tags for script/stylesheet resources, it will not carryover nonce and fetchpriority values if specified on the original elements.

This change ensures that the preload links use the nonce and fetchPriority values if they were specified.

DiffTrain build for [535c038](535c038)
  • Loading branch information
gnoff committed May 23, 2023
1 parent e48bfab commit 1d665b6
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5309f102854475030fb91ab732141411b49c1126
535c038d15d21f33e678187410d658456cc0ce39
5 changes: 4 additions & 1 deletion compiled/facebook-www/ReactDOMServer-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (__DEV__) {
var React = require("react");
var ReactDOM = require("react-dom");

var ReactVersion = "18.3.0-www-classic-6fc3b80a";
var ReactVersion = "18.3.0-www-classic-4ad4dc38";

// This refers to a WWW module.
var warningWWW = require("warning");
Expand Down Expand Up @@ -7504,6 +7504,7 @@ function preloadAsStylePropsFromProps(href, props) {
as: "style",
href: href,
crossOrigin: props.crossOrigin,
fetchPriority: props.fetchPriority,
integrity: props.integrity,
media: props.media,
hrefLang: props.hrefLang,
Expand All @@ -7517,7 +7518,9 @@ function preloadAsScriptPropsFromProps(href, props) {
as: "script",
href: href,
crossOrigin: props.crossOrigin,
fetchPriority: props.fetchPriority,
integrity: props.integrity,
nonce: props.nonce,
referrerPolicy: props.referrerPolicy
};
}
Expand Down
5 changes: 4 additions & 1 deletion compiled/facebook-www/ReactDOMServer-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (__DEV__) {
var React = require("react");
var ReactDOM = require("react-dom");

var ReactVersion = "18.3.0-www-modern-044bfa2a";
var ReactVersion = "18.3.0-www-modern-bcd77572";

// This refers to a WWW module.
var warningWWW = require("warning");
Expand Down Expand Up @@ -7504,6 +7504,7 @@ function preloadAsStylePropsFromProps(href, props) {
as: "style",
href: href,
crossOrigin: props.crossOrigin,
fetchPriority: props.fetchPriority,
integrity: props.integrity,
media: props.media,
hrefLang: props.hrefLang,
Expand All @@ -7517,7 +7518,9 @@ function preloadAsScriptPropsFromProps(href, props) {
as: "script",
href: href,
crossOrigin: props.crossOrigin,
fetchPriority: props.fetchPriority,
integrity: props.integrity,
nonce: props.nonce,
referrerPolicy: props.referrerPolicy
};
}
Expand Down
5 changes: 4 additions & 1 deletion compiled/facebook-www/ReactDOMServer-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,9 @@ function pushStartInstance(
as: "script",
href: props.src,
crossOrigin: props.crossOrigin,
fetchPriority: props.fetchPriority,
integrity: props.integrity,
nonce: props.nonce,
referrerPolicy: props.referrerPolicy
}
}),
Expand Down Expand Up @@ -2104,6 +2106,7 @@ function preloadAsStylePropsFromProps(href, props) {
as: "style",
href: href,
crossOrigin: props.crossOrigin,
fetchPriority: props.fetchPriority,
integrity: props.integrity,
media: props.media,
hrefLang: props.hrefLang,
Expand Down Expand Up @@ -4011,4 +4014,4 @@ exports.renderToString = function (children, options) {
'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server'
);
};
exports.version = "18.3.0-www-classic-cf2c1840";
exports.version = "18.3.0-www-classic-15c0e05f";
5 changes: 4 additions & 1 deletion compiled/facebook-www/ReactDOMServer-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,9 @@ function pushStartInstance(
as: "script",
href: props.src,
crossOrigin: props.crossOrigin,
fetchPriority: props.fetchPriority,
integrity: props.integrity,
nonce: props.nonce,
referrerPolicy: props.referrerPolicy
}
}),
Expand Down Expand Up @@ -2103,6 +2105,7 @@ function preloadAsStylePropsFromProps(href, props) {
as: "style",
href: href,
crossOrigin: props.crossOrigin,
fetchPriority: props.fetchPriority,
integrity: props.integrity,
media: props.media,
hrefLang: props.hrefLang,
Expand Down Expand Up @@ -3909,4 +3912,4 @@ exports.renderToString = function (children, options) {
'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server'
);
};
exports.version = "18.3.0-www-modern-c8d57b01";
exports.version = "18.3.0-www-modern-38ef6896";
3 changes: 3 additions & 0 deletions compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -7511,6 +7511,7 @@ function preloadAsStylePropsFromProps(href, props) {
as: "style",
href: href,
crossOrigin: props.crossOrigin,
fetchPriority: props.fetchPriority,
integrity: props.integrity,
media: props.media,
hrefLang: props.hrefLang,
Expand All @@ -7524,7 +7525,9 @@ function preloadAsScriptPropsFromProps(href, props) {
as: "script",
href: href,
crossOrigin: props.crossOrigin,
fetchPriority: props.fetchPriority,
integrity: props.integrity,
nonce: props.nonce,
referrerPolicy: props.referrerPolicy
};
}
Expand Down
3 changes: 3 additions & 0 deletions compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,9 @@ function pushStartInstance(
as: "script",
href: props.src,
crossOrigin: props.crossOrigin,
fetchPriority: props.fetchPriority,
integrity: props.integrity,
nonce: props.nonce,
referrerPolicy: props.referrerPolicy
}
}),
Expand Down Expand Up @@ -2158,6 +2160,7 @@ function preloadAsStylePropsFromProps(href, props) {
as: "style",
href: href,
crossOrigin: props.crossOrigin,
fetchPriority: props.fetchPriority,
integrity: props.integrity,
media: props.media,
hrefLang: props.hrefLang,
Expand Down

0 comments on commit 1d665b6

Please sign in to comment.