Skip to content

Commit 717bf32

Browse files
committed
Add support for 'crossorigin' attribute on bootstrapScripts and bootstrapModules (#26844)
base build ci job failing but this change is unrelated and I think it is just flake with the builds host application DiffTrain build for [90229eb](90229eb)
1 parent b2a908f commit 717bf32

7 files changed

+137
-35
lines changed

compiled/facebook-www/REVISION

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

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

Lines changed: 29 additions & 1 deletion
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-4458edc9";
22+
var ReactVersion = "18.3.0-www-classic-81c3ac25";
2323

2424
// This refers to a WWW module.
2525
var warningWWW = require("warning");
@@ -2371,6 +2371,7 @@ var startScriptSrc = stringToPrecomputedChunk('<script src="');
23712371
var startModuleSrc = stringToPrecomputedChunk('<script type="module" src="');
23722372
var scriptNonce = stringToPrecomputedChunk('" nonce="');
23732373
var scriptIntegirty = stringToPrecomputedChunk('" integrity="');
2374+
var scriptCrossOrigin = stringToPrecomputedChunk('" crossorigin="');
23742375
var endAsyncScript = stringToPrecomputedChunk('" async=""></script>');
23752376
/**
23762377
* This escaping function is designed to work with bootstrapScriptContent only.
@@ -2464,6 +2465,12 @@ function createResponseState$1(
24642465
typeof scriptConfig === "string" ? scriptConfig : scriptConfig.src;
24652466
var integrity =
24662467
typeof scriptConfig === "string" ? undefined : scriptConfig.integrity;
2468+
var crossOrigin =
2469+
typeof scriptConfig === "string" || scriptConfig.crossOrigin == null
2470+
? undefined
2471+
: scriptConfig.crossOrigin === "use-credentials"
2472+
? "use-credentials"
2473+
: "";
24672474
preloadBootstrapScript(resources, src, nonce, integrity);
24682475
bootstrapChunks.push(
24692476
startScriptSrc,
@@ -2484,6 +2491,13 @@ function createResponseState$1(
24842491
);
24852492
}
24862493

2494+
if (typeof crossOrigin === "string") {
2495+
bootstrapChunks.push(
2496+
scriptCrossOrigin,
2497+
stringToChunk(escapeTextForBrowser(crossOrigin))
2498+
);
2499+
}
2500+
24872501
bootstrapChunks.push(endAsyncScript);
24882502
}
24892503
}
@@ -2498,6 +2512,13 @@ function createResponseState$1(
24982512
var _integrity =
24992513
typeof _scriptConfig === "string" ? undefined : _scriptConfig.integrity;
25002514

2515+
var _crossOrigin =
2516+
typeof _scriptConfig === "string" || _scriptConfig.crossOrigin == null
2517+
? undefined
2518+
: _scriptConfig.crossOrigin === "use-credentials"
2519+
? "use-credentials"
2520+
: "";
2521+
25012522
preloadBootstrapModule(resources, _src, nonce, _integrity);
25022523
bootstrapChunks.push(
25032524
startModuleSrc,
@@ -2518,6 +2539,13 @@ function createResponseState$1(
25182539
);
25192540
}
25202541

2542+
if (typeof _crossOrigin === "string") {
2543+
bootstrapChunks.push(
2544+
scriptCrossOrigin,
2545+
stringToChunk(escapeTextForBrowser(_crossOrigin))
2546+
);
2547+
}
2548+
25212549
bootstrapChunks.push(endAsyncScript);
25222550
}
25232551
}

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

Lines changed: 29 additions & 1 deletion
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-e8e32d5d";
22+
var ReactVersion = "18.3.0-www-modern-bff42cc0";
2323

2424
// This refers to a WWW module.
2525
var warningWWW = require("warning");
@@ -2371,6 +2371,7 @@ var startScriptSrc = stringToPrecomputedChunk('<script src="');
23712371
var startModuleSrc = stringToPrecomputedChunk('<script type="module" src="');
23722372
var scriptNonce = stringToPrecomputedChunk('" nonce="');
23732373
var scriptIntegirty = stringToPrecomputedChunk('" integrity="');
2374+
var scriptCrossOrigin = stringToPrecomputedChunk('" crossorigin="');
23742375
var endAsyncScript = stringToPrecomputedChunk('" async=""></script>');
23752376
/**
23762377
* This escaping function is designed to work with bootstrapScriptContent only.
@@ -2464,6 +2465,12 @@ function createResponseState$1(
24642465
typeof scriptConfig === "string" ? scriptConfig : scriptConfig.src;
24652466
var integrity =
24662467
typeof scriptConfig === "string" ? undefined : scriptConfig.integrity;
2468+
var crossOrigin =
2469+
typeof scriptConfig === "string" || scriptConfig.crossOrigin == null
2470+
? undefined
2471+
: scriptConfig.crossOrigin === "use-credentials"
2472+
? "use-credentials"
2473+
: "";
24672474
preloadBootstrapScript(resources, src, nonce, integrity);
24682475
bootstrapChunks.push(
24692476
startScriptSrc,
@@ -2484,6 +2491,13 @@ function createResponseState$1(
24842491
);
24852492
}
24862493

2494+
if (typeof crossOrigin === "string") {
2495+
bootstrapChunks.push(
2496+
scriptCrossOrigin,
2497+
stringToChunk(escapeTextForBrowser(crossOrigin))
2498+
);
2499+
}
2500+
24872501
bootstrapChunks.push(endAsyncScript);
24882502
}
24892503
}
@@ -2498,6 +2512,13 @@ function createResponseState$1(
24982512
var _integrity =
24992513
typeof _scriptConfig === "string" ? undefined : _scriptConfig.integrity;
25002514

2515+
var _crossOrigin =
2516+
typeof _scriptConfig === "string" || _scriptConfig.crossOrigin == null
2517+
? undefined
2518+
: _scriptConfig.crossOrigin === "use-credentials"
2519+
? "use-credentials"
2520+
: "";
2521+
25012522
preloadBootstrapModule(resources, _src, nonce, _integrity);
25022523
bootstrapChunks.push(
25032524
startModuleSrc,
@@ -2518,6 +2539,13 @@ function createResponseState$1(
25182539
);
25192540
}
25202541

2542+
if (typeof _crossOrigin === "string") {
2543+
bootstrapChunks.push(
2544+
scriptCrossOrigin,
2545+
stringToChunk(escapeTextForBrowser(_crossOrigin))
2546+
);
2547+
}
2548+
25212549
bootstrapChunks.push(endAsyncScript);
25222550
}
25232551
}

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3810,13 +3810,13 @@ function flushCompletedQueues(request, destination) {
38103810
completedBoundaries.splice(0, i);
38113811
var partialBoundaries = request.partialBoundaries;
38123812
for (i = 0; i < partialBoundaries.length; i++) {
3813-
var boundary$14 = partialBoundaries[i];
3813+
var boundary$15 = partialBoundaries[i];
38143814
a: {
38153815
clientRenderedBoundaries = request;
38163816
boundary = destination;
38173817
clientRenderedBoundaries.resources.boundaryResources =
3818-
boundary$14.resources;
3819-
var completedSegments = boundary$14.completedSegments;
3818+
boundary$15.resources;
3819+
var completedSegments = boundary$15.completedSegments;
38203820
for (
38213821
responseState$jscomp$1 = 0;
38223822
responseState$jscomp$1 < completedSegments.length;
@@ -3826,7 +3826,7 @@ function flushCompletedQueues(request, destination) {
38263826
!flushPartiallyCompletedSegment(
38273827
clientRenderedBoundaries,
38283828
boundary,
3829-
boundary$14,
3829+
boundary$15,
38303830
completedSegments[responseState$jscomp$1]
38313831
)
38323832
) {
@@ -3838,7 +3838,7 @@ function flushCompletedQueues(request, destination) {
38383838
completedSegments.splice(0, responseState$jscomp$1);
38393839
JSCompiler_inline_result = writeResourcesForBoundary(
38403840
boundary,
3841-
boundary$14.resources,
3841+
boundary$15.resources,
38423842
clientRenderedBoundaries.responseState
38433843
);
38443844
}
@@ -3901,8 +3901,8 @@ function abort(request, reason) {
39013901
}
39023902
null !== request.destination &&
39033903
flushCompletedQueues(request, request.destination);
3904-
} catch (error$16) {
3905-
logRecoverableError(request, error$16), fatalError(request, error$16);
3904+
} catch (error$17) {
3905+
logRecoverableError(request, error$17), fatalError(request, error$17);
39063906
}
39073907
}
39083908
function onError() {}
@@ -4001,4 +4001,4 @@ exports.renderToString = function (children, options) {
40014001
'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'
40024002
);
40034003
};
4004-
exports.version = "18.3.0-www-classic-f551099d";
4004+
exports.version = "18.3.0-www-classic-43b0ed5e";

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3708,13 +3708,13 @@ function flushCompletedQueues(request, destination) {
37083708
completedBoundaries.splice(0, i);
37093709
var partialBoundaries = request.partialBoundaries;
37103710
for (i = 0; i < partialBoundaries.length; i++) {
3711-
var boundary$14 = partialBoundaries[i];
3711+
var boundary$15 = partialBoundaries[i];
37123712
a: {
37133713
clientRenderedBoundaries = request;
37143714
boundary = destination;
37153715
clientRenderedBoundaries.resources.boundaryResources =
3716-
boundary$14.resources;
3717-
var completedSegments = boundary$14.completedSegments;
3716+
boundary$15.resources;
3717+
var completedSegments = boundary$15.completedSegments;
37183718
for (
37193719
responseState$jscomp$1 = 0;
37203720
responseState$jscomp$1 < completedSegments.length;
@@ -3724,7 +3724,7 @@ function flushCompletedQueues(request, destination) {
37243724
!flushPartiallyCompletedSegment(
37253725
clientRenderedBoundaries,
37263726
boundary,
3727-
boundary$14,
3727+
boundary$15,
37283728
completedSegments[responseState$jscomp$1]
37293729
)
37303730
) {
@@ -3736,7 +3736,7 @@ function flushCompletedQueues(request, destination) {
37363736
completedSegments.splice(0, responseState$jscomp$1);
37373737
JSCompiler_inline_result = writeResourcesForBoundary(
37383738
boundary,
3739-
boundary$14.resources,
3739+
boundary$15.resources,
37403740
clientRenderedBoundaries.responseState
37413741
);
37423742
}
@@ -3799,8 +3799,8 @@ function abort(request, reason) {
37993799
}
38003800
null !== request.destination &&
38013801
flushCompletedQueues(request, request.destination);
3802-
} catch (error$16) {
3803-
logRecoverableError(request, error$16), fatalError(request, error$16);
3802+
} catch (error$17) {
3803+
logRecoverableError(request, error$17), fatalError(request, error$17);
38043804
}
38053805
}
38063806
function onError() {}
@@ -3899,4 +3899,4 @@ exports.renderToString = function (children, options) {
38993899
'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'
39003900
);
39013901
};
3902-
exports.version = "18.3.0-www-modern-76cd6d02";
3902+
exports.version = "18.3.0-www-modern-0fa0d6a8";

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2368,6 +2368,7 @@ var startScriptSrc = stringToPrecomputedChunk('<script src="');
23682368
var startModuleSrc = stringToPrecomputedChunk('<script type="module" src="');
23692369
var scriptNonce = stringToPrecomputedChunk('" nonce="');
23702370
var scriptIntegirty = stringToPrecomputedChunk('" integrity="');
2371+
var scriptCrossOrigin = stringToPrecomputedChunk('" crossorigin="');
23712372
var endAsyncScript = stringToPrecomputedChunk('" async=""></script>');
23722373
/**
23732374
* This escaping function is designed to work with bootstrapScriptContent only.
@@ -2461,6 +2462,12 @@ function createResponseState(
24612462
typeof scriptConfig === "string" ? scriptConfig : scriptConfig.src;
24622463
var integrity =
24632464
typeof scriptConfig === "string" ? undefined : scriptConfig.integrity;
2465+
var crossOrigin =
2466+
typeof scriptConfig === "string" || scriptConfig.crossOrigin == null
2467+
? undefined
2468+
: scriptConfig.crossOrigin === "use-credentials"
2469+
? "use-credentials"
2470+
: "";
24642471
preloadBootstrapScript(resources, src, nonce, integrity);
24652472
bootstrapChunks.push(
24662473
startScriptSrc,
@@ -2481,6 +2488,13 @@ function createResponseState(
24812488
);
24822489
}
24832490

2491+
if (typeof crossOrigin === "string") {
2492+
bootstrapChunks.push(
2493+
scriptCrossOrigin,
2494+
stringToChunk(escapeTextForBrowser(crossOrigin))
2495+
);
2496+
}
2497+
24842498
bootstrapChunks.push(endAsyncScript);
24852499
}
24862500
}
@@ -2495,6 +2509,13 @@ function createResponseState(
24952509
var _integrity =
24962510
typeof _scriptConfig === "string" ? undefined : _scriptConfig.integrity;
24972511

2512+
var _crossOrigin =
2513+
typeof _scriptConfig === "string" || _scriptConfig.crossOrigin == null
2514+
? undefined
2515+
: _scriptConfig.crossOrigin === "use-credentials"
2516+
? "use-credentials"
2517+
: "";
2518+
24982519
preloadBootstrapModule(resources, _src, nonce, _integrity);
24992520
bootstrapChunks.push(
25002521
startModuleSrc,
@@ -2515,6 +2536,13 @@ function createResponseState(
25152536
);
25162537
}
25172538

2539+
if (typeof _crossOrigin === "string") {
2540+
bootstrapChunks.push(
2541+
scriptCrossOrigin,
2542+
stringToChunk(escapeTextForBrowser(_crossOrigin))
2543+
);
2544+
}
2545+
25182546
bootstrapChunks.push(endAsyncScript);
25192547
}
25202548
}

0 commit comments

Comments
 (0)