mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 16:58:38 +09:00
Issue #2676 - Implement AbortSignal.timeout()
This is a stub implementation because of the considerable abuse risk and bad web code risk causing DoS, e.g. when using bad timeout values and callbacks on the AbortSignal (e.g. recursive). Considering the abort-ability of these signals otherwise there is never a guarantee to websites that these signals will be triggered anyway, so it should be considered an optional signal - meaning we can safely just ignore the timeout, which allows us to avoid a ton of complexity and potential sec/privacy issues. Primary use in the wild seems to be detailed profiling/ad metrics anyway; we don't really want to encourage that!
This commit is contained in:
parent
9fa4b6fd5d
commit
14c84e22a9
3 changed files with 15 additions and 0 deletions
|
|
@ -49,6 +49,15 @@ already_AddRefed<AbortSignal> AbortSignal::Abort(GlobalObject& aGlobal) {
|
|||
return abortSignal.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<AbortSignal> AbortSignal::Timeout(GlobalObject& aGlobal, uint64_t aMilliseconds) {
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
|
||||
// Stub implementation, just return an AbortSignal object
|
||||
RefPtr<AbortSignal> abortSignal = new AbortSignal(global, false);
|
||||
|
||||
return abortSignal.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
AbortSignal::Aborted() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -47,9 +47,13 @@ public:
|
|||
Aborted() const;
|
||||
|
||||
void Abort();
|
||||
void Timeout();
|
||||
|
||||
IMPL_EVENT_HANDLER(abort);
|
||||
IMPL_EVENT_HANDLER(timeout);
|
||||
|
||||
static already_AddRefed<AbortSignal> Abort(GlobalObject& aGlobal);
|
||||
static already_AddRefed<AbortSignal> Timeout(GlobalObject& aGlobal, uint64_t aMilliseconds);
|
||||
|
||||
void
|
||||
AddFollower(Follower* aFollower);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
Func="AbortController::IsEnabled"]
|
||||
interface AbortSignal : EventTarget {
|
||||
[NewObject] static AbortSignal abort();
|
||||
[NewObject] static AbortSignal timeout(unsigned long long milliseconds);
|
||||
|
||||
readonly attribute boolean aborted;
|
||||
|
||||
attribute EventHandler onabort;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue