From 194d85436603551015176ceb59fece039ea41ef0 Mon Sep 17 00:00:00 2001 From: VerteDinde Date: Thu, 7 Oct 2021 18:53:10 -0700 Subject: [PATCH] chore: reconcile FPS patch differences --- patches/chromium/.patches | 2 +- .../chromium/cherry-pick-39090918efac.patch | 73 ++++++++++--------- .../chromium/cherry-pick-ec42dfd3545f.patch | 52 +++++++------ 3 files changed, 63 insertions(+), 64 deletions(-) diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 09cfbd2e521c1..1c23eb660d1b5 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -104,5 +104,5 @@ don_t_run_pcscan_notifythreadcreated_if_pcscan_is_disabled.patch logging_win32_only_create_a_console_if_logging_to_stderr.patch feat_expose_raw_response_headers_from_urlloader.patch fix_media_key_usage_with_globalshortcuts.patch -cherry-pick-39090918efac.patch cherry-pick-ec42dfd3545f.patch +cherry-pick-39090918efac.patch diff --git a/patches/chromium/cherry-pick-39090918efac.patch b/patches/chromium/cherry-pick-39090918efac.patch index 9f08e104b69f1..93c258432be49 100644 --- a/patches/chromium/cherry-pick-39090918efac.patch +++ b/patches/chromium/cherry-pick-39090918efac.patch @@ -1,7 +1,7 @@ -From 39090918efac313d376f65713f4de6a6ff0a55bb Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: cfredric Date: Mon, 27 Sep 2021 22:14:18 +0000 -Subject: [PATCH] Consider HTTPS and WSS schemes identically for FPS. +Subject: Consider HTTPS and WSS schemes identically for FPS. This modifies the FPS implementation to normalize wss:// URLs into https:// URLs when determining the same-partiness of a request. @@ -16,10 +16,9 @@ Reviewed-by: Maksim Orlovich Reviewed-by: Shuran Huang Commit-Queue: Chris Fredrickson Cr-Commit-Position: refs/heads/main@{#925457} ---- diff --git a/chrome/browser/net/websocket_browsertest.cc b/chrome/browser/net/websocket_browsertest.cc -index 8a9fe6db..de48b97b 100644 +index 0714f0d0231d677edd0f0cdf82f4129ddc43a5c2..6f2f101743fbd470bafe90d7e5d14351ee0ff708 100644 --- a/chrome/browser/net/websocket_browsertest.cc +++ b/chrome/browser/net/websocket_browsertest.cc @@ -21,6 +21,7 @@ @@ -64,7 +63,7 @@ index 8a9fe6db..de48b97b 100644 net::GetWebSocketTestDataDirectory()) {} protected: -@@ -145,7 +152,6 @@ +@@ -145,7 +152,6 @@ class WebSocketBrowserTest : public InProcessBrowserTest { net::SpawnedTestServer wss_server_; private: @@ -72,7 +71,7 @@ index 8a9fe6db..de48b97b 100644 std::unique_ptr watcher_; DISALLOW_COPY_AND_ASSIGN(WebSocketBrowserTest); -@@ -162,37 +168,72 @@ +@@ -162,37 +168,72 @@ class WebSocketBrowserTestWithAllowFileAccessFromFiles }; // Framework for tests using the connect_to.html page served by a separate HTTP @@ -114,11 +113,13 @@ index 8a9fe6db..de48b97b 100644 std::string query("url=" + url.spec()); GURL::Replacements replacements; replacements.SetQueryStr(query); - ASSERT_TRUE(ui_test_utils::NavigateToURL( -- browser(), http_server_.GetURL("/connect_to.html") +- ui_test_utils::NavigateToURL(browser(), +- http_server_.GetURL("/connect_to.html") +- .ReplaceComponents(replacements)); ++ ASSERT_TRUE(ui_test_utils::NavigateToURL( + browser(), server() + .GetURL(host, "/connect_to.html") - .ReplaceComponents(replacements))); ++ .ReplaceComponents(replacements))); } - private: @@ -156,7 +157,7 @@ index 8a9fe6db..de48b97b 100644 // Automatically fill in any login prompts that appear with the supplied // credentials. class AutoLogin : public content::NotificationObserver { -@@ -352,7 +393,7 @@ +@@ -352,7 +393,7 @@ IN_PROC_BROWSER_TEST_F(WebSocketBrowserTest, EXPECT_EQ("PASS", WaitAndGetTitle()); } @@ -165,7 +166,7 @@ index 8a9fe6db..de48b97b 100644 WebSocketBasicAuthInWSURL) { // Launch a basic-auth-protected WebSocket server. ws_server_.set_websocket_basic_auth(true); -@@ -364,7 +405,7 @@ +@@ -364,7 +405,7 @@ IN_PROC_BROWSER_TEST_F(WebSocketBrowserConnectToTest, EXPECT_EQ("PASS", WaitAndGetTitle()); } @@ -174,7 +175,7 @@ index 8a9fe6db..de48b97b 100644 WebSocketBasicAuthInWSURLBadCreds) { // Launch a basic-auth-protected WebSocket server. ws_server_.set_websocket_basic_auth(true); -@@ -376,7 +417,7 @@ +@@ -376,7 +417,7 @@ IN_PROC_BROWSER_TEST_F(WebSocketBrowserConnectToTest, EXPECT_EQ("FAIL", WaitAndGetTitle()); } @@ -183,7 +184,7 @@ index 8a9fe6db..de48b97b 100644 WebSocketBasicAuthNoCreds) { // Launch a basic-auth-protected WebSocket server. ws_server_.set_websocket_basic_auth(true); -@@ -420,8 +461,7 @@ +@@ -420,8 +461,7 @@ IN_PROC_BROWSER_TEST_F(WebSocketBrowserTest, MAYBE_WebSocketAppliesHSTS) { https_server.ServeFilesFromSourceDirectory(GetChromeTestDataDir()); net::SpawnedTestServer wss_server( net::SpawnedTestServer::TYPE_WSS, @@ -193,7 +194,7 @@ index 8a9fe6db..de48b97b 100644 net::GetWebSocketTestDataDirectory()); // This test sets HSTS on localhost. To avoid being redirected to https, start // the http server on 127.0.0.1 instead. -@@ -711,4 +751,43 @@ +@@ -711,4 +751,43 @@ IN_PROC_BROWSER_TEST_F(WebSocketBrowserTestWithAllowFileAccessFromFiles, EXPECT_EQ("FILE", WaitAndGetTitle()); } @@ -238,10 +239,10 @@ index 8a9fe6db..de48b97b 100644 + } // namespace diff --git a/net/data/websocket/connect_to.html b/net/data/websocket/connect_to.html -index 05c653f..8a6d782 100644 +index 05c653fc5d2ab9a333efea5b4c5eee83a03bbe07..8a6d78214fe5974cbb0ec62b61f4d7fdcdf42c3b 100644 --- a/net/data/websocket/connect_to.html +++ b/net/data/websocket/connect_to.html -@@ -29,6 +29,17 @@ +@@ -29,6 +29,17 @@ ws.onclose = function() document.title = 'FAIL'; } @@ -260,19 +261,19 @@ index 05c653f..8a6d782 100644 diff --git a/net/test/spawned_test_server/base_test_server.cc b/net/test/spawned_test_server/base_test_server.cc -index 70937f8..01359fa 100644 +index 9caaf0ad501322f480be9867909e2e6cb8c56503..54c84e4d0bbd51640b374532fd92903b2e01de58 100644 --- a/net/test/spawned_test_server/base_test_server.cc +++ b/net/test/spawned_test_server/base_test_server.cc -@@ -137,6 +137,8 @@ - case CERT_KEY_USAGE_RSA_DIGITAL_SIGNATURE: - return base::FilePath( +@@ -156,6 +156,8 @@ base::FilePath BaseTestServer::SSLOptions::GetCertificateFile() const { FILE_PATH_LITERAL("key_usage_rsa_digitalsignature.pem")); + case CERT_AUTO: + return base::FilePath(); + case CERT_TEST_NAMES: + return base::FilePath(FILE_PATH_LITERAL("test_names.pem")); default: NOTREACHED(); } -@@ -228,6 +230,14 @@ +@@ -249,6 +251,14 @@ GURL BaseTestServer::GetURL(const std::string& path) const { return GURL(GetScheme() + "://" + host_port_pair_.ToString() + "/" + path); } @@ -288,10 +289,10 @@ index 70937f8..01359fa 100644 const std::string& user) const { return GURL(GetScheme() + "://" + user + "@" + host_port_pair_.ToString() + diff --git a/net/test/spawned_test_server/base_test_server.h b/net/test/spawned_test_server/base_test_server.h -index 367ba3b..62b3234 100644 +index 6c209afcdeeed129ec58f4c55a78501d707fd8f3..848698160b6eba1a02618bfaa968114d10776395 100644 --- a/net/test/spawned_test_server/base_test_server.h +++ b/net/test/spawned_test_server/base_test_server.h -@@ -77,6 +77,11 @@ +@@ -82,6 +82,11 @@ class BaseTestServer { // A certificate with invalid notBefore and notAfter times. Windows' // certificate library will not parse this certificate. CERT_BAD_VALIDITY, @@ -302,8 +303,8 @@ index 367ba3b..62b3234 100644 + CERT_TEST_NAMES, }; - // NOTE: the values of these enumerators are passed to the the Python test -@@ -198,6 +203,8 @@ + // Bitmask of key exchange algorithms that the test server supports and that +@@ -277,6 +282,8 @@ class BaseTestServer { bool GetAddressList(AddressList* address_list) const WARN_UNUSED_RESULT; GURL GetURL(const std::string& path) const; @@ -313,10 +314,10 @@ index 367ba3b..62b3234 100644 GURL GetURLWithUser(const std::string& path, const std::string& user) const; diff --git a/services/network/first_party_sets/first_party_sets.cc b/services/network/first_party_sets/first_party_sets.cc -index 1650c28d..826b403 100644 +index 1650c28d8b6c61b30531e1e2ef3e2869d8450360..826b403a2a9702c255ee9b7ea38dc74b9e18791d 100644 --- a/services/network/first_party_sets/first_party_sets.cc +++ b/services/network/first_party_sets/first_party_sets.cc -@@ -91,16 +91,17 @@ +@@ -91,16 +91,17 @@ bool FirstPartySets::IsContextSamePartyWithSite( const net::SchemefulSite* top_frame_site, const std::set& party_context, bool infer_singleton_sets) const { @@ -339,7 +340,7 @@ index 1650c28d..826b403 100644 }; if (top_frame_site && !is_owned_by_site_owner(*top_frame_site)) -@@ -131,7 +132,8 @@ +@@ -131,7 +132,8 @@ net::FirstPartySetsContextType FirstPartySets::ComputeContextType( const absl::optional& top_frame_site, const std::set& party_context) const { constexpr bool infer_singleton_sets = true; @@ -349,7 +350,7 @@ index 1650c28d..826b403 100644 // Note: the `party_context` consists of the intermediate frames (for frame // requests) or intermediate frames and current frame for subresource // requests. -@@ -152,18 +154,22 @@ +@@ -152,18 +154,22 @@ net::FirstPartySetsContextType FirstPartySets::ComputeContextType( : net::FirstPartySetsContextType::kTopResourceMatchMixed; } @@ -378,7 +379,7 @@ index 1650c28d..826b403 100644 } base::flat_map> -@@ -244,7 +250,8 @@ +@@ -244,7 +250,8 @@ base::flat_set FirstPartySets::ComputeSetsDiff( for (const auto& old_pair : old_sets) { const net::SchemefulSite& old_member = old_pair.first; const net::SchemefulSite& old_owner = old_pair.second; @@ -389,10 +390,10 @@ index 1650c28d..826b403 100644 if (!current_owner || *current_owner != old_owner) { result.emplace(old_member); diff --git a/services/network/first_party_sets/first_party_sets.h b/services/network/first_party_sets/first_party_sets.h -index 8158b55..fc87e51 100644 +index 8158b555856526170051cba72a08312a5528de51..fc87e5155667befc5a94bbe539ca71dc47d5f7d1 100644 --- a/services/network/first_party_sets/first_party_sets.h +++ b/services/network/first_party_sets/first_party_sets.h -@@ -97,11 +97,12 @@ +@@ -97,11 +97,12 @@ class FirstPartySets { base::OnceCallback callback); private: @@ -411,10 +412,10 @@ index 8158b55..fc87e51 100644 // We must ensure there's no intersection between the manually-specified set // and the sets that came from Component Updater. (When reconciling the diff --git a/services/network/first_party_sets/first_party_sets_unittest.cc b/services/network/first_party_sets/first_party_sets_unittest.cc -index 2055619..52eb8e8 100644 +index 2055619f4c999cbfd5a5ee4780e2eb5c1dad5816..52eb8e8a3d87172353c64bba972311db2889c693 100644 --- a/services/network/first_party_sets/first_party_sets_unittest.cc +++ b/services/network/first_party_sets/first_party_sets_unittest.cc -@@ -1167,6 +1167,8 @@ +@@ -1167,6 +1167,8 @@ TEST_F(FirstPartySetsTest, ComputeContext) { net::SchemefulSite nonmember1(GURL("https://nonmember1.test")); net::SchemefulSite member(GURL("https://member1.test")); net::SchemefulSite owner(GURL("https://example.test")); @@ -423,7 +424,7 @@ index 2055619..52eb8e8 100644 // Works as usual for sites that are in First-Party sets. EXPECT_THAT(sets().ComputeContext(member, &member, {member}), -@@ -1180,10 +1182,17 @@ +@@ -1180,10 +1182,17 @@ TEST_F(FirstPartySetsTest, ComputeContext) { EXPECT_THAT(sets().ComputeContext(member, &member, {member, owner}), net::SamePartyContext(SamePartyContextType::kSameParty)); @@ -441,7 +442,7 @@ index 2055619..52eb8e8 100644 // Top&resource differs from Ancestors. EXPECT_THAT(sets().ComputeContext(member, &member, {nonmember}), -@@ -1225,6 +1234,12 @@ +@@ -1225,6 +1234,12 @@ TEST_F(FirstPartySetsTest, IsInNontrivialFirstPartySet) { EXPECT_TRUE(sets().IsInNontrivialFirstPartySet( net::SchemefulSite(GURL("https://member1.test")))); diff --git a/patches/chromium/cherry-pick-ec42dfd3545f.patch b/patches/chromium/cherry-pick-ec42dfd3545f.patch index 783f01498ceaf..df1d1c2d4c35e 100644 --- a/patches/chromium/cherry-pick-ec42dfd3545f.patch +++ b/patches/chromium/cherry-pick-ec42dfd3545f.patch @@ -1,7 +1,7 @@ -From ec42dfd3545f1c40f643c90954368efbd7a4d0b4 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Shuran Huang Date: Fri, 24 Sep 2021 00:47:47 +0000 -Subject: [PATCH] Add functions to pass in persisted FPSs and compute diffs. +Subject: Add functions to pass in persisted FPSs and compute diffs. Pass the persisted FPSs and a callback that takes a FPSs into Network Service. The persisted FPSs is parsed and compared to the current FPSs @@ -17,10 +17,9 @@ Reviewed-by: Will Harris Reviewed-by: Matt Menke Reviewed-by: Chris Fredrickson Cr-Commit-Position: refs/heads/main@{#924570} ---- diff --git a/services/network/first_party_sets/first_party_sets.cc b/services/network/first_party_sets/first_party_sets.cc -index f7e732e..1650c28d 100644 +index f7e732e88d6e6ebc5daed9169d5eee336a9de8c1..1650c28d8b6c61b30531e1e2ef3e2869d8450360 100644 --- a/services/network/first_party_sets/first_party_sets.cc +++ b/services/network/first_party_sets/first_party_sets.cc @@ -13,6 +13,7 @@ @@ -31,7 +30,7 @@ index f7e732e..1650c28d 100644 #include "net/base/schemeful_site.h" #include "net/cookies/cookie_constants.h" #include "net/cookies/same_party_context.h" -@@ -72,12 +73,16 @@ +@@ -72,12 +73,16 @@ void FirstPartySets::SetManuallySpecifiedSet(const std::string& flag_value) { flag_value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY)); ApplyManuallySpecifiedSet(); @@ -48,7 +47,7 @@ index f7e732e..1650c28d 100644 return &sets_; } -@@ -218,4 +223,48 @@ +@@ -218,4 +223,48 @@ void FirstPartySets::ApplyManuallySpecifiedSet() { sets_.emplace(manual_owner, manual_owner); } @@ -98,7 +97,7 @@ index f7e732e..1650c28d 100644 + } // namespace network diff --git a/services/network/first_party_sets/first_party_sets.h b/services/network/first_party_sets/first_party_sets.h -index 81e0e10..8158b55 100644 +index 81e0e1080d965947a2ebc1635638c25ad75a1bf7..8158b555856526170051cba72a08312a5528de51 100644 --- a/services/network/first_party_sets/first_party_sets.h +++ b/services/network/first_party_sets/first_party_sets.h @@ -9,6 +9,7 @@ @@ -109,7 +108,7 @@ index 81e0e10..8158b55 100644 #include "base/containers/flat_map.h" #include "base/containers/flat_set.h" #include "net/base/schemeful_site.h" -@@ -87,6 +88,14 @@ +@@ -87,6 +88,14 @@ class FirstPartySets { // the members of the set includes the owner. base::flat_map> Sets() const; @@ -124,7 +123,7 @@ index 81e0e10..8158b55 100644 private: // Returns a pointer to `site`'s owner (optionally inferring a singleton set // if necessary), or `nullptr` if `site` has no owner. Must not return -@@ -101,6 +110,19 @@ +@@ -101,6 +110,19 @@ class FirstPartySets { // `manually_specified_set_`. void ApplyManuallySpecifiedSet(); @@ -144,7 +143,7 @@ index 81e0e10..8158b55 100644 // Represents the mapping of site -> site, where keys are members of sets, and // values are owners of the sets. Owners are explicitly represented as members // of the set. -@@ -108,6 +130,22 @@ +@@ -108,6 +130,22 @@ class FirstPartySets { absl::optional< std::pair>> manually_specified_set_; @@ -168,7 +167,7 @@ index 81e0e10..8158b55 100644 } // namespace network diff --git a/services/network/first_party_sets/first_party_sets_unittest.cc b/services/network/first_party_sets/first_party_sets_unittest.cc -index b929315..2055619 100644 +index b929315d9b857e0f86d1d726f7cefefb7ad8e54c..2055619f4c999cbfd5a5ee4780e2eb5c1dad5816 100644 --- a/services/network/first_party_sets/first_party_sets_unittest.cc +++ b/services/network/first_party_sets/first_party_sets_unittest.cc @@ -7,6 +7,7 @@ @@ -179,7 +178,7 @@ index b929315..2055619 100644 #include "net/base/schemeful_site.h" #include "net/cookies/cookie_constants.h" #include "net/cookies/same_party_context.h" -@@ -204,6 +205,30 @@ +@@ -204,6 +205,30 @@ TEST(FirstPartySets, SetsManuallySpecified_Invalid_RegisteredDomain_Member) { EXPECT_THAT(sets.ParseAndSet("[]"), Pointee(IsEmpty())); } @@ -210,7 +209,7 @@ index b929315..2055619 100644 TEST(FirstPartySets, SetsManuallySpecified_Valid_SingleMember) { FirstPartySets sets; sets.SetManuallySpecifiedSet("https://example.test,https://member.test"); -@@ -469,6 +494,311 @@ +@@ -469,6 +494,311 @@ TEST(FirstPartySets, SetsManuallySpecified_PrunesInducedSingletons) { SerializesTo("https://example.test"))))); } @@ -523,10 +522,10 @@ index b929315..2055619 100644 public: FirstPartySetsTest() { diff --git a/services/network/network_service.cc b/services/network/network_service.cc -index 5d598ff..c850d69 100644 +index 3f34171edf0c96df3b08de77e4e2be5b26eeca67..975eedaff9c38d0ee20d0fe617cc6391ea083d70 100644 --- a/services/network/network_service.cc +++ b/services/network/network_service.cc -@@ -343,8 +343,7 @@ +@@ -343,8 +343,7 @@ void NetworkService::Initialize(mojom::NetworkServiceParamsPtr params, } first_party_sets_ = std::make_unique(); @@ -536,7 +535,7 @@ index 5d598ff..c850d69 100644 first_party_sets_->SetManuallySpecifiedSet( command_line->GetSwitchValueASCII(switches::kUseFirstPartySet)); } -@@ -785,6 +784,14 @@ +@@ -785,6 +784,14 @@ void NetworkService::SetFirstPartySets(const std::string& raw_sets) { first_party_sets_->ParseAndSet(raw_sets); } @@ -552,10 +551,10 @@ index 5d598ff..c850d69 100644 const std::vector& ports) { net::SetExplicitlyAllowedPorts(ports); diff --git a/services/network/network_service.h b/services/network/network_service.h -index e8c984a..a848746 100644 +index 1da4505fc9fe478e00353cd55e615878ea875aa0..963e22f6d5e957684dc56dd6e3ae31fa430a355e 100644 --- a/services/network/network_service.h +++ b/services/network/network_service.h -@@ -207,6 +207,10 @@ +@@ -204,6 +204,10 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkService void BindTestInterface( mojo::PendingReceiver receiver) override; void SetFirstPartySets(const std::string& raw_sets) override; @@ -567,10 +566,10 @@ index e8c984a..a848746 100644 // Returns an HttpAuthHandlerFactory for the given NetworkContext. diff --git a/services/network/network_service_unittest.cc b/services/network/network_service_unittest.cc -index 5f23863..369509a 100644 +index 7c8cbbbba3dd2084095d91b9195d69c335809263..6d1fdfd9b236c7129548fe626143636cfdb56bd5 100644 --- a/services/network/network_service_unittest.cc +++ b/services/network/network_service_unittest.cc -@@ -930,6 +930,7 @@ +@@ -927,6 +927,7 @@ class NetworkServiceTestWithService : public testing::Test { void SetUp() override { test_server_.AddDefaultHandlers(base::FilePath(kServicesTestData)); ASSERT_TRUE(test_server_.Start()); @@ -578,16 +577,15 @@ index 5f23863..369509a 100644 service_ = NetworkService::CreateForTesting(); service_->Bind(network_service_.BindNewPipeAndPassReceiver()); } -@@ -993,6 +994,8 @@ - mojo::Remote network_service_; - mojo::Remote network_context_; +@@ -992,6 +993,7 @@ class NetworkServiceTestWithService : public testing::Test { mojo::Remote loader_; -+ + + DISALLOW_COPY_AND_ASSIGN(NetworkServiceTestWithService); + base::test::ScopedFeatureList scoped_features_; }; // Verifies that loading a URL through the network service's mojo interface -@@ -1172,6 +1175,18 @@ +@@ -1171,6 +1173,18 @@ TEST_F(NetworkServiceTestWithService, GetNetworkList) { run_loop.Run(); } @@ -607,10 +605,10 @@ index 5f23863..369509a 100644 : public mojom::NetworkChangeManagerClient { public: diff --git a/services/network/public/mojom/network_service.mojom b/services/network/public/mojom/network_service.mojom -index fe5450b..59fbbde6 100644 +index fe5450b20b3c4a8490e853dd236bf6baefa90b81..59fbbde6ffc30d51304a72f402eee7c664ea111b 100644 --- a/services/network/public/mojom/network_service.mojom +++ b/services/network/public/mojom/network_service.mojom -@@ -373,6 +373,14 @@ +@@ -373,6 +373,14 @@ interface NetworkService { // cleared (except for the manually-specified set, if one exists). SetFirstPartySets(string raw_sets);