diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index d2b2267284..616d187bad 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -140,6 +140,7 @@ set(SOURCES Fetch/Infrastructure/MimeTypeBlocking.cpp Fetch/Infrastructure/NoSniffBlocking.cpp Fetch/Infrastructure/PortBlocking.cpp + Fetch/Infrastructure/Task.cpp Fetch/Infrastructure/URL.cpp Fetch/Request.cpp Fetch/Response.cpp 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 + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include + +namespace Web::Fetch::Infrastructure { + +// https://fetch.spec.whatwg.org/#queue-a-fetch-task +void queue_fetch_task(JS::Object& task_destination, JS::SafeFunction 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 + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include +#include + +namespace Web::Fetch::Infrastructure { + +void queue_fetch_task(JS::Object&, JS::SafeFunction); + +}