diff --git a/dom/base/StyleSheetList.cpp b/dom/base/StyleSheetList.cpp index e1815c96f003..bb49ec100571 100644 --- a/dom/base/StyleSheetList.cpp +++ b/dom/base/StyleSheetList.cpp @@ -28,7 +28,7 @@ JSObject* StyleSheetList::WrapObject(JSContext* aCx, return StyleSheetList_Binding::Wrap(aCx, this, aGivenProto); } -void StyleSheetList::NodeWillBeDestroyed(nsINode* aNode) { +void StyleSheetList::NodeWillBeDestroyed(const nsINode* aNode) { mDocumentOrShadowRoot = nullptr; } diff --git a/dom/base/nsContentList.cpp b/dom/base/nsContentList.cpp index 22aab8d55171..4bada9122818 100644 --- a/dom/base/nsContentList.cpp +++ b/dom/base/nsContentList.cpp @@ -590,7 +590,7 @@ int32_t nsContentList::IndexOf(nsIContent* aContent) { return IndexOf(aContent, true); } -void nsContentList::NodeWillBeDestroyed(nsINode* aNode) { +void nsContentList::NodeWillBeDestroyed(const nsINode* aNode) { // We shouldn't do anything useful from now on RemoveFromCaches(); diff --git a/dom/base/nsDOMMutationObserver.cpp b/dom/base/nsDOMMutationObserver.cpp index a97b4bca981f..9b35ffeae4ec 100644 --- a/dom/base/nsDOMMutationObserver.cpp +++ b/dom/base/nsDOMMutationObserver.cpp @@ -374,7 +374,7 @@ void nsMutationReceiver::ContentRemoved(nsIContent* aChild, Observer()->ScheduleForRun(); } -void nsMutationReceiver::NodeWillBeDestroyed(nsINode* aNode) { +void nsMutationReceiver::NodeWillBeDestroyed(const nsINode* aNode) { NS_ASSERTION(!mParent, "Shouldn't have mParent here!"); Disconnect(true); } diff --git a/dom/base/nsIMutationObserver.h b/dom/base/nsIMutationObserver.h index 6e25d11eee72..abc3ffdba029 100644 --- a/dom/base/nsIMutationObserver.h +++ b/dom/base/nsIMutationObserver.h @@ -288,7 +288,7 @@ class nsIMutationObserver * the observer. The observer is responsible for making sure it * stays alive for the duration of the call as needed. */ - virtual void NodeWillBeDestroyed(nsINode* aNode) = 0; + virtual void NodeWillBeDestroyed(const nsINode* aNode) = 0; /** * Notification that the node's parent chain has changed. This @@ -345,7 +345,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIMutationObserver, NS_IMUTATION_OBSERVER_IID) nsIContent* aPreviousSibling) override; #define NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED \ - virtual void NodeWillBeDestroyed(nsINode* aNode) override; + virtual void NodeWillBeDestroyed(const nsINode* aNode) override; #define NS_DECL_NSIMUTATIONOBSERVER_PARENTCHAINCHANGED \ virtual void ParentChainChanged(nsIContent* aContent) override; @@ -363,7 +363,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIMutationObserver, NS_IMUTATION_OBSERVER_IID) NS_DECL_NSIMUTATIONOBSERVER_PARENTCHAINCHANGED #define NS_IMPL_NSIMUTATIONOBSERVER_CORE_STUB(_class) \ - void _class::NodeWillBeDestroyed(nsINode* aNode) {} + void _class::NodeWillBeDestroyed(const nsINode* aNode) {} #define NS_IMPL_NSIMUTATIONOBSERVER_CONTENT(_class) \ void _class::CharacterDataWillChange( \ diff --git a/dom/base/nsStubMutationObserver.cpp b/dom/base/nsStubMutationObserver.cpp index a7d017474a70..e0ea4941d65c 100644 --- a/dom/base/nsStubMutationObserver.cpp +++ b/dom/base/nsStubMutationObserver.cpp @@ -100,12 +100,11 @@ class MutationObserverWrapper final : public nsIMutationObserver { mOwner->ContentRemoved(aChild, aPreviousSibling); } - void NodeWillBeDestroyed(nsINode* aNode) override { + void NodeWillBeDestroyed(const nsINode* aNode) override { MOZ_ASSERT(mOwner); - AddRefWrapper(); RefPtr owner = mOwner; owner->NodeWillBeDestroyed(aNode); - owner->RemoveMutationObserverFromNode(aNode); + owner->mWrapperForNode.Remove(const_cast(aNode)); mOwner = nullptr; ReleaseWrapper(); } diff --git a/dom/base/nsTextNode.cpp b/dom/base/nsTextNode.cpp index fd56b04c57d6..b92f8dfa8506 100644 --- a/dom/base/nsTextNode.cpp +++ b/dom/base/nsTextNode.cpp @@ -240,7 +240,7 @@ void nsAttributeTextNode::AttributeChanged(Element* aElement, } } -void nsAttributeTextNode::NodeWillBeDestroyed(nsINode* aNode) { +void nsAttributeTextNode::NodeWillBeDestroyed(const nsINode* aNode) { NS_ASSERTION(aNode == static_cast(mGrandparent), "Wrong node!"); mGrandparent = nullptr; } diff --git a/dom/html/HTMLTableElement.cpp b/dom/html/HTMLTableElement.cpp index d6fc1573c277..24a4097445c2 100644 --- a/dom/html/HTMLTableElement.cpp +++ b/dom/html/HTMLTableElement.cpp @@ -489,7 +489,7 @@ void TableRowsCollection::ContentRemoved(nsIContent* aChild, } } -void TableRowsCollection::NodeWillBeDestroyed(nsINode* aNode) { +void TableRowsCollection::NodeWillBeDestroyed(const nsINode* aNode) { // Set mInitialized to false so CleanUp doesn't try to remove our mutation // observer, as we're going away. CleanUp() will reset mInitialized to true as // it returns. diff --git a/dom/svg/SVGUseElement.cpp b/dom/svg/SVGUseElement.cpp index b2382baef0ab..25521a5ba857 100644 --- a/dom/svg/SVGUseElement.cpp +++ b/dom/svg/SVGUseElement.cpp @@ -236,7 +236,7 @@ void SVGUseElement::ContentRemoved(nsIContent* aChild, } } -void SVGUseElement::NodeWillBeDestroyed(nsINode* aNode) { +void SVGUseElement::NodeWillBeDestroyed(const nsINode* aNode) { nsCOMPtr kungFuDeathGrip(this); UnlinkSource(); } diff --git a/dom/xml/nsXMLPrettyPrinter.cpp b/dom/xml/nsXMLPrettyPrinter.cpp index 4a386e92fbec..0e02054eac55 100644 --- a/dom/xml/nsXMLPrettyPrinter.cpp +++ b/dom/xml/nsXMLPrettyPrinter.cpp @@ -177,7 +177,7 @@ void nsXMLPrettyPrinter::ContentRemoved(nsIContent* aChild, MaybeUnhook(aChild->GetParent()); } -void nsXMLPrettyPrinter::NodeWillBeDestroyed(nsINode* aNode) { +void nsXMLPrettyPrinter::NodeWillBeDestroyed(const nsINode* aNode) { mDocument = nullptr; NS_RELEASE_THIS(); } diff --git a/dom/xslt/xpath/XPathResult.cpp b/dom/xslt/xpath/XPathResult.cpp index 091a83528ff7..f6ffd6d05d49 100644 --- a/dom/xslt/xpath/XPathResult.cpp +++ b/dom/xslt/xpath/XPathResult.cpp @@ -96,7 +96,7 @@ nsINode* XPathResult::IterateNext(ErrorResult& aRv) { return mResultNodes.SafeElementAt(mCurrentPos++); } -void XPathResult::NodeWillBeDestroyed(nsINode* aNode) { +void XPathResult::NodeWillBeDestroyed(const nsINode* aNode) { nsCOMPtr kungFuDeathGrip(this); // Set to null to avoid unregistring unnecessarily mDocument = nullptr; diff --git a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp index f3d4272e6f36..fd7fb2b9d4eb 100644 --- a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp +++ b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp @@ -1052,7 +1052,7 @@ nsresult txMozillaXSLTProcessor::ensureStylesheet() { return TX_CompileStylesheet(style, this, getter_AddRefs(mStylesheet)); } -void txMozillaXSLTProcessor::NodeWillBeDestroyed(nsINode* aNode) { +void txMozillaXSLTProcessor::NodeWillBeDestroyed(const nsINode* aNode) { nsCOMPtr kungFuDeathGrip(this); if (NS_FAILED(mCompileResult)) { return; diff --git a/dom/xul/ChromeObserver.cpp b/dom/xul/ChromeObserver.cpp index 4a21fdbbbb66..d5edd4fa4afe 100644 --- a/dom/xul/ChromeObserver.cpp +++ b/dom/xul/ChromeObserver.cpp @@ -199,7 +199,7 @@ void ChromeObserver::AttributeChanged(dom::Element* aElement, } } -void ChromeObserver::NodeWillBeDestroyed(nsINode* aNode) { +void ChromeObserver::NodeWillBeDestroyed(const nsINode* aNode) { mDocument = nullptr; } diff --git a/editor/libeditor/HTMLAnonymousNodeEditor.cpp b/editor/libeditor/HTMLAnonymousNodeEditor.cpp index 4c83c0a22e6b..f5315628aa24 100644 --- a/editor/libeditor/HTMLAnonymousNodeEditor.cpp +++ b/editor/libeditor/HTMLAnonymousNodeEditor.cpp @@ -115,7 +115,7 @@ void ElementDeletionObserver::ParentChainChanged(nsIContent* aContent) { NS_RELEASE_THIS(); } -void ElementDeletionObserver::NodeWillBeDestroyed(nsINode* aNode) { +void ElementDeletionObserver::NodeWillBeDestroyed(const nsINode* aNode) { NS_ASSERTION(aNode == mNativeAnonNode || aNode == mObservedElement, "Wrong aNode!"); if (aNode == mNativeAnonNode) { diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index de354dee5f2b..a888d62a7abd 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -276,7 +276,7 @@ void BFCachePreventionObserver::ContentRemoved(nsIContent* aChild, MutationHappened(); } -void BFCachePreventionObserver::NodeWillBeDestroyed(nsINode* aNode) { +void BFCachePreventionObserver::NodeWillBeDestroyed(const nsINode* aNode) { mDocument = nullptr; } diff --git a/layout/xul/tree/nsTreeContentView.cpp b/layout/xul/tree/nsTreeContentView.cpp index edb5368e2abf..777fa884c820 100644 --- a/layout/xul/tree/nsTreeContentView.cpp +++ b/layout/xul/tree/nsTreeContentView.cpp @@ -955,7 +955,7 @@ void nsTreeContentView::ContentRemoved(nsIContent* aChild, } } -void nsTreeContentView::NodeWillBeDestroyed(nsINode* aNode) { +void nsTreeContentView::NodeWillBeDestroyed(const nsINode* aNode) { // XXXbz do we need this strong ref? Do we drop refs to self in ClearRows? nsCOMPtr kungFuDeathGrip(this); ClearRows(); diff --git a/toolkit/components/satchel/nsFormFillController.cpp b/toolkit/components/satchel/nsFormFillController.cpp index 774224bb1da0..70312fa51477 100644 --- a/toolkit/components/satchel/nsFormFillController.cpp +++ b/toolkit/components/satchel/nsFormFillController.cpp @@ -200,11 +200,10 @@ void nsFormFillController::NativeAnonymousChildListChange(nsIContent* aContent, void nsFormFillController::ParentChainChanged(nsIContent* aContent) {} MOZ_CAN_RUN_SCRIPT_BOUNDARY -void nsFormFillController::NodeWillBeDestroyed(nsINode* aNode) { +void nsFormFillController::NodeWillBeDestroyed(const nsINode* aNode) { MOZ_LOG(sLogger, LogLevel::Verbose, ("NodeWillBeDestroyed: %p", aNode)); mPwmgrInputs.Remove(aNode); mAutofillInputs.Remove(aNode); - MaybeRemoveMutationObserver(aNode); if (aNode == mListNode) { mListNode = nullptr; RevalidateDataList(); diff --git a/widget/cocoa/nsMenuGroupOwnerX.mm b/widget/cocoa/nsMenuGroupOwnerX.mm index 5eb8b050fc5e..b5afb18023c9 100644 --- a/widget/cocoa/nsMenuGroupOwnerX.mm +++ b/widget/cocoa/nsMenuGroupOwnerX.mm @@ -53,7 +53,7 @@ void nsMenuGroupOwnerX::ContentAppended(nsIContent* aFirstNewContent) { } } -void nsMenuGroupOwnerX::NodeWillBeDestroyed(nsINode* aNode) {} +void nsMenuGroupOwnerX::NodeWillBeDestroyed(const nsINode* aNode) {} void nsMenuGroupOwnerX::AttributeWillChange(dom::Element* aElement, int32_t aNameSpaceID, nsAtom* aAttribute, int32_t aModType) {}