summaryrefslogtreecommitdiff
path: root/cli/rt
diff options
context:
space:
mode:
authorLuca Casonato <lucacasonato@yahoo.com>2020-08-19 14:43:20 +0200
committerGitHub <noreply@github.com>2020-08-19 14:43:20 +0200
commit1507a8cf2d8bce8c3596583b995fea4914a99203 (patch)
tree3e9280b01dab60dcea368894a153a9237884d676 /cli/rt
parent27f4aeb92469660fdd78a89a7b2902c08a23ca4a (diff)
refactor(op_crates/web): move abort signal (#7117)
Diffstat (limited to 'cli/rt')
-rw-r--r--cli/rt/02_abort_signal.js75
-rw-r--r--cli/rt/11_streams.js1
-rw-r--r--cli/rt/99_main.js3
3 files changed, 0 insertions, 79 deletions
diff --git a/cli/rt/02_abort_signal.js b/cli/rt/02_abort_signal.js
deleted file mode 100644
index cd38fff64..000000000
--- a/cli/rt/02_abort_signal.js
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-
-((window) => {
- const add = Symbol("add");
- const signalAbort = Symbol("signalAbort");
- const remove = Symbol("remove");
-
- class AbortSignal extends EventTarget {
- #aborted = false;
- #abortAlgorithms = new Set();
-
- [add](algorithm) {
- this.#abortAlgorithms.add(algorithm);
- }
-
- [signalAbort]() {
- if (this.#aborted) {
- return;
- }
- this.#aborted = true;
- for (const algorithm of this.#abortAlgorithms) {
- algorithm();
- }
- this.#abortAlgorithms.clear();
- this.dispatchEvent(new Event("abort"));
- }
-
- [remove](algorithm) {
- this.#abortAlgorithms.delete(algorithm);
- }
-
- constructor() {
- super();
- this.onabort = null;
- this.addEventListener("abort", (evt) => {
- const { onabort } = this;
- if (typeof onabort === "function") {
- onabort.call(this, evt);
- }
- });
- }
-
- get aborted() {
- return Boolean(this.#aborted);
- }
-
- get [Symbol.toStringTag]() {
- return "AbortSignal";
- }
- }
-
- class AbortController {
- #signal = new AbortSignal();
-
- get signal() {
- return this.#signal;
- }
-
- abort() {
- this.#signal[signalAbort]();
- }
-
- get [Symbol.toStringTag]() {
- return "AbortController";
- }
- }
-
- window.__bootstrap.abortSignal = {
- AbortSignal,
- add,
- signalAbort,
- remove,
- AbortController,
- };
-})(this);
diff --git a/cli/rt/11_streams.js b/cli/rt/11_streams.js
index 4bdbfbc5c..e5a5732e5 100644
--- a/cli/rt/11_streams.js
+++ b/cli/rt/11_streams.js
@@ -9,7 +9,6 @@
((window) => {
/* eslint-disable @typescript-eslint/no-explicit-any,require-await */
- const { AbortSignal } = window.__bootstrap.abortSignal;
const { cloneValue, setFunctionName } = window.__bootstrap.webUtil;
const { assert, AssertionError } = window.__bootstrap.util;
const { customInspect, inspect } = window.__bootstrap.console;
diff --git a/cli/rt/99_main.js b/cli/rt/99_main.js
index d9cee0aa5..18cc1d251 100644
--- a/cli/rt/99_main.js
+++ b/cli/rt/99_main.js
@@ -20,7 +20,6 @@ delete Object.prototype.__proto__;
const worker = window.__bootstrap.worker;
const signals = window.__bootstrap.signals;
const { internalSymbol, internalObject } = window.__bootstrap.internals;
- const abortSignal = window.__bootstrap.abortSignal;
const performance = window.__bootstrap.performance;
const crypto = window.__bootstrap.crypto;
const url = window.__bootstrap.url;
@@ -217,8 +216,6 @@ delete Object.prototype.__proto__;
// Other properties shared between WindowScope and WorkerGlobalScope
const windowOrWorkerGlobalScopeProperties = {
console: util.writable(new Console(core.print)),
- AbortController: util.nonEnumerable(abortSignal.AbortController),
- AbortSignal: util.nonEnumerable(abortSignal.AbortSignal),
Blob: util.nonEnumerable(blob.Blob),
ByteLengthQueuingStrategy: util.nonEnumerable(
queuingStrategy.ByteLengthQueuingStrategy,