Commit 7d88ff3e authored by Callum May's avatar Callum May Committed by Commit Bot

Fix TSAN bug found in Edge TSAN environment.

The analysis and stack trace are in the filed bug.

Bug: 1022630
Change-Id: I58523a59f87e6b0fc9c642133f9c8e70427cea2e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1907268Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Commit-Queue: Callum May <camay@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#714553}
parent 71c035fe
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/synchronization/lock.h"
#include "base/test/metrics/histogram_tester.h" #include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_entropy_provider.h" #include "base/test/mock_entropy_provider.h"
#include "build/build_config.h" #include "build/build_config.h"
...@@ -405,10 +406,12 @@ class ClientHintsBrowserTest : public InProcessBrowserTest, ...@@ -405,10 +406,12 @@ class ClientHintsBrowserTest : public InProcessBrowserTest,
const GURL& redirect_url() const { return redirect_url_; } const GURL& redirect_url() const { return redirect_url_; }
size_t count_user_agent_hint_headers_seen() const { size_t count_user_agent_hint_headers_seen() const {
base::AutoLock lock(count_headers_lock_);
return count_user_agent_hint_headers_seen_; return count_user_agent_hint_headers_seen_;
} }
size_t count_client_hints_headers_seen() const { size_t count_client_hints_headers_seen() const {
base::AutoLock lock(count_headers_lock_);
return count_client_hints_headers_seen_; return count_client_hints_headers_seen_;
} }
...@@ -429,6 +432,7 @@ class ClientHintsBrowserTest : public InProcessBrowserTest, ...@@ -429,6 +432,7 @@ class ClientHintsBrowserTest : public InProcessBrowserTest,
std::string intercept_iframe_resource_; std::string intercept_iframe_resource_;
bool intercept_to_http_equiv_iframe_ = false; bool intercept_to_http_equiv_iframe_ = false;
mutable base::Lock count_headers_lock_;
private: private:
// Intercepts only the main frame requests that contain // Intercepts only the main frame requests that contain
...@@ -584,6 +588,7 @@ class ClientHintsBrowserTest : public InProcessBrowserTest, ...@@ -584,6 +588,7 @@ class ClientHintsBrowserTest : public InProcessBrowserTest,
for (size_t i = 0; i < blink::kClientHintsMappingsCount; ++i) { for (size_t i = 0; i < blink::kClientHintsMappingsCount; ++i) {
if (base::Contains(request.headers, if (base::Contains(request.headers,
blink::kClientHintsHeaderMapping[i])) { blink::kClientHintsHeaderMapping[i])) {
base::AutoLock lock(count_headers_lock_);
// The user agent hint is special: // The user agent hint is special:
if (std::string(blink::kClientHintsHeaderMapping[i]) == "sec-ch-ua") { if (std::string(blink::kClientHintsHeaderMapping[i]) == "sec-ch-ua") {
count_user_agent_hint_headers_seen_++; count_user_agent_hint_headers_seen_++;
......
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