mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 578696 part 11. Stop holding strong refs when calling ContentRemoved and remove the now-unused IMPL_STRONGREF_MUTATION_NOTIFICATION macro. r=sicking
This commit is contained in:
parent
235296fdf0
commit
93922db9e1
@ -259,6 +259,12 @@ public:
|
||||
* @param aChild The child that was removed.
|
||||
* @param aIndexInContainer The index in the container which the child used
|
||||
* to have.
|
||||
*
|
||||
* @note Callers of this method might not hold a strong reference to the
|
||||
* observer. The observer is responsible for making sure it stays
|
||||
* alive for the duration of the call as needed. The observer may
|
||||
* assume that this call will happen when there are script blockers on
|
||||
* the stack.
|
||||
*/
|
||||
virtual void ContentRemoved(nsIDocument *aDocument,
|
||||
nsIContent* aContainer,
|
||||
|
@ -86,29 +86,6 @@ using namespace mozilla::dom;
|
||||
} while (node); \
|
||||
PR_END_MACRO
|
||||
|
||||
// This macro expects the ownerDocument of content_ to be in scope as
|
||||
// |nsIDocument* doc|
|
||||
#define IMPL_STRONGREF_MUTATION_NOTIFICATION(func_, content_, params_) \
|
||||
PR_BEGIN_MACRO \
|
||||
nsINode* node = content_; \
|
||||
NS_ASSERTION(node->GetOwnerDoc() == doc, "Bogus document"); \
|
||||
if (doc) { \
|
||||
static_cast<nsIMutationObserver*>(doc->BindingManager())-> \
|
||||
func_ params_; \
|
||||
} \
|
||||
do { \
|
||||
nsINode::nsSlots* slots = node->GetExistingSlots(); \
|
||||
if (slots && !slots->mMutationObservers.IsEmpty()) { \
|
||||
/* No need to explicitly notify the first observer first \
|
||||
since that'll happen anyway. */ \
|
||||
NS_OBSERVER_ARRAY_NOTIFY_XPCOM_OBSERVERS( \
|
||||
slots->mMutationObservers, nsIMutationObserver, \
|
||||
func_, params_); \
|
||||
} \
|
||||
node = node->GetNodeParent(); \
|
||||
} while (node); \
|
||||
PR_END_MACRO
|
||||
|
||||
void
|
||||
nsNodeUtils::CharacterDataWillChange(nsIContent* aContent,
|
||||
CharacterDataChangeInfo* aInfo)
|
||||
@ -207,7 +184,7 @@ nsNodeUtils::ContentRemoved(nsINode* aContainer,
|
||||
document = static_cast<nsIDocument*>(aContainer);
|
||||
}
|
||||
|
||||
IMPL_STRONGREF_MUTATION_NOTIFICATION(ContentRemoved, aContainer,
|
||||
IMPL_MUTATION_NOTIFICATION(ContentRemoved, aContainer,
|
||||
(document, container, aChild, aIndexInContainer));
|
||||
}
|
||||
|
||||
|
@ -407,6 +407,8 @@ nsXMLEventsManager::ContentRemoved(nsIDocument* aDocument,
|
||||
//And to remember: the same observer can be referenced by many
|
||||
//XMLEventsListeners
|
||||
|
||||
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
|
||||
|
||||
//If the content was an XML Events observer or handler
|
||||
mListeners.Enumerate(EnumAndSetIncomplete, aChild);
|
||||
|
||||
|
@ -1135,6 +1135,9 @@ nsXULDocument::ContentRemoved(nsIDocument* aDocument,
|
||||
{
|
||||
NS_ASSERTION(aDocument == this, "unexpected doc");
|
||||
|
||||
// Might not need this, but be safe for now.
|
||||
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
|
||||
|
||||
RemoveSubtreeFromDocument(aChild);
|
||||
}
|
||||
|
||||
|
@ -928,6 +928,8 @@ inDOMView::ContentRemoved(nsIDocument *aDocument, nsIContent* aContainer, nsICon
|
||||
if (NS_FAILED(rv = RowToNode(row, &oldNode)))
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
|
||||
|
||||
// The parent may no longer be a container. Note that we don't want
|
||||
// to access oldNode after calling RemoveNode, so do this now.
|
||||
inDOMViewNode* parentNode = oldNode->parent;
|
||||
|
@ -1118,6 +1118,9 @@ nsTreeContentView::ContentRemoved(nsIDocument *aDocument,
|
||||
return; // this is not for us
|
||||
}
|
||||
|
||||
// Lots of codepaths under here that do all sorts of stuff, so be safe.
|
||||
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
|
||||
|
||||
if (tag == nsGkAtoms::treechildren) {
|
||||
PRInt32 index = FindContent(aContainer);
|
||||
if (index >= 0) {
|
||||
|
@ -163,6 +163,7 @@ void nsMenuGroupOwnerX::ContentRemoved(nsIDocument * aDocument,
|
||||
nsIContent * aChild,
|
||||
PRInt32 aIndexInContainer)
|
||||
{
|
||||
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
|
||||
nsChangeObserver* obs = LookupContentChangeObserver(aContainer);
|
||||
if (obs)
|
||||
obs->ObserveContentRemoved(aDocument, aChild, aIndexInContainer);
|
||||
|
Loading…
Reference in New Issue
Block a user