summaryrefslogtreecommitdiffstats
path: root/dom/abort/AbortSignal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/abort/AbortSignal.cpp')
-rw-r--r--dom/abort/AbortSignal.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/dom/abort/AbortSignal.cpp b/dom/abort/AbortSignal.cpp
index 20f36d2ab..7ee6c49a9 100644
--- a/dom/abort/AbortSignal.cpp
+++ b/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();