From a8602cc877cb4fc007655cd0f52b52b1e7165bc8 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 10 Jun 2020 21:08:58 +0000 Subject: Issue #1587 - Part 1: Implement FetchController/FetchSignal interface --- dom/webidl/FetchController.webidl | 15 +++++++++++++++ dom/webidl/FetchSignal.webidl | 13 +++++++++++++ dom/webidl/Request.webidl | 3 +++ dom/webidl/moz.build | 2 ++ 4 files changed, 33 insertions(+) create mode 100644 dom/webidl/FetchController.webidl create mode 100644 dom/webidl/FetchSignal.webidl (limited to 'dom/webidl') diff --git a/dom/webidl/FetchController.webidl b/dom/webidl/FetchController.webidl new file mode 100644 index 0000000000..c5b1cc6da2 --- /dev/null +++ b/dom/webidl/FetchController.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Constructor(), Exposed=(Window,Worker), + Func="FetchController::IsEnabled"] +interface FetchController { + readonly attribute FetchSignal signal; + + void abort(); + void follow(FetchSignal signal); + void unfollow(FetchSignal signal); +}; diff --git a/dom/webidl/FetchSignal.webidl b/dom/webidl/FetchSignal.webidl new file mode 100644 index 0000000000..965355c203 --- /dev/null +++ b/dom/webidl/FetchSignal.webidl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Exposed=(Window,Worker), + Func="FetchController::IsEnabled"] +interface FetchSignal : EventTarget { + readonly attribute boolean aborted; + + attribute EventHandler onabort; +}; diff --git a/dom/webidl/Request.webidl b/dom/webidl/Request.webidl index e29c084d00..00497456ab 100644 --- a/dom/webidl/Request.webidl +++ b/dom/webidl/Request.webidl @@ -47,6 +47,9 @@ dictionary RequestInit { RequestCache cache; RequestRedirect redirect; DOMString integrity; + + [Func="FetchController::IsEnabled"] + FetchSignal signal; }; // Gecko currently does not ship RequestContext, so please don't use it in IDL diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index 45bf92a97e..e21cd7530a 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -141,7 +141,9 @@ WEBIDL_FILES = [ 'ExtendableMessageEvent.webidl', 'FakePluginTagInit.webidl', 'Fetch.webidl', + 'FetchController.webidl', 'FetchEvent.webidl', + 'FetchSignal.webidl', 'File.webidl', 'FileList.webidl', 'FileMode.webidl', -- cgit v1.2.3 From ec792e2ac7614b8e4281f496d288f20441b837bf Mon Sep 17 00:00:00 2001 From: Moonchild Date: Thu, 11 Jun 2020 08:22:04 +0000 Subject: Issue #1587 - Part 4: Implement FetchObserver --- dom/webidl/FetchObserver.webidl | 27 +++++++++++++++++++++++++++ dom/webidl/Request.webidl | 3 +++ dom/webidl/moz.build | 1 + 3 files changed, 31 insertions(+) create mode 100644 dom/webidl/FetchObserver.webidl (limited to 'dom/webidl') diff --git a/dom/webidl/FetchObserver.webidl b/dom/webidl/FetchObserver.webidl new file mode 100644 index 0000000000..eecd67e668 --- /dev/null +++ b/dom/webidl/FetchObserver.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +callback interface ObserverCallback { + void handleEvent(FetchObserver observer); +}; + +enum FetchState { + // Pending states + "requesting", "responding", + // Final states + "aborted", "errored", "complete" +}; + +[Exposed=(Window,Worker), + Func="FetchObserver::IsEnabled"] +interface FetchObserver : EventTarget { + readonly attribute FetchState state; + + // Events + attribute EventHandler onstatechange; + attribute EventHandler onrequestprogress; + attribute EventHandler onresponseprogress; +}; diff --git a/dom/webidl/Request.webidl b/dom/webidl/Request.webidl index 00497456ab..8c6e33da33 100644 --- a/dom/webidl/Request.webidl +++ b/dom/webidl/Request.webidl @@ -50,6 +50,9 @@ dictionary RequestInit { [Func="FetchController::IsEnabled"] FetchSignal signal; + + [Func="FetchObserver::IsEnabled"] + ObserverCallback observe; }; // Gecko currently does not ship RequestContext, so please don't use it in IDL diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index e21cd7530a..22075a4436 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -143,6 +143,7 @@ WEBIDL_FILES = [ 'Fetch.webidl', 'FetchController.webidl', 'FetchEvent.webidl', + 'FetchObserver.webidl', 'FetchSignal.webidl', 'File.webidl', 'FileList.webidl', -- cgit v1.2.3 From e97a29a6569fac73e81cf46a0e682ac926ea3456 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Thu, 11 Jun 2020 23:20:52 +0000 Subject: Issue #1587 - Part 7: Rename FetchController to AbortController Also renames FetchSignal to AbortSignal. Includes renaming the various controlling prefs to enable. --- dom/webidl/AbortController.webidl | 15 +++++++++++++++ dom/webidl/AbortSignal.webidl | 13 +++++++++++++ dom/webidl/FetchController.webidl | 15 --------------- dom/webidl/FetchSignal.webidl | 13 ------------- dom/webidl/Request.webidl | 4 ++-- dom/webidl/moz.build | 4 ++-- 6 files changed, 32 insertions(+), 32 deletions(-) create mode 100644 dom/webidl/AbortController.webidl create mode 100644 dom/webidl/AbortSignal.webidl delete mode 100644 dom/webidl/FetchController.webidl delete mode 100644 dom/webidl/FetchSignal.webidl (limited to 'dom/webidl') diff --git a/dom/webidl/AbortController.webidl b/dom/webidl/AbortController.webidl new file mode 100644 index 0000000000..f5d8f317bc --- /dev/null +++ b/dom/webidl/AbortController.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Constructor(), Exposed=(Window,Worker), + Func="AbortController::IsEnabled"] +interface AbortController { + readonly attribute AbortSignal signal; + + void abort(); + void follow(AbortSignal signal); + void unfollow(AbortSignal signal); +}; diff --git a/dom/webidl/AbortSignal.webidl b/dom/webidl/AbortSignal.webidl new file mode 100644 index 0000000000..b4b03bb7e1 --- /dev/null +++ b/dom/webidl/AbortSignal.webidl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Exposed=(Window,Worker), + Func="AbortController::IsEnabled"] +interface AbortSignal : EventTarget { + readonly attribute boolean aborted; + + attribute EventHandler onabort; +}; diff --git a/dom/webidl/FetchController.webidl b/dom/webidl/FetchController.webidl deleted file mode 100644 index c5b1cc6da2..0000000000 --- a/dom/webidl/FetchController.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -[Constructor(), Exposed=(Window,Worker), - Func="FetchController::IsEnabled"] -interface FetchController { - readonly attribute FetchSignal signal; - - void abort(); - void follow(FetchSignal signal); - void unfollow(FetchSignal signal); -}; diff --git a/dom/webidl/FetchSignal.webidl b/dom/webidl/FetchSignal.webidl deleted file mode 100644 index 965355c203..0000000000 --- a/dom/webidl/FetchSignal.webidl +++ /dev/null @@ -1,13 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -[Exposed=(Window,Worker), - Func="FetchController::IsEnabled"] -interface FetchSignal : EventTarget { - readonly attribute boolean aborted; - - attribute EventHandler onabort; -}; diff --git a/dom/webidl/Request.webidl b/dom/webidl/Request.webidl index 8c6e33da33..fe6a63ec0d 100644 --- a/dom/webidl/Request.webidl +++ b/dom/webidl/Request.webidl @@ -48,8 +48,8 @@ dictionary RequestInit { RequestRedirect redirect; DOMString integrity; - [Func="FetchController::IsEnabled"] - FetchSignal signal; + [Func="AbortController::IsEnabled"] + AbortSignal signal; [Func="FetchObserver::IsEnabled"] ObserverCallback observe; diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index 22075a4436..b2dcf8d8d3 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -17,6 +17,8 @@ PREPROCESSED_WEBIDL_FILES = [ ] WEBIDL_FILES = [ + 'AbortController.webidl', + 'AbortSignal.webidl', 'AbstractWorker.webidl', 'AnalyserNode.webidl', 'Animatable.webidl', @@ -141,10 +143,8 @@ WEBIDL_FILES = [ 'ExtendableMessageEvent.webidl', 'FakePluginTagInit.webidl', 'Fetch.webidl', - 'FetchController.webidl', 'FetchEvent.webidl', 'FetchObserver.webidl', - 'FetchSignal.webidl', 'File.webidl', 'FileList.webidl', 'FileMode.webidl', -- cgit v1.2.3 From 94c694d389ceb2c797d7ee1854cc84c87349c2f5 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Fri, 12 Jun 2020 01:08:26 +0000 Subject: Issue #1587 - Part 8: Remove controller follow/unfollow Since it didn't end up being in the final spec after all. --- dom/webidl/AbortController.webidl | 2 -- 1 file changed, 2 deletions(-) (limited to 'dom/webidl') diff --git a/dom/webidl/AbortController.webidl b/dom/webidl/AbortController.webidl index f5d8f317bc..4e91240751 100644 --- a/dom/webidl/AbortController.webidl +++ b/dom/webidl/AbortController.webidl @@ -10,6 +10,4 @@ interface AbortController { readonly attribute AbortSignal signal; void abort(); - void follow(AbortSignal signal); - void unfollow(AbortSignal signal); }; -- cgit v1.2.3