Bug 1445392: Avoid posting a slotchange event microtask during shutdown. r?smaug
Not sure if moving stuff to nsXPCOM is acceptable or if I should add an NS_*
function instead.
MozReview-Commit-ID: 1ga6cDVRX5
--- a/dom/html/HTMLSlotElement.cpp
+++ b/dom/html/HTMLSlotElement.cpp
@@ -215,16 +215,22 @@ HTMLSlotElement::ClearAssignedNodes()
void
HTMLSlotElement::EnqueueSlotChangeEvent()
{
if (mInSignalSlotList) {
return;
}
+ // FIXME(bug 1459704): Need to figure out how to deal with microtasks posted
+ // during shutdown.
+ if (gXPCOMThreadsShutDown) {
+ return;
+ }
+
DocGroup* docGroup = OwnerDoc()->GetDocGroup();
if (!docGroup) {
return;
}
mInSignalSlotList = true;
docGroup->SignalSlotChange(*this);
}
--- a/xpcom/build/nsXPCOM.h
+++ b/xpcom/build/nsXPCOM.h
@@ -24,16 +24,21 @@ DECL_CLASS(nsIComponentManager);
DECL_CLASS(nsIComponentRegistrar);
DECL_CLASS(nsIServiceManager);
DECL_CLASS(nsIFile);
DECL_CLASS(nsIDirectoryServiceProvider);
DECL_CLASS(nsIMemory);
DECL_CLASS(nsIDebug2);
#ifdef __cplusplus
+extern bool gXPCOMShuttingDown;
+extern bool gXPCOMThreadsShutDown;
+#endif
+
+#ifdef __cplusplus
#include "nsStringFwd.h"
namespace mozilla {
struct Module;
} // namespace mozilla
#endif
/**
* Initialises XPCOM. You must call one of the NS_InitXPCOM methods
--- a/xpcom/build/nsXPCOMPrivate.h
+++ b/xpcom/build/nsXPCOMPrivate.h
@@ -111,19 +111,16 @@ void LogTerm();
#define MAXPATHLEN _MAX_PATH
#elif defined(CCHMAXPATH)
#define MAXPATHLEN CCHMAXPATH
#else
#define MAXPATHLEN 1024
#endif
#endif
-extern bool gXPCOMShuttingDown;
-extern bool gXPCOMThreadsShutDown;
-
// Needed by the IPC layer from off the main thread
extern char16_t* gGREBinPath;
namespace mozilla {
namespace services {
/**
* Clears service cache, sets gXPCOMShuttingDown