0

Make GURL::spec() use NOTREACHED()

This is known to fail in the wild, but unclear how widely as it's only
verified in DCHECK builds. Converting it to NOTREACHED() to have it dump
non-fatally until we can make it NOTREACHED_NORETURN().

Bug: 1419848
Change-Id: Icae72de87981e5854c58f4b074869782ff3abeed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4533706
Auto-Submit: Peter Boström <pbos@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: Charlie Harrison <csharrison@chromium.org>
Commit-Queue: Charlie Harrison <csharrison@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1144458}
This commit is contained in:
Peter Boström
2023-05-15 23:38:55 +00:00
committed by Chromium LUCI CQ
parent 8ecd0836a1
commit 4b3c91b92a

@ -13,6 +13,7 @@
#include "base/check_op.h"
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
#include "base/trace_event/base_tracing.h"
@ -158,7 +159,9 @@ const std::string& GURL::spec() const {
if (is_valid_ || spec_.empty())
return spec_;
DCHECK(false) << "Trying to get the spec of an invalid URL!";
// TODO(crbug.com/851128): Make sure this no longer hits before making
// NOTREACHED_NORETURN();
NOTREACHED() << "Trying to get the spec of an invalid URL!";
return base::EmptyString();
}