summaryrefslogtreecommitdiffstats
path: root/dom/base/DocGroup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/base/DocGroup.cpp')
-rw-r--r--dom/base/DocGroup.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/dom/base/DocGroup.cpp b/dom/base/DocGroup.cpp
index 30c058f0c..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,10 +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)
{
@@ -54,5 +62,23 @@ DocGroup::~DocGroup()
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);
+}
+
}
}