Skip to content

Commit 1d94a43

Browse files
committed
[Float][Fizz] add crossOrigin support for preloading bootstrap scripts and bootstrap modules (#26942)
The recently merged support for crossorigin in bootstrap scripts did not implement the functionality for preloading. This adds it see #26844 DiffTrain build for [a7bf5ba](a7bf5ba)
1 parent 717bf32 commit 1d94a43

File tree

5 files changed

+31
-23
lines changed

5 files changed

+31
-23
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
90229eb925e2330667fb7c023a5c4317c7ae8363
1+
a7bf5ba614c6ddbd1eb3057c71f72efd1b6c21a9

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if (__DEV__) {
1919
var React = require("react");
2020
var ReactDOM = require("react-dom");
2121

22-
var ReactVersion = "18.3.0-www-classic-81c3ac25";
22+
var ReactVersion = "18.3.0-www-classic-22ab72ab";
2323

2424
// This refers to a WWW module.
2525
var warningWWW = require("warning");
@@ -2471,7 +2471,7 @@ function createResponseState$1(
24712471
: scriptConfig.crossOrigin === "use-credentials"
24722472
? "use-credentials"
24732473
: "";
2474-
preloadBootstrapScript(resources, src, nonce, integrity);
2474+
preloadBootstrapScript(resources, src, nonce, integrity, crossOrigin);
24752475
bootstrapChunks.push(
24762476
startScriptSrc,
24772477
stringToChunk(escapeTextForBrowser(src))
@@ -2519,7 +2519,7 @@ function createResponseState$1(
25192519
? "use-credentials"
25202520
: "";
25212521

2522-
preloadBootstrapModule(resources, _src, nonce, _integrity);
2522+
preloadBootstrapModule(resources, _src, nonce, _integrity, _crossOrigin);
25232523
bootstrapChunks.push(
25242524
startModuleSrc,
25252525
stringToChunk(escapeTextForBrowser(_src))
@@ -7424,7 +7424,7 @@ function preinit(href, options) {
74247424
// scripts at any other point in time we will need to check whether the preload
74257425
// already exists and not assume it
74267426

7427-
function preloadBootstrapScript(resources, src, nonce, integrity) {
7427+
function preloadBootstrapScript(resources, src, nonce, integrity, crossOrigin) {
74287428
var key = getResourceKey("script", src);
74297429

74307430
{
@@ -7444,7 +7444,8 @@ function preloadBootstrapScript(resources, src, nonce, integrity) {
74447444
href: src,
74457445
as: "script",
74467446
nonce: nonce,
7447-
integrity: integrity
7447+
integrity: integrity,
7448+
crossOrigin: crossOrigin
74487449
};
74497450
var resource = {
74507451
type: "preload",
@@ -7460,7 +7461,7 @@ function preloadBootstrapScript(resources, src, nonce, integrity) {
74607461
// scripts at any other point in time we will need to check whether the preload
74617462
// already exists and not assume it
74627463

7463-
function preloadBootstrapModule(resources, src, nonce, integrity) {
7464+
function preloadBootstrapModule(resources, src, nonce, integrity, crossOrigin) {
74647465
var key = getResourceKey("script", src);
74657466

74667467
{
@@ -7479,7 +7480,8 @@ function preloadBootstrapModule(resources, src, nonce, integrity) {
74797480
rel: "modulepreload",
74807481
href: src,
74817482
nonce: nonce,
7482-
integrity: integrity
7483+
integrity: integrity,
7484+
crossOrigin: crossOrigin
74837485
};
74847486
var resource = {
74857487
type: "preload",

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if (__DEV__) {
1919
var React = require("react");
2020
var ReactDOM = require("react-dom");
2121

22-
var ReactVersion = "18.3.0-www-modern-bff42cc0";
22+
var ReactVersion = "18.3.0-www-modern-27b3679a";
2323

2424
// This refers to a WWW module.
2525
var warningWWW = require("warning");
@@ -2471,7 +2471,7 @@ function createResponseState$1(
24712471
: scriptConfig.crossOrigin === "use-credentials"
24722472
? "use-credentials"
24732473
: "";
2474-
preloadBootstrapScript(resources, src, nonce, integrity);
2474+
preloadBootstrapScript(resources, src, nonce, integrity, crossOrigin);
24752475
bootstrapChunks.push(
24762476
startScriptSrc,
24772477
stringToChunk(escapeTextForBrowser(src))
@@ -2519,7 +2519,7 @@ function createResponseState$1(
25192519
? "use-credentials"
25202520
: "";
25212521

2522-
preloadBootstrapModule(resources, _src, nonce, _integrity);
2522+
preloadBootstrapModule(resources, _src, nonce, _integrity, _crossOrigin);
25232523
bootstrapChunks.push(
25242524
startModuleSrc,
25252525
stringToChunk(escapeTextForBrowser(_src))
@@ -7424,7 +7424,7 @@ function preinit(href, options) {
74247424
// scripts at any other point in time we will need to check whether the preload
74257425
// already exists and not assume it
74267426

7427-
function preloadBootstrapScript(resources, src, nonce, integrity) {
7427+
function preloadBootstrapScript(resources, src, nonce, integrity, crossOrigin) {
74287428
var key = getResourceKey("script", src);
74297429

74307430
{
@@ -7444,7 +7444,8 @@ function preloadBootstrapScript(resources, src, nonce, integrity) {
74447444
href: src,
74457445
as: "script",
74467446
nonce: nonce,
7447-
integrity: integrity
7447+
integrity: integrity,
7448+
crossOrigin: crossOrigin
74487449
};
74497450
var resource = {
74507451
type: "preload",
@@ -7460,7 +7461,7 @@ function preloadBootstrapScript(resources, src, nonce, integrity) {
74607461
// scripts at any other point in time we will need to check whether the preload
74617462
// already exists and not assume it
74627463

7463-
function preloadBootstrapModule(resources, src, nonce, integrity) {
7464+
function preloadBootstrapModule(resources, src, nonce, integrity, crossOrigin) {
74647465
var key = getResourceKey("script", src);
74657466

74667467
{
@@ -7479,7 +7480,8 @@ function preloadBootstrapModule(resources, src, nonce, integrity) {
74797480
rel: "modulepreload",
74807481
href: src,
74817482
nonce: nonce,
7482-
integrity: integrity
7483+
integrity: integrity,
7484+
crossOrigin: crossOrigin
74837485
};
74847486
var resource = {
74857487
type: "preload",

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2468,7 +2468,7 @@ function createResponseState(
24682468
: scriptConfig.crossOrigin === "use-credentials"
24692469
? "use-credentials"
24702470
: "";
2471-
preloadBootstrapScript(resources, src, nonce, integrity);
2471+
preloadBootstrapScript(resources, src, nonce, integrity, crossOrigin);
24722472
bootstrapChunks.push(
24732473
startScriptSrc,
24742474
stringToChunk(escapeTextForBrowser(src))
@@ -2516,7 +2516,7 @@ function createResponseState(
25162516
? "use-credentials"
25172517
: "";
25182518

2519-
preloadBootstrapModule(resources, _src, nonce, _integrity);
2519+
preloadBootstrapModule(resources, _src, nonce, _integrity, _crossOrigin);
25202520
bootstrapChunks.push(
25212521
startModuleSrc,
25222522
stringToChunk(escapeTextForBrowser(_src))
@@ -7431,7 +7431,7 @@ function preinit(href, options) {
74317431
// scripts at any other point in time we will need to check whether the preload
74327432
// already exists and not assume it
74337433

7434-
function preloadBootstrapScript(resources, src, nonce, integrity) {
7434+
function preloadBootstrapScript(resources, src, nonce, integrity, crossOrigin) {
74357435
var key = getResourceKey("script", src);
74367436

74377437
{
@@ -7451,7 +7451,8 @@ function preloadBootstrapScript(resources, src, nonce, integrity) {
74517451
href: src,
74527452
as: "script",
74537453
nonce: nonce,
7454-
integrity: integrity
7454+
integrity: integrity,
7455+
crossOrigin: crossOrigin
74557456
};
74567457
var resource = {
74577458
type: "preload",
@@ -7467,7 +7468,7 @@ function preloadBootstrapScript(resources, src, nonce, integrity) {
74677468
// scripts at any other point in time we will need to check whether the preload
74687469
// already exists and not assume it
74697470

7470-
function preloadBootstrapModule(resources, src, nonce, integrity) {
7471+
function preloadBootstrapModule(resources, src, nonce, integrity, crossOrigin) {
74717472
var key = getResourceKey("script", src);
74727473

74737474
{
@@ -7486,7 +7487,8 @@ function preloadBootstrapModule(resources, src, nonce, integrity) {
74867487
rel: "modulepreload",
74877488
href: src,
74887489
nonce: nonce,
7489-
integrity: integrity
7490+
integrity: integrity,
7491+
crossOrigin: crossOrigin
74907492
};
74917493
var resource = {
74927494
type: "preload",

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3871,7 +3871,8 @@ exports.renderToStream = function (children, options) {
38713871
href: externalRuntimeConfig,
38723872
as: "script",
38733873
nonce: void 0,
3874-
integrity: integrity
3874+
integrity: integrity,
3875+
crossOrigin: scriptConfig
38753876
},
38763877
resource = { type: "preload", chunks: [], state: 0, props: props };
38773878
resources.preloadsMap.set("[script]" + externalRuntimeConfig, resource);
@@ -3914,7 +3915,8 @@ exports.renderToStream = function (children, options) {
39143915
rel: "modulepreload",
39153916
href: bootstrapScriptContent,
39163917
nonce: void 0,
3917-
integrity: externalRuntimeConfig
3918+
integrity: externalRuntimeConfig,
3919+
crossOrigin: integrity
39183920
}),
39193921
(props = {
39203922
type: "preload",

0 commit comments

Comments
 (0)