Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2021-07-27 22:26:09 +00:00
parent 3ba511a8f1
commit 1c4c64199f
175 changed files with 13227 additions and 15136 deletions

View file

@ -71,7 +71,7 @@ function EventTargetHandler() {
function addEventListener(eventName) {
self.addEventListener(eventName, function(event) {
var listener = self["on" + eventName];
var listener = self[`on${eventName}`];
if (listener && typeof listener === "function") {
listener.call(this, event);
@ -109,17 +109,13 @@ function verifyResponseBodyType(body, responseType) {
if (responseType === "arraybuffer") {
if (!isString && !(body instanceof ArrayBuffer)) {
error = new Error(
"Attempted to respond to fake XMLHttpRequest with " +
body +
", which is not a string or ArrayBuffer."
`Attempted to respond to fake XMLHttpRequest with ${body}, which is not a string or ArrayBuffer.`
);
error.name = "InvalidBodyException";
}
} else if (!isString) {
error = new Error(
"Attempted to respond to fake XMLHttpRequest with " +
body +
", which is not a string."
`Attempted to respond to fake XMLHttpRequest with ${body}, which is not a string.`
);
error.name = "InvalidBodyException";
}
@ -325,7 +321,7 @@ function fakeXMLHttpRequestFor(globalScope) {
function verifyRequestOpened(xhr) {
if (xhr.readyState !== FakeXMLHttpRequest.OPENED) {
throw new Error("INVALID_STATE_ERR - " + xhr.readyState);
throw new Error(`INVALID_STATE_ERR - ${xhr.readyState}`);
}
}
@ -368,7 +364,7 @@ function fakeXMLHttpRequestFor(globalScope) {
}
return null;
}
throw new Error("Invalid responseType " + responseType);
throw new Error(`Invalid responseType ${responseType}`);
}
/**
@ -517,8 +513,6 @@ function fakeXMLHttpRequestFor(globalScope) {
false,
this
);
var event, progress;
if (typeof this.onreadystatechange === "function") {
try {
this.onreadystatechange(readyStateChangeEvent);
@ -527,7 +521,11 @@ function fakeXMLHttpRequestFor(globalScope) {
}
}
if (this.readyState === FakeXMLHttpRequest.DONE) {
if (this.readyState !== FakeXMLHttpRequest.DONE) {
this.dispatchEvent(readyStateChangeEvent);
} else {
var event, progress;
if (this.timedOut || this.aborted || this.status === 0) {
progress = { loaded: 0, total: 0 };
event =
@ -557,20 +555,18 @@ function fakeXMLHttpRequestFor(globalScope) {
this.dispatchEvent(
new sinonEvent.ProgressEvent(event, progress, this)
);
this.dispatchEvent(readyStateChangeEvent);
this.dispatchEvent(
new sinonEvent.ProgressEvent("loadend", progress, this)
);
}
this.dispatchEvent(readyStateChangeEvent);
},
// Ref https://xhr.spec.whatwg.org/#the-setrequestheader()-method
setRequestHeader: function setRequestHeader(header, value) {
if (typeof value !== "string") {
throw new TypeError(
"By RFC7230, section 3.2.4, header values should be strings. Got " +
typeof value
`By RFC7230, section 3.2.4, header values should be strings. Got ${typeof value}`
);
}
verifyState(this);
@ -587,7 +583,7 @@ function fakeXMLHttpRequestFor(globalScope) {
) {
throw new Error(
// eslint-disable-next-line quotes
'Refused to set unsafe header "' + header + '"'
`Refused to set unsafe header "${header}"`
);
}
@ -596,7 +592,7 @@ function fakeXMLHttpRequestFor(globalScope) {
var existingHeader = getHeader(this.requestHeaders, header);
if (existingHeader) {
this.requestHeaders[existingHeader] += ", " + value;
this.requestHeaders[existingHeader] += `, ${value}`;
} else {
this.requestHeaders[header] = value;
}
@ -638,8 +634,9 @@ function fakeXMLHttpRequestFor(globalScope) {
);
if (this.requestHeaders[contentType]) {
var value = this.requestHeaders[contentType].split(";");
this.requestHeaders[contentType] =
value[0] + ";charset=utf-8";
this.requestHeaders[
contentType
] = `${value[0]};charset=utf-8`;
} else if (supportsFormData && !(data instanceof FormData)) {
this.requestHeaders["Content-Type"] =
"text/plain;charset=utf-8";
@ -744,7 +741,7 @@ function fakeXMLHttpRequestFor(globalScope) {
.reduce(function(prev, header) {
var value = responseHeaders[header];
return prev + (header + ": " + value + "\r\n");
return `${prev}${header}: ${value}\r\n`;
}, "");
return headers;
@ -801,6 +798,8 @@ function fakeXMLHttpRequestFor(globalScope) {
},
respond: function respond(status, headers, body) {
this.responseURL = this.url;
this.setStatus(status);
this.setResponseHeaders(headers || {});
this.setResponseBody(body || "");