External Libraries: Update the whatwg-fetch polyfill library.

This updates the `whatwg-fetch` library from version `3.6.17` to `3.6.20`, the latest current version.

This library is included and registered within WordPress as the `wp-polyfill-fetch` script but is no longer used by WordPress itself. Updates are provided as a courtesy, and all projects using this polyfill should reevaluate usage.

Props manooweb.
Fixes #60514.
Built from https://develop.svn.wordpress.org/trunk@58860


git-svn-id: http://core.svn.wordpress.org/trunk@58256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2024-08-07 15:52:22 +00:00
parent c4cd3c1c4b
commit cb0f56f131
4 changed files with 12 additions and 5 deletions

View File

@ -499,6 +499,7 @@
Response.error = function() { Response.error = function() {
var response = new Response(null, {status: 200, statusText: ''}); var response = new Response(null, {status: 200, statusText: ''});
response.ok = false;
response.status = 0; response.status = 0;
response.type = 'error'; response.type = 'error';
return response return response
@ -544,10 +545,16 @@
xhr.onload = function() { xhr.onload = function() {
var options = { var options = {
status: xhr.status,
statusText: xhr.statusText, statusText: xhr.statusText,
headers: parseHeaders(xhr.getAllResponseHeaders() || '') headers: parseHeaders(xhr.getAllResponseHeaders() || '')
}; };
// This check if specifically for when a user fetches a file locally from the file system
// Only if the status is out of a normal range
if (request.url.indexOf('file://') === 0 && (xhr.status < 200 || xhr.status > 599)) {
options.status = 200;
} else {
options.status = xhr.status;
}
options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL'); options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');
var body = 'response' in xhr ? xhr.response : xhr.responseText; var body = 'response' in xhr ? xhr.response : xhr.responseText;
setTimeout(function() { setTimeout(function() {
@ -563,7 +570,7 @@
xhr.ontimeout = function() { xhr.ontimeout = function() {
setTimeout(function() { setTimeout(function() {
reject(new TypeError('Network request failed')); reject(new TypeError('Network request timed out'));
}, 0); }, 0);
}; };

File diff suppressed because one or more lines are too long

View File

@ -114,7 +114,7 @@ function wp_default_packages_vendor( $scripts ) {
'regenerator-runtime' => '0.14.1', 'regenerator-runtime' => '0.14.1',
'moment' => '2.29.4', 'moment' => '2.29.4',
'lodash' => '4.17.21', 'lodash' => '4.17.21',
'wp-polyfill-fetch' => '3.6.17', 'wp-polyfill-fetch' => '3.6.20',
'wp-polyfill-formdata' => '4.0.10', 'wp-polyfill-formdata' => '4.0.10',
'wp-polyfill-node-contains' => '4.8.0', 'wp-polyfill-node-contains' => '4.8.0',
'wp-polyfill-url' => '3.6.4', 'wp-polyfill-url' => '3.6.4',

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.7-alpha-58859'; $wp_version = '6.7-alpha-58860';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.