Bug 2060799 - Harden against re-bindign an already-parented node. r=smaug,dom-core-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D316497
This commit is contained in:
committed by
vhilla@mozilla.com
parent
46897803d4
commit
19bb88fc72
@@ -377,8 +377,8 @@ nsresult CharacterData::BindToTree(BindContext& aContext, nsINode& aParent) {
|
||||
MOZ_ASSERT(!IsInComposedDoc(), "Already have a document. Unbind first!");
|
||||
// Note that as we recurse into the kids, they'll have a non-null parent. So
|
||||
// only assert if our parent is _changing_ while we have a parent.
|
||||
MOZ_ASSERT(!GetParentNode() || &aParent == GetParentNode(),
|
||||
"Already have a parent. Unbind first!");
|
||||
MOZ_DIAGNOSTIC_ASSERT(!GetParentNode() || &aParent == GetParentNode(),
|
||||
"Already have a different parent. Unbind first!");
|
||||
|
||||
const bool hadParent = !!GetParentNode();
|
||||
|
||||
|
||||
@@ -2925,8 +2925,8 @@ nsresult Element::BindToTree(BindContext& aContext, nsINode& aParent) {
|
||||
MOZ_ASSERT(!IsInComposedDoc(), "Already have a document. Unbind first!");
|
||||
// Note that as we recurse into the kids, they'll have a non-null parent. So
|
||||
// only assert if our parent is _changing_ while we have a parent.
|
||||
MOZ_ASSERT(!GetParentNode() || &aParent == GetParentNode(),
|
||||
"Already have a parent. Unbind first!");
|
||||
MOZ_DIAGNOSTIC_ASSERT(!GetParentNode() || &aParent == GetParentNode(),
|
||||
"Already have a different parent. Unbind first!");
|
||||
|
||||
const bool hadParent = !!GetParentNode();
|
||||
|
||||
|
||||
@@ -2147,7 +2147,8 @@ void nsINode::InsertChildBefore(
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!aKid->GetParentNode(), "Inserting node that already has parent");
|
||||
MOZ_DIAGNOSTIC_ASSERT(!aKid->GetParentNode(),
|
||||
"Inserting node that already has parent");
|
||||
MOZ_ASSERT(!IsAttr());
|
||||
|
||||
// The id-handling code, and in the future possibly other code, need to
|
||||
|
||||
Reference in New Issue
Block a user