Commit ca7d9cf2 authored by Edgar Chen's avatar Edgar Chen Committed by Pier Angelo Vendrame
Browse files

Bug 2038439 - Clean up stylesheets when destroying Document/ShadowRoot; a=dmeehan DONTBUILD

parent ad78fa61
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2565,6 +2565,8 @@ Document::~Document() {
    mDocGroup->GetBrowsingContextGroup()->RemoveDocument(this, mDocGroup);
  }
  DocumentOrShadowRoot::Unlink(this);
  UnlinkOriginalDocumentIfStatic();
  UnregisterFromMemoryReportingForDataDocument();
+1 −3
Original line number Diff line number Diff line
@@ -62,9 +62,7 @@ void DocumentOrShadowRoot::AddSizeOfExcludingThis(nsWindowSizes& aSizes) const {
}

DocumentOrShadowRoot::~DocumentOrShadowRoot() {
  for (StyleSheet* sheet : mStyleSheets) {
    sheet->ClearAssociatedDocumentOrShadowRoot();
  }
  MOZ_ASSERT(mStyleSheets.IsEmpty());
}

StyleSheetList* DocumentOrShadowRoot::StyleSheets() {
+2 −0
Original line number Diff line number Diff line
@@ -105,6 +105,8 @@ ShadowRoot::~ShadowRoot() {

  MOZ_DIAGNOSTIC_ASSERT(!OwnerDoc()->IsComposedDocShadowRoot(*this));

  DocumentOrShadowRoot::Unlink(this);

  UnsetFlags(NODE_IS_IN_SHADOW_TREE);

  // nsINode destructor expects mSubtreeRoot == this.