зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1311235 part.2 Rename NS_FOUND_TARGET to NS_EDITOR_FOUND_TARGET and make it a success code r=Ehsan
NS_FOUND_TARGET is now declared as an error code. However, making it as a success code makes the code simpler. First, this patch renames it to NS_SUCCESS_EDITOR_FOUND_TARGET because it's usual naming rule (according to the other declarations). Next, FindTargetNode() should return it when a nest call of itself returns NS_SUCCESS_EDITOR_FOUND_TARGET as it does now. Finally, removing the code overwriting NS_FOUND_TARGET with NS_OK from HTMLEditor::CreateDOMFragmentFromPaste() since it doesn't cause hitting NS_ENSURE_SUCCESS() and the variable, rv, will be overwritten with other method's result. MozReview-Commit-ID: 6GgZptrXXQa --HG-- extra : rebase_source : 79418fc83fb087e559221f895c59c7c334980456
This commit is contained in:
Родитель
3f60f85201
Коммит
015e1b9d89
|
@ -2096,16 +2096,17 @@ nsresult FindTargetNode(nsIDOMNode *aStart, nsCOMPtr<nsIDOMNode> &aResult)
|
|||
// Note: it doesn't matter if this fails.
|
||||
aStart->RemoveChild(child, getter_AddRefs(tmp));
|
||||
|
||||
return NS_FOUND_TARGET;
|
||||
return NS_SUCCESS_EDITOR_FOUND_TARGET;
|
||||
}
|
||||
}
|
||||
|
||||
// Note: Don't use NS_ENSURE_* here since we return a failure result to
|
||||
// inicate that we found the magical cookie and we don't want to spam the
|
||||
// console.
|
||||
rv = FindTargetNode(child, aResult);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (rv == NS_SUCCESS_EDITOR_FOUND_TARGET) {
|
||||
return NS_SUCCESS_EDITOR_FOUND_TARGET;
|
||||
}
|
||||
|
||||
rv = child->GetNextSibling(getter_AddRefs(tmp));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -2147,9 +2148,6 @@ HTMLEditor::CreateDOMFragmentFromPaste(const nsAString& aInputString,
|
|||
RemoveBodyAndHead(*contextAsNode);
|
||||
|
||||
rv = FindTargetNode(contextAsNode, contextLeaf);
|
||||
if (rv == NS_FOUND_TARGET) {
|
||||
rv = NS_OK;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
|
|
@ -606,9 +606,8 @@
|
|||
/* 17: NS_ERROR_MODULE_EDITOR */
|
||||
/* ======================================================================= */
|
||||
#define MODULE NS_ERROR_MODULE_EDITOR
|
||||
ERROR(NS_FOUND_TARGET, FAILURE(1)),
|
||||
|
||||
ERROR(NS_EDITOR_ELEMENT_NOT_FOUND, SUCCESS(1)),
|
||||
ERROR(NS_SUCCESS_EDITOR_FOUND_TARGET, SUCCESS(2)),
|
||||
#undef MODULE
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче