Browse Source

Issue #1587 followup - Improve resilience of AbortSignals.

pull/24/head
Moonchild 2 years ago committed by Roy Tam
parent
commit
589e9b77ae
  1. 9
      dom/abort/AbortSignal.cpp
  2. 2
      dom/abort/moz.build

9
dom/abort/AbortSignal.cpp

@ -56,9 +56,16 @@ AbortSignal::Aborted() const
void
AbortSignal::Abort()
{
MOZ_ASSERT(!mAborted);
// Re-entrancy guard
if (mAborted) {
return;
}
mAborted = true;
// We might be deleted as a result of aborting a follower, so ensure we
// stay alive until all followers have been aborted.
RefPtr<AbortSignal> pinThis = this;
// Let's inform the followers.
for (uint32_t i = 0; i < mFollowers.Length(); ++i) {
mFollowers[i]->Aborted();

2
dom/abort/moz.build

@ -14,7 +14,7 @@ EXPORTS.mozilla.dom += [
'AbortSignal.h',
]
UNIFIED_SOURCES += [
SOURCES += [
'AbortController.cpp',
'AbortSignal.cpp',
]

Loading…
Cancel
Save