Skip to content

Commit

Permalink
[Float] Nonce preload support (#26939)
Browse files Browse the repository at this point in the history
Some browsers, with some CSP configuration, will not preload a script if
the prelaod link tag does not provide a valid nonce attribute. This
change adds the ability to specify a nonce for `ReactDOM.preload(..., {
as: "script" })`

DiffTrain build for [86acc10](86acc10)
  • Loading branch information
gnoff committed Jun 15, 2023
1 parent 1d94a43 commit b437e4d
Show file tree
Hide file tree
Showing 21 changed files with 48 additions and 32 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a7bf5ba614c6ddbd1eb3057c71f72efd1b6c21a9
86acc10f2596e1a6fe2fd57a5b325de85175800b
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-www-modern-180bd813";
var ReactVersion = "18.3.0-www-modern-5fb44b73";

// ATTENTION
// When adding new symbols to this file,
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = "18.3.0-www-modern-0a8a0f8c";
var ReactVersion = "18.3.0-www-modern-520e6c62";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -9858,7 +9858,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "18.3.0-www-modern-27da91db",
version: "18.3.0-www-modern-e8821afc",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1298 = {
Expand Down Expand Up @@ -9889,7 +9889,7 @@ var internals$jscomp$inline_1298 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-27da91db"
reconcilerVersion: "18.3.0-www-modern-e8821afc"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1299 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
3 changes: 2 additions & 1 deletion compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -34178,7 +34178,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-classic-202be78c";
var ReactVersion = "18.3.0-www-classic-3dccae4a";

function createPortal$1(
children,
Expand Down Expand Up @@ -43823,6 +43823,7 @@ function preloadPropsFromPreloadOptions(href, as, options) {
crossOrigin: as === "font" ? "" : options.crossOrigin,
integrity: options.integrity,
type: options.type,
nonce: options.nonce,
fetchPriority: options.fetchPriority
};
}
Expand Down
3 changes: 2 additions & 1 deletion compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -34023,7 +34023,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-modern-0a8a0f8c";
var ReactVersion = "18.3.0-www-modern-520e6c62";

function createPortal$1(
children,
Expand Down Expand Up @@ -44333,6 +44333,7 @@ function preloadPropsFromPreloadOptions(href, as, options) {
crossOrigin: as === "font" ? "" : options.crossOrigin,
integrity: options.integrity,
type: options.type,
nonce: options.nonce,
fetchPriority: options.fetchPriority
};
}
Expand Down
7 changes: 4 additions & 3 deletions compiled/facebook-www/ReactDOM-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -15303,6 +15303,7 @@ function preload$1(href, options) {
crossOrigin: "font" === as ? "" : options.crossOrigin,
integrity: options.integrity,
type: options.type,
nonce: options.nonce,
fetchPriority: options.fetchPriority
}),
preloadPropsMap.set(key, href),
Expand Down Expand Up @@ -16643,7 +16644,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1815 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-classic-a78c92e7",
version: "18.3.0-www-classic-c1034a44",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2184 = {
Expand Down Expand Up @@ -16673,7 +16674,7 @@ var internals$jscomp$inline_2184 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-classic-a78c92e7"
reconcilerVersion: "18.3.0-www-classic-c1034a44"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2185 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -16916,4 +16917,4 @@ exports.unstable_renderSubtreeIntoContainer = function (
);
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-classic-a78c92e7";
exports.version = "18.3.0-www-classic-c1034a44";
7 changes: 4 additions & 3 deletions compiled/facebook-www/ReactDOM-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -15533,6 +15533,7 @@ function preload$1(href, options) {
crossOrigin: "font" === as ? "" : options.crossOrigin,
integrity: options.integrity,
type: options.type,
nonce: options.nonce,
fetchPriority: options.fetchPriority
}),
preloadPropsMap.set(key, href),
Expand Down Expand Up @@ -16172,7 +16173,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1774 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-modern-27da91db",
version: "18.3.0-www-modern-e8821afc",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2148 = {
Expand Down Expand Up @@ -16203,7 +16204,7 @@ var internals$jscomp$inline_2148 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-27da91db"
reconcilerVersion: "18.3.0-www-modern-e8821afc"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2149 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -16374,4 +16375,4 @@ exports.unstable_createEventHandle = function (type, options) {
return eventHandle;
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-modern-27da91db";
exports.version = "18.3.0-www-modern-e8821afc";
7 changes: 4 additions & 3 deletions compiled/facebook-www/ReactDOM-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -16078,6 +16078,7 @@ function preload$1(href, options) {
crossOrigin: "font" === as ? "" : options.crossOrigin,
integrity: options.integrity,
type: options.type,
nonce: options.nonce,
fetchPriority: options.fetchPriority
}),
preloadPropsMap.set(key, href),
Expand Down Expand Up @@ -17418,7 +17419,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1900 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-classic-6cc31d50",
version: "18.3.0-www-classic-1233fa25",
rendererPackageName: "react-dom"
};
(function (internals) {
Expand Down Expand Up @@ -17462,7 +17463,7 @@ var devToolsConfig$jscomp$inline_1900 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-classic-6cc31d50"
reconcilerVersion: "18.3.0-www-classic-1233fa25"
});
assign(Internals, {
ReactBrowserEventEmitter: {
Expand Down Expand Up @@ -17692,7 +17693,7 @@ exports.unstable_renderSubtreeIntoContainer = function (
);
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-classic-6cc31d50";
exports.version = "18.3.0-www-classic-1233fa25";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
7 changes: 4 additions & 3 deletions compiled/facebook-www/ReactDOM-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -16302,6 +16302,7 @@ function preload$1(href, options) {
crossOrigin: "font" === as ? "" : options.crossOrigin,
integrity: options.integrity,
type: options.type,
nonce: options.nonce,
fetchPriority: options.fetchPriority
}),
preloadPropsMap.set(key, href),
Expand Down Expand Up @@ -16941,7 +16942,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1859 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-modern-2704a18e",
version: "18.3.0-www-modern-d08e2742",
rendererPackageName: "react-dom"
};
(function (internals) {
Expand Down Expand Up @@ -16986,7 +16987,7 @@ var devToolsConfig$jscomp$inline_1859 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-2704a18e"
reconcilerVersion: "18.3.0-www-modern-d08e2742"
});
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
exports.createPortal = function (children, container) {
Expand Down Expand Up @@ -17144,7 +17145,7 @@ exports.unstable_createEventHandle = function (type, options) {
return eventHandle;
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-modern-2704a18e";
exports.version = "18.3.0-www-modern-d08e2742";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
3 changes: 2 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-22ab72ab";
var ReactVersion = "18.3.0-www-classic-4d7a4acb";

// This refers to a WWW module.
var warningWWW = require("warning");
Expand Down Expand Up @@ -7521,6 +7521,7 @@ function preloadPropsFromPreloadOptions(href, as, options) {
crossOrigin: as === "font" ? "" : options.crossOrigin,
integrity: options.integrity,
type: options.type,
nonce: options.nonce,
fetchPriority: options.fetchPriority
};
}
Expand Down
3 changes: 2 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-27b3679a";
var ReactVersion = "18.3.0-www-modern-18f0b486";

// This refers to a WWW module.
var warningWWW = require("warning");
Expand Down Expand Up @@ -7521,6 +7521,7 @@ function preloadPropsFromPreloadOptions(href, as, options) {
crossOrigin: as === "font" ? "" : options.crossOrigin,
integrity: options.integrity,
type: options.type,
nonce: options.nonce,
fetchPriority: options.fetchPriority
};
}
Expand Down
3 changes: 2 additions & 1 deletion compiled/facebook-www/ReactDOMServer-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -1855,6 +1855,7 @@ function preload(href, options) {
crossOrigin: "font" === as ? "" : options.crossOrigin,
integrity: options.integrity,
type: options.type,
nonce: options.nonce,
fetchPriority: options.fetchPriority
}
}),
Expand Down Expand Up @@ -4001,4 +4002,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-43b0ed5e";
exports.version = "18.3.0-www-classic-99c1dfc7";
3 changes: 2 additions & 1 deletion compiled/facebook-www/ReactDOMServer-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -1854,6 +1854,7 @@ function preload(href, options) {
crossOrigin: "font" === as ? "" : options.crossOrigin,
integrity: options.integrity,
type: options.type,
nonce: options.nonce,
fetchPriority: options.fetchPriority
}
}),
Expand Down Expand Up @@ -3899,4 +3900,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-0fa0d6a8";
exports.version = "18.3.0-www-modern-7d85fe51";
Original file line number Diff line number Diff line change
Expand Up @@ -7528,6 +7528,7 @@ function preloadPropsFromPreloadOptions(href, as, options) {
crossOrigin: as === "font" ? "" : options.crossOrigin,
integrity: options.integrity,
type: options.type,
nonce: options.nonce,
fetchPriority: options.fetchPriority
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1904,6 +1904,7 @@ function preload(href, options) {
crossOrigin: "font" === as ? "" : options.crossOrigin,
integrity: options.integrity,
type: options.type,
nonce: options.nonce,
fetchPriority: options.fetchPriority
}
}),
Expand Down
3 changes: 2 additions & 1 deletion compiled/facebook-www/ReactDOMTesting-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -34795,7 +34795,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-classic-a43be0aa";
var ReactVersion = "18.3.0-www-classic-4a9fda08";

