diff --git a/cli/tests/wpt.jsonc b/cli/tests/wpt.jsonc index 3e151b9545..479b6a7475 100644 --- a/cli/tests/wpt.jsonc +++ b/cli/tests/wpt.jsonc @@ -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" ] } diff --git a/op_crates/web/01_event.js b/op_crates/web/01_event.js index 35b269ea4b..fb80ea4a68 100644 --- a/op_crates/web/01_event.js +++ b/op_crates/web/01_event.js @@ -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); diff --git a/op_crates/web/02_abort_signal.js b/op_crates/web/02_abort_signal.js index 5ee047c360..412dab8357 100644 --- a/op_crates/web/02_abort_signal.js +++ b/op_crates/web/02_abort_signal.js @@ -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) {