summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-08-28 18:15:27 +0000
committerMoonchild <moonchild@palemoon.org>2020-08-28 18:15:27 +0000
commit5559674becdb441a02fb0438de20bbc9ca5b97a7 (patch)
tree49a752dddbd6cca6a7de422211f24e954d2f9d37
parent7407fe22fca249c699ca394755c05ef87791fb95 (diff)
downloadUXP-5559674becdb441a02fb0438de20bbc9ca5b97a7.tar
UXP-5559674becdb441a02fb0438de20bbc9ca5b97a7.tar.gz
UXP-5559674becdb441a02fb0438de20bbc9ca5b97a7.tar.lz
UXP-5559674becdb441a02fb0438de20bbc9ca5b97a7.tar.xz
UXP-5559674becdb441a02fb0438de20bbc9ca5b97a7.zip
Issue #1587 followup - Improve resilience of AbortSignals.
-rw-r--r--dom/abort/AbortSignal.cpp9
-rw-r--r--dom/abort/moz.build2
2 files changed, 9 insertions, 2 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();
diff --git a/dom/abort/moz.build b/dom/abort/moz.build
index cb48ee15f..eacc9ddc7 100644
--- a/dom/abort/moz.build
+++ b/dom/abort/moz.build
@@ -14,7 +14,7 @@ EXPORTS.mozilla.dom += [
'AbortSignal.h',
]
-UNIFIED_SOURCES += [
+SOURCES += [
'AbortController.cpp',
'AbortSignal.cpp',
]