function createPortal$1(
children,
Expand Down Expand Up @@ -44572,6 +44572,7 @@ function preloadPropsFromPreloadOptions(href, as, options) {
crossOrigin: as === "font" ? "" : options.crossOrigin,
integrity: options.integrity,
type: options.type,
nonce: options.nonce,
fetchPriority: options.fetchPriority
};
}
Expand Down
3 changes: 2 additions & 1 deletion compiled/facebook-www/ReactDOMTesting-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -34640,7 +34640,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-modern-dd1ac991";
var ReactVersion = "18.3.0-www-modern-6dec7344";

function createPortal$1(
children,
Expand Down Expand Up @@ -45082,6 +45082,7 @@ function preloadPropsFromPreloadOptions(href, as, options) {
crossOrigin: as === "font" ? "" : options.crossOrigin,
integrity: options.integrity,
type: options.type,
nonce: options.nonce,
fetchPriority: options.fetchPriority
};
}
Expand Down
7 changes: 4 additions & 3 deletions compiled/facebook-www/ReactDOMTesting-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -15632,6 +15632,7 @@ function preload$1(href, options) {
crossOrigin: "font" === as ? "" : options.crossOrigin,
integrity: options.integrity,
type: options.type,
nonce: options.nonce,
fetchPriority: options.fetchPriority
}),
preloadPropsMap.set(key, href),
Expand Down Expand Up @@ -16972,7 +16973,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1844 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-classic-2d5fcb75",
version: "18.3.0-www-classic-1f937379",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2218 = {
Expand Down Expand Up @@ -17002,7 +17003,7 @@ var internals$jscomp$inline_2218 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-classic-2d5fcb75"
reconcilerVersion: "18.3.0-www-classic-1f937379"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2219 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -17396,4 +17397,4 @@ exports.unstable_renderSubtreeIntoContainer = function (
);
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-classic-2d5fcb75";
exports.version = "18.3.0-www-classic-1f937379";
7 changes: 4 additions & 3 deletions compiled/facebook-www/ReactDOMTesting-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -15917,6 +15917,7 @@ function preload$1(href, options) {
crossOrigin: "font" === as ? "" : options.crossOrigin,
integrity: options.integrity,
type: options.type,
nonce: options.nonce,
fetchPriority: options.fetchPriority
}),
preloadPropsMap.set(key, href),
Expand Down Expand Up @@ -16556,7 +16557,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1803 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-modern-180bd813",
version: "18.3.0-www-modern-5fb44b73",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2182 = {
Expand Down Expand Up @@ -16587,7 +16588,7 @@ var internals$jscomp$inline_2182 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-180bd813"
reconcilerVersion: "18.3.0-www-modern-5fb44b73"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2183 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -16909,4 +16910,4 @@ exports.unstable_createEventHandle = function (type, options) {
return eventHandle;
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-modern-180bd813";
exports.version = "18.3.0-www-modern-5fb44b73";
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactTestRenderer-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -24553,7 +24553,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-classic-a43be0aa";
var ReactVersion = "18.3.0-www-classic-4a9fda08";

// Might add PROFILE later.

Expand Down

0 comments on commit b437e4d

Please sign in to comment.