External Libraries: Update the `whatwg-fetch` polyfill library.
This updates the `whatwg-fetch` library from version `3.6.2` to `3.6.17`, the latest current version. This library is included and registered within WordPress as the `wp-polyfill-fetch` script and is no longer used by WordPress itself. Props rajinsharwar, hareesh-pillai. Fixes #59066. Built from https://develop.svn.wordpress.org/trunk@56389 git-svn-id: http://core.svn.wordpress.org/trunk@55901 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c392de6215
commit
dbb1d98290
|
@ -4,17 +4,20 @@
|
||||||
(factory((global.WHATWGFetch = {})));
|
(factory((global.WHATWGFetch = {})));
|
||||||
}(this, (function (exports) { 'use strict';
|
}(this, (function (exports) { 'use strict';
|
||||||
|
|
||||||
var global =
|
/* eslint-disable no-prototype-builtins */
|
||||||
|
var g =
|
||||||
(typeof globalThis !== 'undefined' && globalThis) ||
|
(typeof globalThis !== 'undefined' && globalThis) ||
|
||||||
(typeof self !== 'undefined' && self) ||
|
(typeof self !== 'undefined' && self) ||
|
||||||
(typeof global !== 'undefined' && global);
|
// eslint-disable-next-line no-undef
|
||||||
|
(typeof global !== 'undefined' && global) ||
|
||||||
|
{};
|
||||||
|
|
||||||
var support = {
|
var support = {
|
||||||
searchParams: 'URLSearchParams' in global,
|
searchParams: 'URLSearchParams' in g,
|
||||||
iterable: 'Symbol' in global && 'iterator' in Symbol,
|
iterable: 'Symbol' in g && 'iterator' in Symbol,
|
||||||
blob:
|
blob:
|
||||||
'FileReader' in global &&
|
'FileReader' in g &&
|
||||||
'Blob' in global &&
|
'Blob' in g &&
|
||||||
(function() {
|
(function() {
|
||||||
try {
|
try {
|
||||||
new Blob();
|
new Blob();
|
||||||
|
@ -23,8 +26,8 @@
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
})(),
|
})(),
|
||||||
formData: 'FormData' in global,
|
formData: 'FormData' in g,
|
||||||
arrayBuffer: 'ArrayBuffer' in global
|
arrayBuffer: 'ArrayBuffer' in g
|
||||||
};
|
};
|
||||||
|
|
||||||
function isDataView(obj) {
|
function isDataView(obj) {
|
||||||
|
@ -95,6 +98,9 @@
|
||||||
}, this);
|
}, this);
|
||||||
} else if (Array.isArray(headers)) {
|
} else if (Array.isArray(headers)) {
|
||||||
headers.forEach(function(header) {
|
headers.forEach(function(header) {
|
||||||
|
if (header.length != 2) {
|
||||||
|
throw new TypeError('Headers constructor: expected name/value pair to be length 2, found' + header.length)
|
||||||
|
}
|
||||||
this.append(header[0], header[1]);
|
this.append(header[0], header[1]);
|
||||||
}, this);
|
}, this);
|
||||||
} else if (headers) {
|
} else if (headers) {
|
||||||
|
@ -165,6 +171,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function consumed(body) {
|
function consumed(body) {
|
||||||
|
if (body._noBody) return
|
||||||
if (body.bodyUsed) {
|
if (body.bodyUsed) {
|
||||||
return Promise.reject(new TypeError('Already read'))
|
return Promise.reject(new TypeError('Already read'))
|
||||||
}
|
}
|
||||||
|
@ -192,7 +199,9 @@
|
||||||
function readBlobAsText(blob) {
|
function readBlobAsText(blob) {
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
var promise = fileReaderReady(reader);
|
var promise = fileReaderReady(reader);
|
||||||
reader.readAsText(blob);
|
var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type);
|
||||||
|
var encoding = match ? match[1] : 'utf-8';
|
||||||
|
reader.readAsText(blob, encoding);
|
||||||
return promise
|
return promise
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,9 +239,11 @@
|
||||||
semantic of setting Request.bodyUsed in the constructor before
|
semantic of setting Request.bodyUsed in the constructor before
|
||||||
_initBody is called.
|
_initBody is called.
|
||||||
*/
|
*/
|
||||||
|
// eslint-disable-next-line no-self-assign
|
||||||
this.bodyUsed = this.bodyUsed;
|
this.bodyUsed = this.bodyUsed;
|
||||||
this._bodyInit = body;
|
this._bodyInit = body;
|
||||||
if (!body) {
|
if (!body) {
|
||||||
|
this._noBody = true;
|
||||||
this._bodyText = '';
|
this._bodyText = '';
|
||||||
} else if (typeof body === 'string') {
|
} else if (typeof body === 'string') {
|
||||||
this._bodyText = body;
|
this._bodyText = body;
|
||||||
|
@ -280,29 +291,30 @@
|
||||||
return Promise.resolve(new Blob([this._bodyText]))
|
return Promise.resolve(new Blob([this._bodyText]))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.arrayBuffer = function() {
|
|
||||||
if (this._bodyArrayBuffer) {
|
|
||||||
var isConsumed = consumed(this);
|
|
||||||
if (isConsumed) {
|
|
||||||
return isConsumed
|
|
||||||
}
|
|
||||||
if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
|
|
||||||
return Promise.resolve(
|
|
||||||
this._bodyArrayBuffer.buffer.slice(
|
|
||||||
this._bodyArrayBuffer.byteOffset,
|
|
||||||
this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
return Promise.resolve(this._bodyArrayBuffer)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return this.blob().then(readBlobAsArrayBuffer)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.arrayBuffer = function() {
|
||||||
|
if (this._bodyArrayBuffer) {
|
||||||
|
var isConsumed = consumed(this);
|
||||||
|
if (isConsumed) {
|
||||||
|
return isConsumed
|
||||||
|
} else if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
|
||||||
|
return Promise.resolve(
|
||||||
|
this._bodyArrayBuffer.buffer.slice(
|
||||||
|
this._bodyArrayBuffer.byteOffset,
|
||||||
|
this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
|
||||||
|
)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
return Promise.resolve(this._bodyArrayBuffer)
|
||||||
|
}
|
||||||
|
} else if (support.blob) {
|
||||||
|
return this.blob().then(readBlobAsArrayBuffer)
|
||||||
|
} else {
|
||||||
|
throw new Error('could not read as ArrayBuffer')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
this.text = function() {
|
this.text = function() {
|
||||||
var rejected = consumed(this);
|
var rejected = consumed(this);
|
||||||
if (rejected) {
|
if (rejected) {
|
||||||
|
@ -334,7 +346,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// HTTP methods whose capitalization should be normalized
|
// HTTP methods whose capitalization should be normalized
|
||||||
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];
|
var methods = ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'];
|
||||||
|
|
||||||
function normalizeMethod(method) {
|
function normalizeMethod(method) {
|
||||||
var upcased = method.toUpperCase();
|
var upcased = method.toUpperCase();
|
||||||
|
@ -375,7 +387,12 @@
|
||||||
}
|
}
|
||||||
this.method = normalizeMethod(options.method || this.method || 'GET');
|
this.method = normalizeMethod(options.method || this.method || 'GET');
|
||||||
this.mode = options.mode || this.mode || null;
|
this.mode = options.mode || this.mode || null;
|
||||||
this.signal = options.signal || this.signal;
|
this.signal = options.signal || this.signal || (function () {
|
||||||
|
if ('AbortController' in g) {
|
||||||
|
var ctrl = new AbortController();
|
||||||
|
return ctrl.signal;
|
||||||
|
}
|
||||||
|
}());
|
||||||
this.referrer = null;
|
this.referrer = null;
|
||||||
|
|
||||||
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
|
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
|
||||||
|
@ -437,7 +454,11 @@
|
||||||
var key = parts.shift().trim();
|
var key = parts.shift().trim();
|
||||||
if (key) {
|
if (key) {
|
||||||
var value = parts.join(':').trim();
|
var value = parts.join(':').trim();
|
||||||
headers.append(key, value);
|
try {
|
||||||
|
headers.append(key, value);
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('Response ' + error.message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return headers
|
return headers
|
||||||
|
@ -455,6 +476,9 @@
|
||||||
|
|
||||||
this.type = 'default';
|
this.type = 'default';
|
||||||
this.status = options.status === undefined ? 200 : options.status;
|
this.status = options.status === undefined ? 200 : options.status;
|
||||||
|
if (this.status < 200 || this.status > 599) {
|
||||||
|
throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].")
|
||||||
|
}
|
||||||
this.ok = this.status >= 200 && this.status < 300;
|
this.ok = this.status >= 200 && this.status < 300;
|
||||||
this.statusText = options.statusText === undefined ? '' : '' + options.statusText;
|
this.statusText = options.statusText === undefined ? '' : '' + options.statusText;
|
||||||
this.headers = new Headers(options.headers);
|
this.headers = new Headers(options.headers);
|
||||||
|
@ -474,7 +498,8 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
Response.error = function() {
|
Response.error = function() {
|
||||||
var response = new Response(null, {status: 0, statusText: ''});
|
var response = new Response(null, {status: 200, statusText: ''});
|
||||||
|
response.status = 0;
|
||||||
response.type = 'error';
|
response.type = 'error';
|
||||||
return response
|
return response
|
||||||
};
|
};
|
||||||
|
@ -489,7 +514,7 @@
|
||||||
return new Response(null, {status: status, headers: {location: url}})
|
return new Response(null, {status: status, headers: {location: url}})
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.DOMException = global.DOMException;
|
exports.DOMException = g.DOMException;
|
||||||
try {
|
try {
|
||||||
new exports.DOMException();
|
new exports.DOMException();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -550,7 +575,7 @@
|
||||||
|
|
||||||
function fixUrl(url) {
|
function fixUrl(url) {
|
||||||
try {
|
try {
|
||||||
return url === '' && global.location.href ? global.location.href : url
|
return url === '' && g.location.href ? g.location.href : url
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
@ -568,18 +593,23 @@
|
||||||
if (support.blob) {
|
if (support.blob) {
|
||||||
xhr.responseType = 'blob';
|
xhr.responseType = 'blob';
|
||||||
} else if (
|
} else if (
|
||||||
support.arrayBuffer &&
|
support.arrayBuffer
|
||||||
request.headers.get('Content-Type') &&
|
|
||||||
request.headers.get('Content-Type').indexOf('application/octet-stream') !== -1
|
|
||||||
) {
|
) {
|
||||||
xhr.responseType = 'arraybuffer';
|
xhr.responseType = 'arraybuffer';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers)) {
|
if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers || (g.Headers && init.headers instanceof g.Headers))) {
|
||||||
|
var names = [];
|
||||||
Object.getOwnPropertyNames(init.headers).forEach(function(name) {
|
Object.getOwnPropertyNames(init.headers).forEach(function(name) {
|
||||||
|
names.push(normalizeName(name));
|
||||||
xhr.setRequestHeader(name, normalizeValue(init.headers[name]));
|
xhr.setRequestHeader(name, normalizeValue(init.headers[name]));
|
||||||
});
|
});
|
||||||
|
request.headers.forEach(function(value, name) {
|
||||||
|
if (names.indexOf(name) === -1) {
|
||||||
|
xhr.setRequestHeader(name, value);
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
request.headers.forEach(function(value, name) {
|
request.headers.forEach(function(value, name) {
|
||||||
xhr.setRequestHeader(name, value);
|
xhr.setRequestHeader(name, value);
|
||||||
|
@ -603,11 +633,11 @@
|
||||||
|
|
||||||
fetch.polyfill = true;
|
fetch.polyfill = true;
|
||||||
|
|
||||||
if (!global.fetch) {
|
if (!g.fetch) {
|
||||||
global.fetch = fetch;
|
g.fetch = fetch;
|
||||||
global.Headers = Headers;
|
g.Headers = Headers;
|
||||||
global.Request = Request;
|
g.Request = Request;
|
||||||
global.Response = Response;
|
g.Response = Response;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.Headers = Headers;
|
exports.Headers = Headers;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -111,7 +111,7 @@ function wp_default_packages_vendor( $scripts ) {
|
||||||
'regenerator-runtime' => '0.13.11',
|
'regenerator-runtime' => '0.13.11',
|
||||||
'moment' => '2.29.4',
|
'moment' => '2.29.4',
|
||||||
'lodash' => '4.17.19',
|
'lodash' => '4.17.19',
|
||||||
'wp-polyfill-fetch' => '3.6.2',
|
'wp-polyfill-fetch' => '3.6.17',
|
||||||
'wp-polyfill-formdata' => '4.0.10',
|
'wp-polyfill-formdata' => '4.0.10',
|
||||||
'wp-polyfill-node-contains' => '4.6.0',
|
'wp-polyfill-node-contains' => '4.6.0',
|
||||||
'wp-polyfill-url' => '3.6.4',
|
'wp-polyfill-url' => '3.6.4',
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.4-alpha-56388';
|
$wp_version = '6.4-alpha-56389';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
|
Loading…
Reference in New Issue