1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

fix: align AbortSignal to spec using WPT (#9007)

This commit is contained in:
Luca Casonato 2021-01-05 22:43:25 +01:00 committed by GitHub
parent 096e090576
commit 7704839039
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 3 deletions

View file

@ -22,7 +22,13 @@
"api-invalid-label",
"api-replacement-encodings",
"api-surrogates-utf8",
// TODO(lucacasonato): enable encodeInto. It is buggy at the moment.
// TODO(lucacasonato): enable encodeInto. We have a bug in implementaiton.
// {
// "name": "encodeInto",
// "expectFail": [
// "encodeInto() and a detached output buffer"
// ]
// },
// "encodeInto",
// TODO(lucacasonato): enable when we support iso-2022-jp
// "iso-2022-jp-decoder",
@ -110,7 +116,7 @@
"utf-16le => UTF-16LE",
"x-user-defined => x-user-defined"
]
}
},
// TODO(lucacasonato): enable when we have stream support
// "textdecoder-streaming",
// TODO(lucacasonato): enable when we support utf-16
@ -134,5 +140,8 @@
// "textencoder-utf16-surrogates",
// TODO(lucacasonato): uses XMLHttpRequest unnecessarily. should be fixed upstream before enabling
// "unsupported-encodings",
],
"dom": [
"abort/event"
]
}

View file

@ -42,6 +42,13 @@
event.currentTarget = value;
}
function setIsTrusted(event, value) {
const data = eventData.get(event);
if (data) {
data.isTrusted = value;
}
}
function setDispatched(event, value) {
const data = eventData.get(event);
if (data) {
@ -1185,4 +1192,7 @@
window.__bootstrap.eventTarget = {
setEventTargetData,
};
window.__bootstrap.event = {
setIsTrusted,
};
})(this);

View file

@ -1,6 +1,8 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
((window) => {
const { setIsTrusted } = window.__bootstrap.event;
const add = Symbol("add");
const signalAbort = Symbol("signalAbort");
const remove = Symbol("remove");
@ -24,7 +26,9 @@
algorithm();
}
this.#abortAlgorithms.clear();
this.dispatchEvent(new Event("abort"));
const event = new Event("abort");
setIsTrusted(event, true);
this.dispatchEvent(event);
}
[remove](algorithm) {