diff options
Diffstat (limited to 'dom/base/DocGroup.cpp')
-rw-r--r-- | dom/base/DocGroup.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/dom/base/DocGroup.cpp b/dom/base/DocGroup.cpp index ba9189168..5d7db1fb6 100644 --- a/dom/base/DocGroup.cpp +++ b/dom/base/DocGroup.cpp @@ -1,3 +1,7 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + #include "mozilla/dom/DocGroup.h" #include "mozilla/dom/TabGroup.h" #include "mozilla/Telemetry.h" @@ -6,11 +10,14 @@ #include "mozilla/StaticPtr.h" #include "mozilla/ClearOnShutdown.h" #include "nsIDocShell.h" +#include "nsDOMMutationObserver.h" #include "nsNetCID.h" namespace mozilla { namespace dom { +AutoTArray<RefPtr<DocGroup>, 2>* DocGroup::sPendingDocGroups = nullptr; + /* static */ void DocGroup::GetKey(nsIPrincipal* aPrincipal, nsACString& aKey) { @@ -47,10 +54,31 @@ DocGroup::DocGroup(TabGroup* aTabGroup, const nsACString& aKey) DocGroup::~DocGroup() { MOZ_ASSERT(mDocuments.IsEmpty()); + if (!NS_IsMainThread()) { + NS_ReleaseOnMainThread(mReactionsStack.forget()); + } mTabGroup->mDocGroups.RemoveEntry(mKey); } NS_IMPL_ISUPPORTS(DocGroup, nsISupports) +void +DocGroup::SignalSlotChange(const HTMLSlotElement* aSlot) +{ + if (mSignalSlotList.Contains(aSlot)) { + return; + } + + mSignalSlotList.AppendElement(const_cast<HTMLSlotElement*>(aSlot)); + + if (!sPendingDocGroups) { + // Queue a mutation observer compound microtask. + nsDOMMutationObserver::QueueMutationObserverMicroTask(); + sPendingDocGroups = new AutoTArray<RefPtr<DocGroup>, 2>; + } + + sPendingDocGroups->AppendElement(this); +} + } } |