Bug 1445392: Avoid posting a slotchange event microtask during shutdown. r=smaug
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 07 May 2018 20:49:47 +0200
changeset 474077 370b059664527629e95b3ff6e9aaabea04b846e9
parent 474076 670ddc4fc00cb7221a4f643594796f205a165969
child 474078 c1a42cd3277611fd9356f11d450da775a467d465
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1445392
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1445392: Avoid posting a slotchange event microtask during shutdown. r=smaug MozReview-Commit-ID: 1ga6cDVRX5
dom/html/HTMLSlotElement.cpp
xpcom/build/nsXPCOM.h
xpcom/build/nsXPCOMPrivate.h
--- 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