Skip to content

Commit

Permalink
[Merge M111] Remove NOTREACHED() clauses for reachable code.
Browse files Browse the repository at this point in the history
All of the ExecuteScript* methods can finish with a script execution
error, which is why the fallback values are specified. Errors are
logged by the callers. NOTREACHED() shouldn't be used there.

(cherry picked from commit aa8aef2)

Bug: 1410177
Change-Id: Ic594d42a70268b9a0fdf5f1481120083dbfac06e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4201209
Commit-Queue: Basia Zimirska <basiaz@google.com>
Reviewed-by: Anthony Cui <cuianthony@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1098799}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4215254
Cr-Commit-Position: refs/branch-heads/5563@{#112}
Cr-Branched-From: 3ac59a6-refs/heads/main@{#1097615}
  • Loading branch information
Basia Zimirska authored and Chromium LUCI CQ committed Feb 2, 2023
1 parent de1f9de commit 2e4f764
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions components/translate/content/renderer/translate_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ bool TranslateAgent::ExecuteScriptAndGetBoolResult(const std::string& script,
main_frame->ExecuteScriptInIsolatedWorldAndReturnValue(
world_id_, source, blink::BackForwardCacheAware::kAllow);
if (result.IsEmpty() || !result->IsBoolean()) {
NOTREACHED();
return fallback;
}

Expand All @@ -385,7 +384,6 @@ std::string TranslateAgent::ExecuteScriptAndGetStringResult(
main_frame->ExecuteScriptInIsolatedWorldAndReturnValue(
world_id_, source, blink::BackForwardCacheAware::kAllow);
if (result.IsEmpty() || !result->IsString()) {
NOTREACHED();
return std::string();
}

Expand All @@ -411,7 +409,6 @@ double TranslateAgent::ExecuteScriptAndGetDoubleResult(
main_frame->ExecuteScriptInIsolatedWorldAndReturnValue(
world_id_, source, blink::BackForwardCacheAware::kAllow);
if (result.IsEmpty() || !result->IsNumber()) {
NOTREACHED();
return 0.0;
}

Expand All @@ -430,7 +427,6 @@ int64_t TranslateAgent::ExecuteScriptAndGetIntegerResult(
main_frame->ExecuteScriptInIsolatedWorldAndReturnValue(
world_id_, source, blink::BackForwardCacheAware::kAllow);
if (result.IsEmpty() || !result->IsNumber()) {
NOTREACHED();
return 0;
}

Expand Down

0 comments on commit 2e4f764

Please sign in to comment.