Bug 1510633, no need to remove ShadowRoot's MutationObserver if there isn't host anymore, r=emilio,edgar
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 29 Nov 2018 15:15:22 +0200
changeset 507950 b9b9586a6d8b7f291d5d03a107810dff8b7fab78
parent 507949 a6ccef7ece93aa126964145f7ffa99939295d677
child 507951 5c1893bd77c26d9fc69aa5df4820d76c0ba5100a
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio, edgar
bugs1510633
milestone65.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 1510633, no need to remove ShadowRoot's MutationObserver if there isn't host anymore, r=emilio,edgar
dom/base/ShadowRoot.cpp
--- a/dom/base/ShadowRoot.cpp
+++ b/dom/base/ShadowRoot.cpp
@@ -177,17 +177,23 @@ ShadowRoot::Unbind()
     child->UnbindFromTree(true, false);
   }
 }
 
 void
 ShadowRoot::Unattach()
 {
   MOZ_ASSERT(!HasSlots(), "Won't work!");
-  MOZ_ASSERT(GetHost());
+  if (!GetHost()) {
+    // It is possible that we've been unlinked already. In such case host
+    // should have called Unbind and ShadowRoot's own unlink
+    // RemoveMutationObserver.
+    return;
+  }
+
   Unbind();
   GetHost()->RemoveMutationObserver(this);
   SetHost(nullptr);
 }
 
 void
 ShadowRoot::InvalidateStyleAndLayoutOnSubtree(Element* aElement)
 {