summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Fetch
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-10-25 19:36:50 +0100
committerLinus Groh <mail@linusgroh.de>2022-10-30 20:10:29 +0000
commit14e722617cbdac6a942e075c9f648d23ecd4bec4 (patch)
treede73b049d64e691602916501f90640fab5934acb /Userland/Libraries/LibWeb/Fetch
parent6deb5ce9b5a76a22245997e434503a2cd63218d1 (diff)
downloadserenity-14e722617cbdac6a942e075c9f648d23ecd4bec4.zip
LibWeb: Implement 'Queue a fetch task' AO
Diffstat (limited to 'Userland/Libraries/LibWeb/Fetch')
-rw-r--r--Userland/Libraries/LibWeb/Fetch/Infrastructure/Task.cpp21
-rw-r--r--Userland/Libraries/LibWeb/Fetch/Infrastructure/Task.h16
2 files changed, 37 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/Task.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/Task.cpp
new file mode 100644
index 0000000000..3718f91acd
--- /dev/null
+++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/Task.cpp
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <LibWeb/Fetch/Infrastructure/Task.h>
+#include <LibWeb/HTML/EventLoop/EventLoop.h>
+
+namespace Web::Fetch::Infrastructure {
+
+// https://fetch.spec.whatwg.org/#queue-a-fetch-task
+void queue_fetch_task(JS::Object& task_destination, JS::SafeFunction<void()> algorithm)
+{
+ // FIXME: 1. If taskDestination is a parallel queue, then enqueue algorithm to taskDestination.
+
+ // 2. Otherwise, queue a global task on the networking task source with taskDestination and algorithm.
+ HTML::queue_global_task(HTML::Task::Source::Networking, task_destination, move(algorithm));
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/Task.h b/Userland/Libraries/LibWeb/Fetch/Infrastructure/Task.h
new file mode 100644
index 0000000000..af2544c6b7
--- /dev/null
+++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/Task.h
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <LibJS/Forward.h>
+#include <LibJS/SafeFunction.h>
+
+namespace Web::Fetch::Infrastructure {
+
+void queue_fetch_task(JS::Object&, JS::SafeFunction<void()>);
+
+}