mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 937465. Warn when cloneNode() and importNode() are used without the boolean "deep" argument on nodes that have kids. r=sicking
This commit is contained in:
parent
ee9a11f753
commit
d99c5cc617
@ -38,3 +38,5 @@ DEPRECATED_OPERATION(UseOfCaptureEvents)
|
||||
DEPRECATED_OPERATION(UseOfReleaseEvents)
|
||||
DEPRECATED_OPERATION(UseOfDOM3LoadMethod)
|
||||
DEPRECATED_OPERATION(ShowModalDialog)
|
||||
DEPRECATED_OPERATION(UnsafeCloneNode)
|
||||
DEPRECATED_OPERATION(UnsafeImportNode)
|
||||
|
@ -2004,8 +2004,12 @@ public:
|
||||
already_AddRefed<nsINode>
|
||||
ImportNode(nsINode& aNode, bool aDeep, mozilla::ErrorResult& rv) const;
|
||||
already_AddRefed<nsINode>
|
||||
ImportNode(nsINode& aNode, mozilla::ErrorResult& rv) const
|
||||
ImportNode(nsINode& aNode, mozilla::ErrorResult& rv)
|
||||
{
|
||||
if (aNode.HasChildNodes()) {
|
||||
// Flag it as an error, not a warning, to make people actually notice.
|
||||
WarnOnceAbout(eUnsafeImportNode, true);
|
||||
}
|
||||
return ImportNode(aNode, true, rv);
|
||||
}
|
||||
nsINode* AdoptNode(nsINode& aNode, mozilla::ErrorResult& rv);
|
||||
|
@ -1539,10 +1539,7 @@ public:
|
||||
return ReplaceOrInsertBefore(true, &aNode, &aChild, aError);
|
||||
}
|
||||
nsINode* RemoveChild(nsINode& aChild, mozilla::ErrorResult& aError);
|
||||
already_AddRefed<nsINode> CloneNode(mozilla::ErrorResult& aError)
|
||||
{
|
||||
return CloneNode(true, aError);
|
||||
}
|
||||
already_AddRefed<nsINode> CloneNode(mozilla::ErrorResult& aError);
|
||||
already_AddRefed<nsINode> CloneNode(bool aDeep, mozilla::ErrorResult& aError);
|
||||
bool IsEqualNode(nsINode* aNode);
|
||||
void GetNamespaceURI(nsAString& aNamespaceURI) const
|
||||
|
@ -2558,6 +2558,17 @@ nsINode::CloneNode(bool aDeep, ErrorResult& aError)
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsINode>
|
||||
nsINode::CloneNode(mozilla::ErrorResult& aError)
|
||||
{
|
||||
if (HasChildNodes()) {
|
||||
// Flag it as an error, not a warning, to make people actually notice.
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eUnsafeCloneNode, true);
|
||||
}
|
||||
return CloneNode(true, aError);
|
||||
}
|
||||
|
||||
|
||||
nsDOMAttributeMap*
|
||||
nsINode::GetAttributes()
|
||||
{
|
||||
|
@ -142,3 +142,7 @@ UseOfReleaseEventsWarning=Use of releaseEvents() is deprecated. To upgrade your
|
||||
UseOfDOM3LoadMethodWarning=Use of document.load() is deprecated. To upgrade your code, use the DOM XMLHttpRequest object. For more help https://developer.mozilla.org/en/XMLHttpRequest
|
||||
# LOCALIZATION NOTE: Do not translate "window.showModalDialog()" or "window.open()"
|
||||
ShowModalDialogWarning=Use of window.showModalDialog() is deprecated. Use window.open() instead. For more help https://developer.mozilla.org/en-US/docs/Web/API/Window.open
|
||||
# LOCALIZATION NOTE: Do not translate "cloneNode()"
|
||||
UnsafeCloneNodeWarning=The behavior of cloneNode() with no boolean argument is about to change from doing a deep clone to doing a shallow clone. Make sure to pass an explicit boolean argument to keep your current behavior.
|
||||
# LOCALIZATION NOTE: Do not translate "importNode()"
|
||||
UnsafeImportNodeWarning=The behavior of importNode() with no boolean argument is about to change from doing a deep clone to doing a shallow clone. Make sure to pass an explicit boolean argument to keep your current behavior.
|
||||
|
Loading…
Reference in New Issue
Block a user