1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-03 04:48:52 -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-invalid-label",
"api-replacement-encodings", "api-replacement-encodings",
"api-surrogates-utf8", "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", // "encodeInto",
// TODO(lucacasonato): enable when we support iso-2022-jp // TODO(lucacasonato): enable when we support iso-2022-jp
// "iso-2022-jp-decoder", // "iso-2022-jp-decoder",
@ -110,7 +116,7 @@
"utf-16le => UTF-16LE", "utf-16le => UTF-16LE",
"x-user-defined => x-user-defined" "x-user-defined => x-user-defined"
] ]
} },
// TODO(lucacasonato): enable when we have stream support // TODO(lucacasonato): enable when we have stream support
// "textdecoder-streaming", // "textdecoder-streaming",
// TODO(lucacasonato): enable when we support utf-16 // TODO(lucacasonato): enable when we support utf-16
@ -134,5 +140,8 @@
// "textencoder-utf16-surrogates", // "textencoder-utf16-surrogates",
// TODO(lucacasonato): uses XMLHttpRequest unnecessarily. should be fixed upstream before enabling // TODO(lucacasonato): uses XMLHttpRequest unnecessarily. should be fixed upstream before enabling
// "unsupported-encodings", // "unsupported-encodings",
],
"dom": [
"abort/event"
] ]
} }

View file

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

View file

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