Commit b78a0214 authored by Nico Weber's avatar Nico Weber Committed by Commit Bot

Fix a likely bug in HandleSetImageResponsein the android webview embedded test server.

The code looks like the break should be inside the if, so that
the loop has a chance of running more than once.

I tried reaching out to the author of this code, but didn't hear back.
But with this change, header_exist should become true more often and
the test code is stricter when it's true. So since tests still pass with
this, this might help catch problems in the future.

Bug: 346399,686247
Change-Id: I25e8c1a38043af09936e35c58e87db3bee103e9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2120048
Commit-Queue: Bo <boliu@chromium.org>
Auto-Submit: Nico Weber <thakis@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#753999}
parent 6c92556c
...@@ -156,16 +156,12 @@ std::unique_ptr<HttpResponse> HandleSetImageResponse( ...@@ -156,16 +156,12 @@ std::unique_ptr<HttpResponse> HandleSetImageResponse(
bool header_exist = false; bool header_exist = false;
if (query.find("header") != query.end()) { if (query.find("header") != query.end()) {
// TODO(thakis): It looks like the break in the loop should be in the if.
// Check and fix.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunreachable-code"
for (const auto& header : query.at("header")) { for (const auto& header : query.at("header")) {
if (request.headers.find(header) != request.headers.end()) if (request.headers.find(header) != request.headers.end()) {
header_exist = true; header_exist = true;
break; break;
}
} }
#pragma GCC diagnostic pop
} }
std::string decoded_resource; std::string decoded_resource;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment