summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/build.rs2
-rw-r--r--cli/dts/lib.deno.shared_globals.d.ts48
-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
5 files changed, 1 insertions, 128 deletions
diff --git a/cli/build.rs b/cli/build.rs
index 3f4cd2a5b..4c87d15e0 100644
--- a/cli/build.rs
+++ b/cli/build.rs
@@ -146,7 +146,7 @@ fn get_js_files_for_rt() -> Vec<String> {
"rt/01_internals.js",
"rt/01_version.js",
"rt/01_web_util.js",
- "rt/02_abort_signal.js",
+ &web_scripts.abort_signal,
"rt/02_console.js",
"rt/03_dom_iterable.js",
"rt/06_util.js",
diff --git a/cli/dts/lib.deno.shared_globals.d.ts b/cli/dts/lib.deno.shared_globals.d.ts
index e21d6fc15..672f8ada4 100644
--- a/cli/dts/lib.deno.shared_globals.d.ts
+++ b/cli/dts/lib.deno.shared_globals.d.ts
@@ -1473,54 +1473,6 @@ declare class CustomEvent<T = any> extends Event {
readonly detail: T;
}
-/** A controller object that allows you to abort one or more DOM requests as and
- * when desired. */
-declare class AbortController {
- /** Returns the AbortSignal object associated with this object. */
- readonly signal: AbortSignal;
- /** Invoking this method will set this object's AbortSignal's aborted flag and
- * signal to any observers that the associated activity is to be aborted. */
- abort(): void;
-}
-
-interface AbortSignalEventMap {
- abort: Event;
-}
-
-/** A signal object that allows you to communicate with a DOM request (such as a
- * Fetch) and abort it if required via an AbortController object. */
-interface AbortSignal extends EventTarget {
- /** Returns true if this AbortSignal's AbortController has signaled to abort,
- * and false otherwise. */
- readonly aborted: boolean;
- onabort: ((this: AbortSignal, ev: Event) => any) | null;
- addEventListener<K extends keyof AbortSignalEventMap>(
- type: K,
- listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any,
- options?: boolean | AddEventListenerOptions,
- ): void;
- addEventListener(
- type: string,
- listener: EventListenerOrEventListenerObject,
- options?: boolean | AddEventListenerOptions,
- ): void;
- removeEventListener<K extends keyof AbortSignalEventMap>(
- type: K,
- listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any,
- options?: boolean | EventListenerOptions,
- ): void;
- removeEventListener(
- type: string,
- listener: EventListenerOrEventListenerObject,
- options?: boolean | EventListenerOptions,
- ): void;
-}
-
-declare const AbortSignal: {
- prototype: AbortSignal;
- new (): AbortSignal;
-};
-
interface ErrorConstructor {
/** See https://v8.dev/docs/stack-trace-api#stack-trace-collection-for-custom-exceptions. */
// eslint-disable-next-line @typescript-eslint/ban-types
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,