Skip to content

Commit 14e7226

Browse files
committed
LibWeb: Implement 'Queue a fetch task' AO
1 parent 6deb5ce commit 14e7226

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

Userland/Libraries/LibWeb/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ set(SOURCES
140140
Fetch/Infrastructure/MimeTypeBlocking.cpp
141141
Fetch/Infrastructure/NoSniffBlocking.cpp
142142
Fetch/Infrastructure/PortBlocking.cpp
143+
Fetch/Infrastructure/Task.cpp
143144
Fetch/Infrastructure/URL.cpp
144145
Fetch/Request.cpp
145146
Fetch/Response.cpp
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
3+
*
4+
* SPDX-License-Identifier: BSD-2-Clause
5+
*/
6+
7+
#include <LibWeb/Fetch/Infrastructure/Task.h>
8+
#include <LibWeb/HTML/EventLoop/EventLoop.h>
9+
10+
namespace Web::Fetch::Infrastructure {
11+
12+
// https://fetch.spec.whatwg.org/#queue-a-fetch-task
13+
void queue_fetch_task(JS::Object& task_destination, JS::SafeFunction<void()> algorithm)
14+
{
15+
// FIXME: 1. If taskDestination is a parallel queue, then enqueue algorithm to taskDestination.
16+
17+
// 2. Otherwise, queue a global task on the networking task source with taskDestination and algorithm.
18+
HTML::queue_global_task(HTML::Task::Source::Networking, task_destination, move(algorithm));
19+
}
20+
21+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
3+
*
4+
* SPDX-License-Identifier: BSD-2-Clause
5+
*/
6+
7+
#pragma once
8+
9+
#include <LibJS/Forward.h>
10+
#include <LibJS/SafeFunction.h>
11+
12+
namespace Web::Fetch::Infrastructure {
13+
14+
void queue_fetch_task(JS::Object&, JS::SafeFunction<void()>);
15+
16+
}

0 commit comments

Comments
 (0)