author | Emilio Cobos Álvarez <emilio@crisal.io> |
Sat, 17 Feb 2018 01:46:35 +0100 | |
changeset 405200 | c1a45d6a53909e929f253fe5b6522ba2de3baaee |
parent 405199 | 1e9461ca597bc56959b02bda1c635b9bbe671c1a |
child 405201 | ef984964576b10af234557b817e3398bb465b966 |
push id | 33509 |
push user | apavel@mozilla.com |
push date | Sun, 25 Feb 2018 13:07:10 +0000 |
treeherder | mozilla-central@6980116aa15d [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bz |
bugs | 1439036 |
milestone | 60.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
|
--- a/editor/libeditor/HTMLAnonymousNodeEditor.cpp +++ b/editor/libeditor/HTMLAnonymousNodeEditor.cpp @@ -292,35 +292,38 @@ HTMLEditor::DeleteRefToAnonymousNode(Man nsIContent* parentContent = aContent->GetParent(); if (NS_WARN_IF(!parentContent)) { // aContent was already removed? return; } nsAutoScriptBlocker scriptBlocker; // Need to check whether aShell has been destroyed (but not yet deleted). - // In that case presContext->GetPresShell() returns nullptr. // See bug 338129. - if (aContent->IsInComposedDoc() && aShell && aShell->GetPresContext() && - aShell->GetPresContext()->GetPresShell() == aShell) { - nsCOMPtr<nsIDocumentObserver> docObserver = do_QueryInterface(aShell); - if (docObserver) { - // Call BeginUpdate() so that the nsCSSFrameConstructor/PresShell - // knows we're messing with the frame tree. - nsCOMPtr<nsIDocument> document = GetDocument(); - if (document) { - docObserver->BeginUpdate(document, UPDATE_CONTENT_MODEL); - } + if (aContent->IsInComposedDoc() && aShell && !aShell->IsDestroying()) { + // Call BeginUpdate() so that the nsCSSFrameConstructor/PresShell + // knows we're messing with the frame tree. + // + // FIXME(emilio): Shouldn't this use the document update mechanism instead? + // Also, is it really needed? This is NAC anyway. + nsCOMPtr<nsIDocument> document = GetDocument(); + if (document) { + aShell->BeginUpdate(document, UPDATE_CONTENT_MODEL); + } - docObserver->ContentRemoved(aContent->GetComposedDoc(), - parentContent, aContent, - aContent->GetPreviousSibling()); - if (document) { - docObserver->EndUpdate(document, UPDATE_CONTENT_MODEL); - } + MOZ_ASSERT(aContent->IsRootOfAnonymousSubtree()); + MOZ_ASSERT(!aContent->GetPreviousSibling(), "NAC has no siblings"); + + // FIXME(emilio): This is the only caller to PresShell::ContentRemoved that + // passes NAC into it. This is not great! + aShell->ContentRemoved( + aContent->GetComposedDoc(), parentContent, aContent, nullptr); + + if (document) { + aShell->EndUpdate(document, UPDATE_CONTENT_MODEL); } } // The ManualNACPtr destructor will invoke UnbindFromTree. } // The following method is mostly called by a selection listener. When a // selection change is notified, the method is called to check if resizing