Revert "Merge pull request #7579 from betagouv/US/fix-event-target-polyfill"
This reverts commit27ed32bff0
, reversing changes made to795570b039
.
This commit is contained in:
parent
24d7cbb4e1
commit
99350e45dd
2 changed files with 1 additions and 117 deletions
|
@ -1,5 +1,5 @@
|
|||
diff --git a/node_modules/event-target-polyfill/index.js b/node_modules/event-target-polyfill/index.js
|
||||
index 82f7f42..d198834 100644
|
||||
index 82f7f42..c7b65b7 100644
|
||||
--- a/node_modules/event-target-polyfill/index.js
|
||||
+++ b/node_modules/event-target-polyfill/index.js
|
||||
@@ -12,19 +12,6 @@ function isConstructor(fn) {
|
||||
|
@ -22,58 +22,3 @@ index 82f7f42..d198834 100644
|
|||
if (typeof root.EventTarget === "undefined" || !isConstructor(root.Event)) {
|
||||
root.EventTarget = (function () {
|
||||
function EventTarget() {
|
||||
@@ -40,7 +27,8 @@ if (typeof root.EventTarget === "undefined" || !isConstructor(root.Event)) {
|
||||
) {
|
||||
if (arguments.length < 2) {
|
||||
throw new TypeError(
|
||||
- `TypeError: Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, but only ${arguments.length} present.`
|
||||
+ "TypeError: Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, " +
|
||||
+ "but only " + arguments.length.toString() + "present."
|
||||
);
|
||||
}
|
||||
const __listeners = this.__listeners;
|
||||
@@ -62,7 +50,8 @@ if (typeof root.EventTarget === "undefined" || !isConstructor(root.Event)) {
|
||||
) {
|
||||
if (arguments.length < 2) {
|
||||
throw new TypeError(
|
||||
- `TypeError: Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, but only ${arguments.length} present.`
|
||||
+ "TypeError: Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, " +
|
||||
+ "but only " + arguments.length.toString() + "present."
|
||||
);
|
||||
}
|
||||
const __listeners = this.__listeners;
|
||||
@@ -78,14 +67,14 @@ if (typeof root.EventTarget === "undefined" || !isConstructor(root.Event)) {
|
||||
EventTarget.prototype.dispatchEvent = function (event) {
|
||||
if (!(event instanceof Event)) {
|
||||
throw new TypeError(
|
||||
- `Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'.`
|
||||
+ "Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'."
|
||||
);
|
||||
}
|
||||
const type = event.type;
|
||||
const __listeners = this.__listeners;
|
||||
const listenersForType = __listeners.get(type);
|
||||
if (listenersForType) {
|
||||
- for (const [listener, options] of listenersForType.entries()) {
|
||||
+ listenersForType.forEach(function(options, listener) {
|
||||
try {
|
||||
if (typeof listener === "function") {
|
||||
// Listener functions must be executed with the EventTarget as the `this` context.
|
||||
@@ -100,7 +89,7 @@ if (typeof root.EventTarget === "undefined" || !isConstructor(root.Event)) {
|
||||
// Unfortunately, this is the best we can do, which isn't great, because the
|
||||
// native EventTarget will actually do this synchronously before moving to the next
|
||||
// event in the loop.
|
||||
- setTimeout(() => {
|
||||
+ setTimeout(function() {
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
@@ -109,7 +98,7 @@ if (typeof root.EventTarget === "undefined" || !isConstructor(root.Event)) {
|
||||
// to remove it now.
|
||||
listenersForType.delete(listener);
|
||||
}
|
||||
- }
|
||||
+ })
|
||||
}
|
||||
// Since there are no cancellable events on a base EventTarget,
|
||||
// this should always return true.
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
diff --git a/node_modules/formdata-polyfill/FormData.js b/node_modules/formdata-polyfill/FormData.js
|
||||
index 8e73660..7b64ba4 100644
|
||||
--- a/node_modules/formdata-polyfill/FormData.js
|
||||
+++ b/node_modules/formdata-polyfill/FormData.js
|
||||
@@ -71,7 +71,7 @@ if (typeof Blob !== 'undefined' && (typeof FormData === 'undefined' || !FormData
|
||||
|
||||
function ensureArgs (args, expected) {
|
||||
if (args.length < expected) {
|
||||
- throw new TypeError(`${expected} argument required, but only ${args.length} present.`)
|
||||
+ throw new TypeError(expected + " argument required, but only " + args.length.toString() + " present.")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,11 +342,11 @@ if (typeof Blob !== 'undefined' && (typeof FormData === 'undefined' || !FormData
|
||||
['_blob'] () {
|
||||
const boundary = '----formdata-polyfill-' + Math.random(),
|
||||
chunks = [],
|
||||
- p = `--${boundary}\r\nContent-Disposition: form-data; name="`
|
||||
+ p = "--" + boundary +" \r\nContent-Disposition: form-data; name=\""
|
||||
this.forEach((value, name) => typeof value == 'string'
|
||||
- ? chunks.push(p + escape(normalizeLinefeeds(name)) + `"\r\n\r\n${normalizeLinefeeds(value)}\r\n`)
|
||||
- : chunks.push(p + escape(normalizeLinefeeds(name)) + `"; filename="${escape(value.name)}"\r\nContent-Type: ${value.type||"application/octet-stream"}\r\n\r\n`, value, `\r\n`))
|
||||
- chunks.push(`--${boundary}--`)
|
||||
+ ? chunks.push(p + escape(normalizeLinefeeds(name)) + "\"\r\n\r\n" + normalizeLinefeeds(value) + "\r\n")
|
||||
+ : chunks.push(p + escape(normalizeLinefeeds(name)) + "\"; filename=\"" + escape(value.name) + "\r\nContent-Type: " + (value.type||"application/octet-stream") + "\r\n\r\n", value, "\r\n"))
|
||||
+ chunks.push("--"+boundary+"--")
|
||||
return new Blob(chunks, {
|
||||
type: "multipart/form-data; boundary=" + boundary
|
||||
})
|
||||
diff --git a/node_modules/formdata-polyfill/formdata-to-blob.js b/node_modules/formdata-polyfill/formdata-to-blob.js
|
||||
index 5a0a517..0b7fbd7 100644
|
||||
--- a/node_modules/formdata-polyfill/formdata-to-blob.js
|
||||
+++ b/node_modules/formdata-polyfill/formdata-to-blob.js
|
||||
@@ -16,22 +16,22 @@ const escape = (str, filename) =>
|
||||
export function formDataToBlob (formData, BlobClass = Blob) {
|
||||
const boundary = ('----formdata-polyfill-' + Math.random())
|
||||
const chunks = []
|
||||
- const prefix = `--${boundary}\r\nContent-Disposition: form-data; name="`
|
||||
+ const prefix = "--"+$boundary+"\r\nContent-Disposition: form-data; name=\""
|
||||
|
||||
for (let [name, value] of formData) {
|
||||
if (typeof value === 'string') {
|
||||
- chunks.push(prefix + escape(name) + `"\r\n\r\n${value.replace(/\r(?!\n)|(?<!\r)\n/g, '\r\n')}\r\n`)
|
||||
+ chunks.push(prefix + escape(name) + "\"\r\n\r\n" + value.replace(/\r(?!\n)|(?<!\r)\n/g, '\r\n') + "\r\n")
|
||||
} else {
|
||||
chunks.push(
|
||||
- prefix + escape(name) + `"; filename="${escape(value.name, 1)}"\r\n` +
|
||||
- `Content-Type: ${value.type || 'application/octet-stream'}\r\n\r\n`,
|
||||
+ prefix + escape(name) + "\"; filename=\"" + escape(value.name, 1) + "\r\n" +
|
||||
+ "Content-Type: " + (value.type || 'application/octet-stream') + "\r\n\r\n",
|
||||
value,
|
||||
'\r\n'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
- chunks.push(`--${boundary}--`)
|
||||
+ chunks.push("--" + boundary + "--")
|
||||
|
||||
return new BlobClass(chunks, {
|
||||
type: 'multipart/form-data; boundary=' + boundary
|
Loading…
Reference in a new issue