| Index: net/cert/internal/cert_errors.cc
|
| diff --git a/net/cert/internal/cert_errors.cc b/net/cert/internal/cert_errors.cc
|
| index e66ab827fcf6b45c9ef13ac4accebae92b3bba80..d58b575f96a7dbd7ae899aba84409e1f875f638f 100644
|
| --- a/net/cert/internal/cert_errors.cc
|
| +++ b/net/cert/internal/cert_errors.cc
|
| @@ -72,6 +72,18 @@ void AppendNodeToDebugString(CertErrorNode* node,
|
| AppendChildrenToDebugString(node->children, cur_indentation, out);
|
| }
|
|
|
| +// Returns true if |children| contains the error |id| anywhere within it or its
|
| +// children recursively.
|
| +bool NodesContainError(const CertErrorNodes& children, CertErrorId id) {
|
| + for (const auto& child : children) {
|
| + if (child->node_type == CertErrorNodeType::TYPE_ERROR && child->id == id)
|
| + return true;
|
| + if (NodesContainError(child->children, id))
|
| + return true;
|
| + }
|
| + return false;
|
| +}
|
| +
|
| } // namespace
|
|
|
| CertErrorNode::CertErrorNode(CertErrorNodeType node_type,
|
| @@ -124,6 +136,10 @@ std::string CertErrors::ToDebugString() const {
|
| return result;
|
| }
|
|
|
| +bool CertErrors::ContainsError(CertErrorId id) const {
|
| + return NodesContainError(nodes_, id);
|
| +}
|
| +
|
| void CertErrors::AddNode(std::unique_ptr<CertErrorNode> node) {
|
| if (current_scoper_)
|
| current_scoper_->LazyGetRootNode()->AddChild(std::move(node));
|
|
|