mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 22:38:13 +00:00
LibWeb: Add initial support for AbortController and AbortSignal
The DOM specification says that the primary use case for these is to give Promises abort semantics. It is also a prerequisite for Fetch, as it is used to make Fetch abortable. a
This commit is contained in:
parent
dd1a49ff93
commit
1d8f8ea5b1
11 changed files with 254 additions and 0 deletions
28
Userland/Libraries/LibWeb/DOM/AbortController.cpp
Normal file
28
Userland/Libraries/LibWeb/DOM/AbortController.cpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/DOM/AbortController.h>
|
||||
#include <LibWeb/DOM/AbortSignal.h>
|
||||
|
||||
namespace Web::DOM {
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-abortcontroller-abortcontroller
|
||||
AbortController::AbortController(Document& document)
|
||||
: m_signal(AbortSignal::create(document))
|
||||
{
|
||||
}
|
||||
|
||||
AbortController::~AbortController()
|
||||
{
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-abortcontroller-abort
|
||||
void AbortController::abort()
|
||||
{
|
||||
m_signal->signal_abort();
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue