diff --git a/chromium_edits/127.0.6523.4/tools/perf/page_sets/maps_perf_test/load_dataset b/chromium_edits/127.0.6523.4/tools/perf/page_sets/maps_perf_test/load_dataset deleted file mode 100644 index 88d27594..00000000 Binary files a/chromium_edits/127.0.6523.4/tools/perf/page_sets/maps_perf_test/load_dataset and /dev/null differ diff --git a/chromium_edits/128.0.6559.0/chrome/browser/BUILD.gn.patch b/chromium_edits/128.0.6559.0/chrome/browser/BUILD.gn.patch new file mode 100644 index 00000000..d5215f4e --- /dev/null +++ b/chromium_edits/128.0.6559.0/chrome/browser/BUILD.gn.patch @@ -0,0 +1,27 @@ +diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn +index 0e7d75b2024d2..af3852bed1210 100644 +--- a/chrome/browser/BUILD.gn ++++ b/chrome/browser/BUILD.gn +@@ -39,6 +39,7 @@ import("//sandbox/features.gni") + import("//services/screen_ai/buildflags/features.gni") + import("//testing/libfuzzer/fuzzer_test.gni") + import("//third_party/blink/public/public_features.gni") ++import("//third_party/ipfs_client/args.gni") + import("//third_party/protobuf/proto_library.gni") + import("//third_party/webrtc/webrtc.gni") + import("//third_party/widevine/cdm/widevine.gni") +@@ -2716,6 +2717,14 @@ static_library("browser") { + ] + } + ++ if (enable_ipfs) { ++ sources += [ ++ "ipfs_extra_parts.cc", ++ "ipfs_extra_parts.h", ++ ] ++ deps += [ "//components/ipfs" ] ++ } ++ + if (is_chromeos_ash) { + deps += [ "//chrome/browser/screen_ai:screen_ai_dlc_installer" ] + } diff --git a/chromium_edits/128.0.6559.0/chrome/browser/about_flags.cc.patch b/chromium_edits/128.0.6559.0/chrome/browser/about_flags.cc.patch new file mode 100644 index 00000000..7204d4ad --- /dev/null +++ b/chromium_edits/128.0.6559.0/chrome/browser/about_flags.cc.patch @@ -0,0 +1,38 @@ +diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc +index 896d13aa4ee7d..603c70b3305cf 100644 +--- a/chrome/browser/about_flags.cc ++++ b/chrome/browser/about_flags.cc +@@ -220,6 +220,7 @@ + #include "third_party/blink/public/common/features_generated.h" + #include "third_party/blink/public/common/forcedark/forcedark_switches.h" + #include "third_party/blink/public/common/switches.h" ++#include "third_party/ipfs_client/ipfs_buildflags.h" + #include "ui/accessibility/accessibility_features.h" + #include "ui/accessibility/accessibility_switches.h" + #include "ui/base/ozone_buildflags.h" +@@ -320,6 +321,10 @@ + #include "extensions/common/switches.h" + #endif // BUILDFLAG(ENABLE_EXTENSIONS) + ++#if BUILDFLAG(ENABLE_IPFS) ++#include "components/ipfs/ipfs_features.h" ++#endif ++ + #if BUILDFLAG(ENABLE_PDF) + #include "pdf/pdf_features.h" + #endif +@@ -10005,6 +10010,14 @@ const FeatureEntry kFeatureEntries[] = { + flag_descriptions::kOmitCorsClientCertDescription, kOsAll, + FEATURE_VALUE_TYPE(network::features::kOmitCorsClientCert)}, + ++#if BUILDFLAG(ENABLE_IPFS) ++ {"enable-ipfs", ++ flag_descriptions::kEnableIpfsName, ++ flag_descriptions::kEnableIpfsDescription, ++ kOsMac | kOsWin | kOsLinux,//TODO: These are the only variants currently getting built, but that is not likely to remain the case ++ FEATURE_VALUE_TYPE(ipfs::kEnableIpfs)}, ++#endif ++ + {"use-idna2008-non-transitional", + flag_descriptions::kUseIDNA2008NonTransitionalName, + flag_descriptions::kUseIDNA2008NonTransitionalDescription, kOsAll, diff --git a/chromium_edits/128.0.6559.0/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.patch b/chromium_edits/128.0.6559.0/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.patch new file mode 100644 index 00000000..f9965a24 --- /dev/null +++ b/chromium_edits/128.0.6559.0/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.patch @@ -0,0 +1,51 @@ +diff --git a/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc b/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc +index 9f234a2a7d41d..a9378ca80dc1e 100644 +--- a/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc ++++ b/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc +@@ -13,6 +13,7 @@ + #include "chrome/browser/profiles/profile_io_data.h" + #include "components/custom_handlers/protocol_handler_registry.h" + #include "content/public/common/url_constants.h" ++#include "third_party/ipfs_client/ipfs_buildflags.h" + #include "url/url_util.h" + + #if BUILDFLAG(IS_ANDROID) +@@ -20,6 +21,11 @@ + #include "chrome/browser/ui/android/omnibox/jni_headers/ChromeAutocompleteSchemeClassifier_jni.h" + #endif + ++#if BUILDFLAG(ENABLE_IPFS) ++#include "components/ipfs/ipfs_features.h" ++#endif ++ ++ + #if BUILDFLAG(IS_ANDROID) + static jlong + JNI_ChromeAutocompleteSchemeClassifier_CreateAutocompleteClassifier( +@@ -53,12 +59,20 @@ ChromeAutocompleteSchemeClassifier::GetInputTypeForScheme( + if (scheme.empty()) { + return metrics::OmniboxInputType::EMPTY; + } +- if (base::IsStringASCII(scheme) && +- (ProfileIOData::IsHandledProtocol(scheme) || +- base::EqualsCaseInsensitiveASCII(scheme, content::kViewSourceScheme) || +- base::EqualsCaseInsensitiveASCII(scheme, url::kJavaScriptScheme) || +- base::EqualsCaseInsensitiveASCII(scheme, url::kDataScheme))) { +- return metrics::OmniboxInputType::URL; ++ if (base::IsStringASCII(scheme)) { ++ if (ProfileIOData::IsHandledProtocol(scheme) || ++ base::EqualsCaseInsensitiveASCII(scheme, content::kViewSourceScheme) || ++ base::EqualsCaseInsensitiveASCII(scheme, url::kJavaScriptScheme) || ++ base::EqualsCaseInsensitiveASCII(scheme, url::kDataScheme)) { ++ return metrics::OmniboxInputType::URL; ++ } ++#if BUILDFLAG(ENABLE_IPFS) ++ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs) && ++ (base::EqualsCaseInsensitiveASCII(scheme, "ipfs") || base::EqualsCaseInsensitiveASCII(scheme, "ipns")) ++ ) { ++ return metrics::OmniboxInputType::URL; ++ } ++#endif + } + + // Also check for schemes registered via registerProtocolHandler(), which diff --git a/chromium_edits/128.0.6559.0/chrome/browser/chrome_content_browser_client.cc.patch b/chromium_edits/128.0.6559.0/chrome/browser/chrome_content_browser_client.cc.patch new file mode 100644 index 00000000..8bdaad44 --- /dev/null +++ b/chromium_edits/128.0.6559.0/chrome/browser/chrome_content_browser_client.cc.patch @@ -0,0 +1,77 @@ +diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc +index a44e91ed4057b..a1fbc40c7c2f7 100644 +--- a/chrome/browser/chrome_content_browser_client.cc ++++ b/chrome/browser/chrome_content_browser_client.cc +@@ -394,6 +394,7 @@ + #include "third_party/blink/public/common/switches.h" + #include "third_party/blink/public/mojom/browsing_topics/browsing_topics.mojom.h" + #include "third_party/blink/public/public_buildflags.h" ++#include "third_party/ipfs_client/ipfs_buildflags.h" + #include "third_party/widevine/cdm/buildflags.h" + #include "ui/base/clipboard/clipboard_format_type.h" + #include "ui/base/l10n/l10n_util.h" +@@ -515,6 +516,13 @@ + #include "chrome/browser/chrome_browser_main_posix.h" + #endif + ++#if BUILDFLAG(ENABLE_IPFS) ++#include "chrome/browser/ipfs_extra_parts.h" ++#include "components/ipfs/interceptor.h" ++#include "components/ipfs/ipfs_features.h" ++#include "components/ipfs/url_loader_factory.h" ++#endif ++ + #if !BUILDFLAG(IS_ANDROID) + #include "chrome/browser/preloading/preview/preview_navigation_throttle.h" + #include "chrome/browser/web_applications/isolated_web_apps/chrome_content_browser_client_isolated_web_apps_part.h" +@@ -1849,6 +1857,11 @@ ChromeContentBrowserClient::CreateBrowserMainParts(bool is_integration_test) { + main_parts->AddParts( + std::make_unique()); + ++#if BUILDFLAG(ENABLE_IPFS) ++ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs)) { ++ main_parts->AddParts(std::make_unique()); ++ } ++#endif + return main_parts; + } + +@@ -6369,12 +6382,25 @@ void ChromeContentBrowserClient:: + const std::optional& request_initiator_origin, + NonNetworkURLLoaderFactoryMap* factories) { + #if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(ENABLE_EXTENSIONS) || \ +- !BUILDFLAG(IS_ANDROID) ++ !BUILDFLAG(IS_ANDROID) || BUILDFLAG(ENABLE_IPFS) + content::RenderFrameHost* frame_host = + RenderFrameHost::FromID(render_process_id, render_frame_id); + WebContents* web_contents = WebContents::FromRenderFrameHost(frame_host); + #endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(ENABLE_EXTENSIONS) || \ + // !BUILDFLAG(IS_ANDROID) ++#if BUILDFLAG(ENABLE_IPFS) ++ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs)) { ++ network::mojom::URLLoaderFactory* default_factory = g_browser_process->system_network_context_manager()->GetURLLoaderFactory(); ++ auto* context = web_contents->GetBrowserContext(); ++ ipfs::IpfsURLLoaderFactory::Create( ++ factories, ++ context, ++ default_factory, ++ GetSystemNetworkContext(), ++ Profile::FromBrowserContext(context)->GetPrefs() ++ ); ++ } ++#endif // BUILDFLAG(ENABLE_IPFS) + + #if BUILDFLAG(IS_CHROMEOS_ASH) + if (web_contents) { +@@ -6518,6 +6544,11 @@ ChromeContentBrowserClient::WillCreateURLLoaderRequestInterceptors( + scoped_refptr navigation_response_task_runner) { + std::vector> + interceptors; ++#if BUILDFLAG(ENABLE_IPFS) ++ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs)) { ++ interceptors.push_back(std::make_unique(g_browser_process->system_network_context_manager()->GetURLLoaderFactory(), GetSystemNetworkContext())); ++ } ++#endif + #if BUILDFLAG(ENABLE_OFFLINE_PAGES) + interceptors.push_back( + std::make_unique( diff --git a/chromium_edits/128.0.6559.0/chrome/browser/flag-metadata.json.patch b/chromium_edits/128.0.6559.0/chrome/browser/flag-metadata.json.patch new file mode 100644 index 00000000..e7de87d6 --- /dev/null +++ b/chromium_edits/128.0.6559.0/chrome/browser/flag-metadata.json.patch @@ -0,0 +1,16 @@ +diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json +index be0cca6f3f9ba..57a71bf0f94db 100644 +--- a/chrome/browser/flag-metadata.json ++++ b/chrome/browser/flag-metadata.json +@@ -3317,6 +3317,11 @@ + "owners": [ "adamta@google.com", "chrome-feed-fundamentals@google.com" ], + "expiry_milestone": 130 + }, ++ { ++ "name": "enable-ipfs", ++ "owners": [ "//components/ipfs/OWNERS" ], ++ "expiry_milestone": 150 ++ }, + { + "name": "enable-isolated-sandboxed-iframes", + "owners": [ "wjmaclean@chromium.org", "alexmos@chromium.org", "creis@chromium.org" ], diff --git a/chromium_edits/128.0.6559.0/chrome/browser/flag_descriptions.cc.patch b/chromium_edits/128.0.6559.0/chrome/browser/flag_descriptions.cc.patch new file mode 100644 index 00000000..eae2d83d --- /dev/null +++ b/chromium_edits/128.0.6559.0/chrome/browser/flag_descriptions.cc.patch @@ -0,0 +1,16 @@ +diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc +index 9dbd417b2aed9..a926ee3baefa4 100644 +--- a/chrome/browser/flag_descriptions.cc ++++ b/chrome/browser/flag_descriptions.cc +@@ -297,6 +297,11 @@ const char kEnableBenchmarkingChoiceDefaultFeatureStates[] = + const char kEnableBenchmarkingChoiceMatchFieldTrialTestingConfig[] = + "Match Field Trial Testing Config"; + ++#if BUILDFLAG(ENABLE_IPFS) ++extern const char kEnableIpfsName[] = "Enable IPFS"; ++extern const char kEnableIpfsDescription[] = "Enable ipfs:// and ipns:// URLs"; ++#endif ++ + const char kPreloadingOnPerformancePageName[] = + "Preloading Settings on Performance Page"; + const char kPreloadingOnPerformancePageDescription[] = diff --git a/chromium_edits/128.0.6559.0/chrome/browser/flag_descriptions.h.patch b/chromium_edits/128.0.6559.0/chrome/browser/flag_descriptions.h.patch new file mode 100644 index 00000000..f26c560f --- /dev/null +++ b/chromium_edits/128.0.6559.0/chrome/browser/flag_descriptions.h.patch @@ -0,0 +1,24 @@ +diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h +index 43d4bd6fcafab..3e0df038d49d5 100644 +--- a/chrome/browser/flag_descriptions.h ++++ b/chrome/browser/flag_descriptions.h +@@ -24,6 +24,7 @@ + #include "pdf/buildflags.h" + #include "printing/buildflags/buildflags.h" + #include "third_party/blink/public/common/buildflags.h" ++#include "third_party/ipfs_client/ipfs_buildflags.h" + + // This file declares strings used in chrome://flags. These messages are not + // translated, because instead of end-users they target Chromium developers and +@@ -190,6 +191,11 @@ extern const char kEnableBenchmarkingChoiceDisabled[]; + extern const char kEnableBenchmarkingChoiceDefaultFeatureStates[]; + extern const char kEnableBenchmarkingChoiceMatchFieldTrialTestingConfig[]; + ++#if BUILDFLAG(ENABLE_IPFS) ++extern const char kEnableIpfsName[]; ++extern const char kEnableIpfsDescription[]; ++#endif ++ + extern const char kFontationsFontBackendName[]; + extern const char kFontationsFontBackendDescription[]; + diff --git a/chromium_edits/128.0.6559.0/chrome/browser/ipfs_extra_parts.cc b/chromium_edits/128.0.6559.0/chrome/browser/ipfs_extra_parts.cc new file mode 100644 index 00000000..90d2596f --- /dev/null +++ b/chromium_edits/128.0.6559.0/chrome/browser/ipfs_extra_parts.cc @@ -0,0 +1,10 @@ +#include "ipfs_extra_parts.h" + +#include "profiles/profile.h" + +#include + +void IpfsExtraParts::PostProfileInit(Profile* profile, bool /* is_initial_profile */ ) { + DCHECK(profile); + ipfs::InterRequestState::CreateForBrowserContext(profile, profile->GetPrefs()); +} diff --git a/chromium_edits/128.0.6559.0/chrome/browser/ipfs_extra_parts.h b/chromium_edits/128.0.6559.0/chrome/browser/ipfs_extra_parts.h new file mode 100644 index 00000000..2059c437 --- /dev/null +++ b/chromium_edits/128.0.6559.0/chrome/browser/ipfs_extra_parts.h @@ -0,0 +1,10 @@ +#ifndef IPFS_EXTRA_PART_H_ +#define IPFS_EXTRA_PART_H_ + +#include + +class IpfsExtraParts : public ChromeBrowserMainExtraParts { + void PostProfileInit(Profile* profile, bool is_initial_profile) override; +}; + +#endif // IPFS_EXTRA_PART_H_ diff --git a/chromium_edits/128.0.6559.0/chrome/browser/prefs/browser_prefs.cc.patch b/chromium_edits/128.0.6559.0/chrome/browser/prefs/browser_prefs.cc.patch new file mode 100644 index 00000000..529fb998 --- /dev/null +++ b/chromium_edits/128.0.6559.0/chrome/browser/prefs/browser_prefs.cc.patch @@ -0,0 +1,37 @@ +diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc +index 8d750cffc360e..48b8b0f82fabc 100644 +--- a/chrome/browser/prefs/browser_prefs.cc ++++ b/chrome/browser/prefs/browser_prefs.cc +@@ -197,6 +197,8 @@ + #include "printing/buildflags/buildflags.h" + #include "rlz/buildflags/buildflags.h" + #include "services/screen_ai/buildflags/buildflags.h" ++#include "third_party/ipfs_client/ipfs_buildflags.h" ++ + + #if BUILDFLAG(ENABLE_BACKGROUND_MODE) + #include "chrome/browser/background/background_mode_manager.h" +@@ -242,6 +244,11 @@ + #include "chrome/browser/pdf/pdf_pref_names.h" + #endif // BUILDFLAG(ENABLE_PDF) + ++#if BUILDFLAG(ENABLE_IPFS) ++#include "components/ipfs/ipfs_features.h" ++#include "components/ipfs/preferences.h" ++#endif ++ + #if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE) + #include "chrome/browser/screen_ai/pref_names.h" + #endif +@@ -1829,6 +1836,11 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, + IncognitoModePrefs::RegisterProfilePrefs(registry); + invalidation::PerUserTopicSubscriptionManager::RegisterProfilePrefs(registry); + invalidation::InvalidatorRegistrarWithMemory::RegisterProfilePrefs(registry); ++#if BUILDFLAG(ENABLE_IPFS) ++ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs)) { ++ ipfs::RegisterPreferences(registry); ++ } ++#endif + language::LanguagePrefs::RegisterProfilePrefs(registry); + login_detection::prefs::RegisterProfilePrefs(registry); + lookalikes::RegisterProfilePrefs(registry); diff --git a/chromium_edits/128.0.6559.0/chrome/common/chrome_content_client.cc.patch b/chromium_edits/128.0.6559.0/chrome/common/chrome_content_client.cc.patch new file mode 100644 index 00000000..d0ce5acb --- /dev/null +++ b/chromium_edits/128.0.6559.0/chrome/common/chrome_content_client.cc.patch @@ -0,0 +1,17 @@ +diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc +index 23baff86bfc1f..df9417b28e153 100644 +--- a/chrome/common/chrome_content_client.cc ++++ b/chrome/common/chrome_content_client.cc +@@ -308,6 +308,12 @@ void ChromeContentClient::AddAdditionalSchemes(Schemes* schemes) { + #if BUILDFLAG(IS_ANDROID) + schemes->local_schemes.push_back(url::kContentScheme); + #endif ++ for ( const char* ip_s : {"ipfs", "ipns"} ) { ++ schemes->standard_schemes.push_back(ip_s); ++ schemes->cors_enabled_schemes.push_back(ip_s); ++ schemes->secure_schemes.push_back(ip_s); ++ schemes->csp_bypassing_schemes.push_back(ip_s); ++ } + } + + std::u16string ChromeContentClient::GetLocalizedString(int message_id) { diff --git a/chromium_edits/128.0.6559.0/components/cbor/reader.cc.patch b/chromium_edits/128.0.6559.0/components/cbor/reader.cc.patch new file mode 100644 index 00000000..88eef088 --- /dev/null +++ b/chromium_edits/128.0.6559.0/components/cbor/reader.cc.patch @@ -0,0 +1,44 @@ +diff --git a/components/cbor/reader.cc b/components/cbor/reader.cc +index 464e93937d8d7..220dd4960cd2b 100644 +--- a/components/cbor/reader.cc ++++ b/components/cbor/reader.cc +@@ -22,7 +22,7 @@ + namespace cbor { + + namespace constants { +-const char kUnsupportedMajorType[] = "Unsupported major type."; ++const char kUnsupportedMajorType[] = "Unsupported major type operation."; + } + + namespace { +@@ -156,7 +156,11 @@ std::optional Reader::DecodeCompleteDataItem(const Config& config, + case Value::Type::FLOAT_VALUE: + // Floating point values also go here since they are also type 7. + return DecodeToSimpleValueOrFloat(*header, config); +- case Value::Type::TAG: // We explicitly don't support TAG. ++ case Value::Type::TAG: ++ if (config.parse_tags) { ++ return ReadTagContent(*header, config, max_nesting_level); ++ } ++ break; + case Value::Type::NONE: + case Value::Type::INVALID_UTF8: + break; +@@ -347,6 +351,17 @@ std::optional Reader::ReadByteStringContent( + return Value(std::move(cbor_byte_string)); + } + ++std::optional Reader::ReadTagContent( ++ const Reader::DataItemHeader& header, ++ const Config& config, ++ int max_nesting_level) { ++ auto tagged_content = DecodeCompleteDataItem(config, max_nesting_level); ++ if (tagged_content.has_value()) { ++ tagged_content.value().SetTag(header.value); ++ } ++ return tagged_content; ++} ++ + std::optional Reader::ReadArrayContent( + const Reader::DataItemHeader& header, + const Config& config, diff --git a/chromium_edits/128.0.6559.0/components/cbor/reader.h.patch b/chromium_edits/128.0.6559.0/components/cbor/reader.h.patch new file mode 100644 index 00000000..2dbc0534 --- /dev/null +++ b/chromium_edits/128.0.6559.0/components/cbor/reader.h.patch @@ -0,0 +1,26 @@ +diff --git a/components/cbor/reader.h b/components/cbor/reader.h +index 5f11ba48ba494..d4c9c489da4b6 100644 +--- a/components/cbor/reader.h ++++ b/components/cbor/reader.h +@@ -131,6 +131,11 @@ class CBOR_EXPORT Reader { + // during decoding will set raise the `UNSUPPORTED_FLOATING_POINT_VALUE` + // error. + bool allow_floating_point = false; ++ ++ // If the parser encounters a TAG element, should it be parsed out and ++ // the tag value saved (true), or should the entire node and its content ++ // be discarded (false) ++ bool parse_tags = false; + }; + + Reader(const Reader&) = delete; +@@ -205,6 +210,9 @@ class CBOR_EXPORT Reader { + std::optional ReadMapContent(const DataItemHeader& header, + const Config& config, + int max_nesting_level); ++ std::optional ReadTagContent(const DataItemHeader& header, ++ const Config& config, ++ int max_nesting_level); + std::optional ReadByte(); + std::optional> ReadBytes(uint64_t num_bytes); + bool IsKeyInOrder(const Value& new_key, diff --git a/chromium_edits/128.0.6559.0/components/cbor/reader_unittest.cc.patch b/chromium_edits/128.0.6559.0/components/cbor/reader_unittest.cc.patch new file mode 100644 index 00000000..150e0c73 --- /dev/null +++ b/chromium_edits/128.0.6559.0/components/cbor/reader_unittest.cc.patch @@ -0,0 +1,47 @@ +diff --git a/components/cbor/reader_unittest.cc b/components/cbor/reader_unittest.cc +index e5c02ceea3402..f26b8e77f6da3 100644 +--- a/components/cbor/reader_unittest.cc ++++ b/components/cbor/reader_unittest.cc +@@ -1449,5 +1449,42 @@ TEST(CBORReaderTest, AllowInvalidUTF8) { + EXPECT_FALSE(cbor); + EXPECT_EQ(Reader::DecoderError::INVALID_UTF8, error); + } ++TEST(CBORReaderTest, RejectsTagUnderDefaultConfig) { ++ static const uint8_t kTaggedCbor[] = { ++ 0xd8, 0x2a, 0x58, 0x25, 0x00, 0x01, 0x71, 0x12, 0x20, 0x69, 0xea, 0x07, ++ 0x40, 0xf9, 0x80, 0x7a, 0x28, 0xf4, 0xd9, 0x32, 0xc6, 0x2e, 0x7c, 0x1c, ++ 0x83, 0xbe, 0x05, 0x5e, 0x55, 0x07, 0x2c, 0x90, 0x26, 0x6a, 0xb3, 0xe7, ++ 0x9d, 0xf6, 0x3a, 0x36, 0x5b ++ }; ++ Reader::Config config; ++ auto cbor = Reader::Read(kTaggedCbor, config); ++ EXPECT_FALSE(cbor.has_value()); ++} ++TEST(CBORReaderTest, ReadsTagWhenConfiguredToDoSo) { ++ static const uint8_t kTaggedCbor[] = { ++ 0xd8, 0x2a, 0x58, 0x25, 0x00, 0x01, 0x71, 0x12, 0x20, 0x69, 0xea, 0x07, ++ 0x40, 0xf9, 0x80, 0x7a, 0x28, 0xf4, 0xd9, 0x32, 0xc6, 0x2e, 0x7c, 0x1c, ++ 0x83, 0xbe, 0x05, 0x5e, 0x55, 0x07, 0x2c, 0x90, 0x26, 0x6a, 0xb3, 0xe7, ++ 0x9d, 0xf6, 0x3a, 0x36, 0x5b ++ }; ++ Reader::Config config; ++ config.parse_tags = true; ++ auto cbor = Reader::Read(kTaggedCbor, config); ++ EXPECT_TRUE(cbor.has_value()); ++ auto& v = cbor.value(); ++ EXPECT_TRUE(v.has_tag()); ++ EXPECT_EQ(v.GetTag(),42UL); ++ EXPECT_TRUE(v.is_bytestring()); ++ EXPECT_EQ(v.type(), Value::Type::BYTE_STRING); ++ auto& bytes = v.GetBytestring(); ++ EXPECT_EQ(bytes.size(), 37UL); ++ EXPECT_EQ(bytes.at(0), 0x00);//identity multibase (e.g. not base-encoded, bytes are themselves) ++ EXPECT_EQ(bytes.at(1), 0x01);//CID version 1 ++ EXPECT_EQ(bytes.at(2), 0x71);//codec = dag-cbor ++ EXPECT_EQ(bytes.at(3), 0x12);//multihash = 18 = sha2-256 ++ EXPECT_EQ(bytes.at(4), 0x20);//hash length = 32 bytes ++ EXPECT_EQ(bytes.at(5), 0x69);//first byte of hash digest ++ EXPECT_EQ(bytes.at(36),0x5b);//last byte of hash digest ++} + + } // namespace cbor diff --git a/chromium_edits/128.0.6559.0/components/cbor/values.cc.patch b/chromium_edits/128.0.6559.0/components/cbor/values.cc.patch new file mode 100644 index 00000000..2832d248 --- /dev/null +++ b/chromium_edits/128.0.6559.0/components/cbor/values.cc.patch @@ -0,0 +1,145 @@ +diff --git a/components/cbor/values.cc b/components/cbor/values.cc +index 7c6b7a0aeaae3..5096311ba2a20 100644 +--- a/components/cbor/values.cc ++++ b/components/cbor/values.cc +@@ -66,32 +66,34 @@ Value::Value(Type type) : type_(type) { + NOTREACHED_IN_MIGRATION(); + } + +-Value::Value(SimpleValue in_simple) +- : type_(Type::SIMPLE_VALUE), simple_value_(in_simple) { ++Value::Value(SimpleValue in_simple, uint64_t tag) ++ : type_(Type::SIMPLE_VALUE), simple_value_(in_simple), tag_(tag) { + CHECK(static_cast(in_simple) >= 20 && static_cast(in_simple) <= 23); + } + +-Value::Value(bool boolean_value) : type_(Type::SIMPLE_VALUE) { ++Value::Value(bool boolean_value, uint64_t tag) : type_(Type::SIMPLE_VALUE), tag_(tag) { + simple_value_ = boolean_value ? Value::SimpleValue::TRUE_VALUE + : Value::SimpleValue::FALSE_VALUE; + } + +-Value::Value(double float_value) +- : type_(Type::FLOAT_VALUE), float_value_(float_value) {} ++Value::Value(double float_value, uint64_t tag) ++ : type_(Type::FLOAT_VALUE), float_value_(float_value), tag_(tag) {} + +-Value::Value(int integer_value) +- : Value(base::checked_cast(integer_value)) {} ++Value::Value(int integer_value, uint64_t tag) ++ : Value(base::checked_cast(integer_value), tag) {} + +-Value::Value(int64_t integer_value) : integer_value_(integer_value) { ++Value::Value(int64_t integer_value, uint64_t tag) : integer_value_(integer_value), tag_(tag) { + type_ = integer_value >= 0 ? Type::UNSIGNED : Type::NEGATIVE; + } + +-Value::Value(base::span in_bytes) ++Value::Value(base::span in_bytes, uint64_t tag) + : type_(Type::BYTE_STRING), +- bytestring_value_(in_bytes.begin(), in_bytes.end()) {} ++ bytestring_value_(in_bytes.begin(), in_bytes.end()), ++ tag_(tag) ++ {} + +-Value::Value(base::span in_bytes, Type type) +- : type_(type), bytestring_value_(in_bytes.begin(), in_bytes.end()) { ++Value::Value(base::span in_bytes, Type type, uint64_t tag) ++ : type_(type), bytestring_value_(in_bytes.begin(), in_bytes.end()), tag_(tag) { + DCHECK(type_ == Type::BYTE_STRING || type_ == Type::INVALID_UTF8); + } + +@@ -117,7 +119,8 @@ Value::Value(std::string&& in_string, Type type) noexcept : type_(type) { + } + } + +-Value::Value(std::string_view in_string, Type type) : type_(type) { ++Value::Value(std::string_view in_string, Type type, uint64_t tag) ++: type_(type), tag_(tag) { + switch (type_) { + case Type::STRING: + new (&string_value_) std::string(); +@@ -133,16 +136,18 @@ Value::Value(std::string_view in_string, Type type) : type_(type) { + } + } + +-Value::Value(const ArrayValue& in_array) : type_(Type::ARRAY), array_value_() { ++Value::Value(const ArrayValue& in_array, uint64_t tag) ++: type_(Type::ARRAY), array_value_(), tag_(tag) { + array_value_.reserve(in_array.size()); + for (const auto& val : in_array) + array_value_.emplace_back(val.Clone()); + } + +-Value::Value(ArrayValue&& in_array) noexcept +- : type_(Type::ARRAY), array_value_(std::move(in_array)) {} ++Value::Value(ArrayValue&& in_array, uint64_t tag) noexcept ++ : type_(Type::ARRAY), array_value_(std::move(in_array)), tag_(tag) {} + +-Value::Value(const MapValue& in_map) : type_(Type::MAP), map_value_() { ++Value::Value(const MapValue& in_map, uint64_t tag) ++: type_(Type::MAP), map_value_(), tag_(tag) { + map_value_.reserve(in_map.size()); + for (const auto& it : in_map) + map_value_.emplace_hint(map_value_.end(), it.first.Clone(), +@@ -168,31 +173,36 @@ Value Value::Clone() const { + case Type::NONE: + return Value(); + case Type::INVALID_UTF8: +- return Value(bytestring_value_, Type::INVALID_UTF8); ++ return Value(bytestring_value_, Type::INVALID_UTF8, tag_); + case Type::UNSIGNED: + case Type::NEGATIVE: +- return Value(integer_value_); ++ return Value(integer_value_, tag_); + case Type::BYTE_STRING: +- return Value(bytestring_value_); ++ return Value(bytestring_value_, tag_); + case Type::STRING: +- return Value(string_value_); ++ return Value(string_value_, Type::STRING, tag_); + case Type::ARRAY: +- return Value(array_value_); ++ return Value(array_value_, tag_); + case Type::MAP: +- return Value(map_value_); ++ return Value(map_value_, tag_); + case Type::TAG: + NOTREACHED_IN_MIGRATION() << constants::kUnsupportedMajorType; + return Value(); + case Type::SIMPLE_VALUE: +- return Value(simple_value_); ++ return Value(simple_value_, tag_); + case Type::FLOAT_VALUE: +- return Value(float_value_); ++ return Value(float_value_, tag_); + } + + NOTREACHED_IN_MIGRATION(); + return Value(); + } + ++Value& Value::SetTag(uint64_t tag) noexcept { ++ tag_ = tag; ++ return *this; ++} ++ + Value::SimpleValue Value::GetSimpleValue() const { + CHECK(is_simple()); + return simple_value_; +@@ -258,9 +268,14 @@ const Value::BinaryValue& Value::GetInvalidUTF8() const { + return bytestring_value_; + } + ++uint64_t Value::GetTag() const { ++ CHECK(has_tag()); ++ return tag_; ++} ++ + void Value::InternalMoveConstructFrom(Value&& that) { + type_ = that.type_; +- ++ tag_ = that.tag_; + switch (type_) { + case Type::UNSIGNED: + case Type::NEGATIVE: diff --git a/chromium_edits/128.0.6559.0/components/cbor/values.h.patch b/chromium_edits/128.0.6559.0/components/cbor/values.h.patch new file mode 100644 index 00000000..0eda9081 --- /dev/null +++ b/chromium_edits/128.0.6559.0/components/cbor/values.h.patch @@ -0,0 +1,79 @@ +diff --git a/components/cbor/values.h b/components/cbor/values.h +index a645cd9e46506..16a8a0d6237ce 100644 +--- a/components/cbor/values.h ++++ b/components/cbor/values.h +@@ -127,28 +127,29 @@ class CBOR_EXPORT Value { + + explicit Value(Type type); + +- explicit Value(SimpleValue in_simple); +- explicit Value(bool boolean_value); +- explicit Value(double in_float); ++ explicit Value(SimpleValue in_simple, uint64_t tag = NO_TAG); ++ explicit Value(bool boolean_value, uint64_t tag = NO_TAG); ++ explicit Value(double in_float, uint64_t tag = NO_TAG); + +- explicit Value(int integer_value); +- explicit Value(int64_t integer_value); ++ explicit Value(int integer_value, uint64_t tag = NO_TAG); ++ explicit Value(int64_t integer_value, uint64_t tag = NO_TAG); + explicit Value(uint64_t integer_value) = delete; + +- explicit Value(base::span in_bytes); ++ explicit Value(base::span in_bytes, uint64_t tag = NO_TAG); + explicit Value(BinaryValue&& in_bytes) noexcept; + + explicit Value(const char* in_string, Type type = Type::STRING); + explicit Value(std::string&& in_string, Type type = Type::STRING) noexcept; +- explicit Value(std::string_view in_string, Type type = Type::STRING); ++ explicit Value(std::string_view in_string, Type type = Type::STRING, uint64_t tag = NO_TAG); + +- explicit Value(const ArrayValue& in_array); +- explicit Value(ArrayValue&& in_array) noexcept; ++ explicit Value(const ArrayValue& in_array, uint64_t tag = NO_TAG); ++ explicit Value(ArrayValue&& in_array, uint64_t tag = NO_TAG) noexcept; + +- explicit Value(const MapValue& in_map); ++ explicit Value(const MapValue& in_map, uint64_t tag = NO_TAG); + explicit Value(MapValue&& in_map) noexcept; + + Value& operator=(Value&& that) noexcept; ++ Value& SetTag(uint64_t) noexcept; + + Value(const Value&) = delete; + Value& operator=(const Value&) = delete; +@@ -179,6 +180,7 @@ class CBOR_EXPORT Value { + bool is_string() const { return type() == Type::STRING; } + bool is_array() const { return type() == Type::ARRAY; } + bool is_map() const { return type() == Type::MAP; } ++ bool has_tag() const { return tag_ != NO_TAG; } + + // These will all fatally assert if the type doesn't match. + SimpleValue GetSimpleValue() const; +@@ -194,12 +196,13 @@ class CBOR_EXPORT Value { + const ArrayValue& GetArray() const; + const MapValue& GetMap() const; + const BinaryValue& GetInvalidUTF8() const; ++ uint64_t GetTag() const; + + private: + friend class Reader; + // This constructor allows INVALID_UTF8 values to be created, which only + // |Reader| and InvalidUTF8StringValueForTesting() may do. +- Value(base::span in_bytes, Type type); ++ Value(base::span in_bytes, Type type, uint64_t tag = NO_TAG); + + Type type_; + +@@ -213,6 +216,11 @@ class CBOR_EXPORT Value { + MapValue map_value_; + }; + ++ //This value specified as Invalid, ++ // used here to represent absence of TAG ++ constexpr static uint64_t NO_TAG = 0xFFFF; ++ uint64_t tag_ = NO_TAG; ++ + void InternalMoveConstructFrom(Value&& that); + void InternalCleanup(); + }; diff --git a/chromium_edits/128.0.6559.0/components/cbor/writer.cc.patch b/chromium_edits/128.0.6559.0/components/cbor/writer.cc.patch new file mode 100644 index 00000000..150c3fca --- /dev/null +++ b/chromium_edits/128.0.6559.0/components/cbor/writer.cc.patch @@ -0,0 +1,14 @@ +diff --git a/components/cbor/writer.cc b/components/cbor/writer.cc +index e7e47774abe9a..4c085d5693a38 100644 +--- a/components/cbor/writer.cc ++++ b/components/cbor/writer.cc +@@ -47,6 +47,9 @@ bool Writer::EncodeCBOR(const Value& node, + if (max_nesting_level < 0) + return false; + ++ if (node.has_tag()) { ++ StartItem(Value::Type::TAG, node.GetTag()); ++ } + switch (node.type()) { + case Value::Type::NONE: { + StartItem(Value::Type::BYTE_STRING, 0); diff --git a/chromium_edits/128.0.6559.0/components/cbor/writer_unittest.cc.patch b/chromium_edits/128.0.6559.0/components/cbor/writer_unittest.cc.patch new file mode 100644 index 00000000..1acf5f7f --- /dev/null +++ b/chromium_edits/128.0.6559.0/components/cbor/writer_unittest.cc.patch @@ -0,0 +1,36 @@ +diff --git a/components/cbor/writer_unittest.cc b/components/cbor/writer_unittest.cc +index ee11e7cb86712..b8942f1829a37 100644 +--- a/components/cbor/writer_unittest.cc ++++ b/components/cbor/writer_unittest.cc +@@ -523,4 +523,31 @@ TEST(CBORWriterTest, OverlyNestedCBOR) { + EXPECT_FALSE(Writer::Write(Value(map), 4).has_value()); + } + ++TEST(CBORWriterTest, CanWriteTag) { ++ std::array content{ ++ 0x00, 0x01, 0x71, 0x12, 0x20, ++ 0x69, 0xea, 0x07, 0x40, 0xf9, ++ 0x80, 0x7a, 0x28, 0xf4, 0xd9, ++ 0x32, 0xc6, 0x2e, 0x7c, 0x1c, ++ 0x83, 0xbe, 0x05, 0x5e, 0x55, ++ 0x07, 0x2c, 0x90, 0x26, 0x6a, ++ 0xb3, 0xe7, 0x9d, 0xf6, 0x3a, ++ 0x36, 0x5b ++ }; ++ Value to_write(content); ++ to_write.SetTag(42); ++ auto result = Writer::Write(to_write); ++ EXPECT_TRUE(result.has_value()); ++ auto& bytes = result.value(); ++ EXPECT_EQ(bytes.size(), 41UL); ++ EXPECT_EQ(bytes.at(0), 0xd8); ++ EXPECT_EQ(bytes.at(1), 0x2a); ++ EXPECT_EQ(bytes.at(2), 0x58); ++ EXPECT_EQ(bytes.at(3), 0x25); ++ for (auto i = 0UL; i < content.size(); ++i) { ++ ASSERT_LT(i + 4UL, bytes.size()); ++ ASSERT_EQ(content.at(i), bytes.at(i+4UL)); ++ } ++} ++ + } // namespace cbor diff --git a/chromium_edits/128.0.6559.0/components/open_from_clipboard/clipboard_recent_content_generic.cc.patch b/chromium_edits/128.0.6559.0/components/open_from_clipboard/clipboard_recent_content_generic.cc.patch new file mode 100644 index 00000000..31e2e173 --- /dev/null +++ b/chromium_edits/128.0.6559.0/components/open_from_clipboard/clipboard_recent_content_generic.cc.patch @@ -0,0 +1,13 @@ +diff --git a/components/open_from_clipboard/clipboard_recent_content_generic.cc b/components/open_from_clipboard/clipboard_recent_content_generic.cc +index 9c0cda2dfb314..fea1c527c6d1d 100644 +--- a/components/open_from_clipboard/clipboard_recent_content_generic.cc ++++ b/components/open_from_clipboard/clipboard_recent_content_generic.cc +@@ -20,7 +20,7 @@ + namespace { + // Schemes appropriate for suggestion by ClipboardRecentContent. + const char* kAuthorizedSchemes[] = { +- url::kAboutScheme, url::kDataScheme, url::kHttpScheme, url::kHttpsScheme, ++ url::kAboutScheme, url::kDataScheme, url::kHttpScheme, url::kHttpsScheme, "ipfs", "ipns" + // TODO(mpearson): add support for chrome:// URLs. Right now the scheme + // for that lives in content and is accessible via + // GetEmbedderRepresentationOfAboutScheme() or content::kChromeUIScheme diff --git a/chromium_edits/128.0.6559.0/net/dns/dns_config_service_linux.cc.patch b/chromium_edits/128.0.6559.0/net/dns/dns_config_service_linux.cc.patch new file mode 100644 index 00000000..fd7227a5 --- /dev/null +++ b/chromium_edits/128.0.6559.0/net/dns/dns_config_service_linux.cc.patch @@ -0,0 +1,18 @@ +diff --git a/net/dns/dns_config_service_linux.cc b/net/dns/dns_config_service_linux.cc +index 7aaf9fa5b0b78..5a9f5b5a70dd9 100644 +--- a/net/dns/dns_config_service_linux.cc ++++ b/net/dns/dns_config_service_linux.cc +@@ -276,11 +276,11 @@ bool IsNsswitchConfigCompatible( + // Ignore any entries after `kDns` because Chrome will fallback to the + // system resolver if a result was not found in DNS. + return true; +- ++ case NsswitchReader::Service::kResolve: ++ break; + case NsswitchReader::Service::kMdns: + case NsswitchReader::Service::kMdns4: + case NsswitchReader::Service::kMdns6: +- case NsswitchReader::Service::kResolve: + case NsswitchReader::Service::kNis: + RecordIncompatibleNsswitchReason( + IncompatibleNsswitchReason::kIncompatibleService, diff --git a/chromium_edits/128.0.6559.0/third_party/blink/renderer/platform/weborigin/scheme_registry.cc.patch b/chromium_edits/128.0.6559.0/third_party/blink/renderer/platform/weborigin/scheme_registry.cc.patch new file mode 100644 index 00000000..7fcbedc1 --- /dev/null +++ b/chromium_edits/128.0.6559.0/third_party/blink/renderer/platform/weborigin/scheme_registry.cc.patch @@ -0,0 +1,13 @@ +diff --git a/third_party/blink/renderer/platform/weborigin/scheme_registry.cc b/third_party/blink/renderer/platform/weborigin/scheme_registry.cc +index 62163e44e292e..60d00b8140759 100644 +--- a/third_party/blink/renderer/platform/weborigin/scheme_registry.cc ++++ b/third_party/blink/renderer/platform/weborigin/scheme_registry.cc +@@ -66,7 +66,7 @@ class URLSchemesRegistry final { + // is considered secure. Additional checks are performed to ensure that + // other http pages are filtered out. + service_worker_schemes({"http", "https"}), +- fetch_api_schemes({"http", "https"}), ++ fetch_api_schemes({"http", "https", "ipfs", "ipns"}), + allowed_in_referrer_schemes({"http", "https"}) { + for (auto& scheme : url::GetCorsEnabledSchemes()) + cors_enabled_schemes.insert(scheme.c_str()); diff --git a/chromium_edits/128.0.6559.0/url/BUILD.gn.patch b/chromium_edits/128.0.6559.0/url/BUILD.gn.patch new file mode 100644 index 00000000..be4bfca8 --- /dev/null +++ b/chromium_edits/128.0.6559.0/url/BUILD.gn.patch @@ -0,0 +1,32 @@ +diff --git a/url/BUILD.gn b/url/BUILD.gn +index f22b73bc29f06..df36977322ec7 100644 +--- a/url/BUILD.gn ++++ b/url/BUILD.gn +@@ -5,6 +5,7 @@ + import("//build/buildflag_header.gni") + import("//testing/libfuzzer/fuzzer_test.gni") + import("//testing/test.gni") ++import("//third_party/ipfs_client/args.gni") + import("features.gni") + + import("//build/config/cronet/config.gni") +@@ -67,6 +68,7 @@ component("url") { + public_deps = [ + "//base", + "//build:robolectric_buildflags", ++ "//third_party/ipfs_client:ipfs_buildflags", + ] + + configs += [ "//build/config/compiler:wexit_time_destructors" ] +@@ -89,6 +91,11 @@ component("url") { + public_configs = [ "//third_party/jdk" ] + } + ++ if (enable_ipfs) { ++ sources += [ "url_canon_ipfs.cc" ] ++ deps += [ "//third_party/ipfs_client:ipfs_client" ] ++ } ++ + if (is_win) { + # Don't conflict with Windows' "url.dll". + output_name = "url_lib" diff --git a/chromium_edits/128.0.6559.0/url/url_canon.h.patch b/chromium_edits/128.0.6559.0/url/url_canon.h.patch new file mode 100644 index 00000000..be30e4ca --- /dev/null +++ b/chromium_edits/128.0.6559.0/url/url_canon.h.patch @@ -0,0 +1,28 @@ +diff --git a/url/url_canon.h b/url/url_canon.h +index b01272ff56128..c9c36bbe8cfa6 100644 +--- a/url/url_canon.h ++++ b/url/url_canon.h +@@ -816,6 +816,23 @@ bool CanonicalizeMailtoURL(const char16_t* spec, + CanonOutput* output, + Parsed* new_parsed); + ++COMPONENT_EXPORT(URL) ++bool CanonicalizeIpfsURL(const char* spec, ++ int spec_len, ++ const Parsed& parsed, ++ SchemeType scheme_type, ++ CharsetConverter* query_converter, ++ CanonOutput* output, ++ Parsed* new_parsed); ++COMPONENT_EXPORT(URL) ++bool CanonicalizeIpfsURL(const char16_t* spec, ++ int spec_len, ++ const Parsed& parsed, ++ SchemeType scheme_type, ++ CharsetConverter* query_converter, ++ CanonOutput* output, ++ Parsed* new_parsed); ++ + // Part replacer -------------------------------------------------------------- + + // Internal structure used for storing separate strings for each component. diff --git a/chromium_edits/128.0.6559.0/url/url_canon_ipfs.cc b/chromium_edits/128.0.6559.0/url/url_canon_ipfs.cc new file mode 100644 index 00000000..d7c9fdc7 --- /dev/null +++ b/chromium_edits/128.0.6559.0/url/url_canon_ipfs.cc @@ -0,0 +1,55 @@ +#include "url_canon_internal.h" + +#include +#include + +#include + +bool url::CanonicalizeIpfsURL(const char* spec, + int spec_len, + const Parsed& parsed, + SchemeType scheme_type, + CharsetConverter* charset_converter, + CanonOutput* output, + Parsed* output_parsed) { + if ( spec_len < 1 || !spec ) { + return false; + } + if ( parsed.host.len < 1 ) { + return false; + } + std::string_view cid_str{ spec + parsed.host.begin, static_cast(parsed.host.len) }; + auto cid = ipfs::Cid(cid_str); + if ( !cid.valid() ) { + cid = ipfs::id_cid::forText( std::string{cid_str} + " is not a valid CID." ); + } + auto as_str = cid.to_string(); + if ( as_str.empty() ) { + return false; + } + std::string stdurl{ spec, static_cast(parsed.host.begin) }; + stdurl.append( as_str ); + stdurl.append( spec + parsed.host.end(), spec_len - parsed.host.end() ); + spec = stdurl.data(); + spec_len = static_cast(stdurl.size()); + Parsed parsed_input; + ParseStandardURL(spec, spec_len, &parsed_input); + return CanonicalizeStandardURL( + spec, + parsed_input, + scheme_type, + charset_converter, + output, output_parsed + ); +} +bool url::CanonicalizeIpfsURL(const char16_t* spec, + int spec_len, + const Parsed& parsed, + SchemeType scheme_type, + CharsetConverter* query_converter, + CanonOutput* output, + Parsed* new_parsed) { + RawCanonOutput<2048> as8; + ConvertUTF16ToUTF8(spec, spec_len, &as8); + return CanonicalizeIpfsURL(as8.data(), as8.length(), parsed, scheme_type, query_converter, output, new_parsed); +} diff --git a/chromium_edits/128.0.6559.0/url/url_util.cc.patch b/chromium_edits/128.0.6559.0/url/url_util.cc.patch new file mode 100644 index 00000000..3a613e4b --- /dev/null +++ b/chromium_edits/128.0.6559.0/url/url_util.cc.patch @@ -0,0 +1,17 @@ +diff --git a/url/url_util.cc b/url/url_util.cc +index da35159332452..608563dee45e5 100644 +--- a/url/url_util.cc ++++ b/url/url_util.cc +@@ -303,7 +303,11 @@ bool DoCanonicalize(const CHAR* spec, + success = CanonicalizeFileSystemURL( + spec, ParseFileSystemURL(std::basic_string_view(spec, spec_len)), + charset_converter, output, output_parsed); +- ++ } else if (DoCompareSchemeComponent(spec, scheme, "ipfs")) { ++ // Switch multibase away from case-sensitive ones before continuing canonicalization. ++ auto parsed_input = ParseStandardURL(std::basic_string_view(spec, spec_len)); ++ success = CanonicalizeIpfsURL(spec, spec_len, parsed_input, scheme_type, ++ charset_converter, output, output_parsed); + } else if (DoIsStandard(spec, scheme, &scheme_type)) { + // All "normal" URLs. + success = CanonicalizeStandardURL( diff --git a/cmake/patch.py b/cmake/patch.py index 3ce3f59e..741777bf 100755 --- a/cmake/patch.py +++ b/cmake/patch.py @@ -3,7 +3,7 @@ from enum import auto, Enum from glob import glob from os import listdir, makedirs, remove -from os.path import exists, dirname, isdir, isfile, join, realpath, relpath, splitext +from os.path import basename, exists, dirname, isdir, isfile, join, realpath, relpath, splitext from shutil import copyfile, rmtree from subprocess import call, check_call, check_output, DEVNULL from sys import argv, executable, platform, stderr @@ -17,7 +17,7 @@ import requests -VERSION_CLOSE_ENOUGH = 59922 +VERSION_CLOSE_ENOUGH = 59924 def osname(): @@ -80,8 +80,8 @@ def create_patch_file(self): verbose('Unversioned', lin[3:]) paths.append( lin[3:] ) for path in paths: - if path.endswith('.gz'): - verbose(f"We don't record changes to archives. {path}") + if path.endswith('.gz') or not '.' in basename(path): + verbose(f"File change not recorded because the path doesn't seem to be one we should: {path}") continue from_path = join(self.csrc, path) to_path = join(write_dir, path) @@ -111,11 +111,6 @@ def create_patch_file(self): to_f.write(diff_out) print(to_path) self.git(['add', 'url/url_canon_ipfs.cc'], Result.OrDie) - # diff = self.git(['diff', '--patch', tag], Result.RawOutput) - # file_name = join(self.pdir, name+'.patch') - # print('Old patch file:', file_name) - # with open(file_name, 'w') as patch_file: - # patch_file.write(diff+"\n") def file_in_branch(self, ref: str, path: str): out = self.git(['ls-tree', '--name-only', ref, path], Result.Output) diff --git a/component/chromium_cbor_adapter.cc b/component/chromium_cbor_adapter.cc index b003081d..163dbd36 100644 --- a/component/chromium_cbor_adapter.cc +++ b/component/chromium_cbor_adapter.cc @@ -25,7 +25,13 @@ bool Self::is_array() const { auto Self::at(std::string_view key) const -> std::unique_ptr { if (is_map()) { auto& m = cbor_.GetMap(); - auto it = m.find(cbor::Value{base::StringPiece{key}}); + auto it = m.find(cbor::Value{ +#ifdef BASE_STRINGS_STRING_PIECE_H_ + base::StringPiece{key} +#else + key +#endif + }); if (m.end() != it) { return std::make_unique(it->second.Clone()); } diff --git a/component/ipfs_url_loader.cc b/component/ipfs_url_loader.cc index 6868db48..ea194f56 100644 --- a/component/ipfs_url_loader.cc +++ b/component/ipfs_url_loader.cc @@ -8,6 +8,7 @@ #include "ipfs_client/ipfs_request.h" #include "ipfs_client/ipld/dag_headers.h" +#include "base/check_version_internal.h" #include "base/debug/stack_trace.h" #include "base/notreached.h" #include "base/strings/stringprintf.h" @@ -24,6 +25,17 @@ #include +#if BASE_CHECK_VERSION_INTERNAL < 125 +using PipeByteCount = uint32_t; +#define SPAN_ARG 0 +#elif BASE_CHECK_VERSION_INTERNAL < 128 +using PipeByteCount = size_t; +#define SPAN_ARG 0 +#else +using PipeByteCount = size_t; +#define SPAN_ARG 1 +#endif + ipfs::IpfsUrlLoader::IpfsUrlLoader( network::mojom::URLLoaderFactory& handles_http, InterRequestState& state) @@ -133,9 +145,15 @@ void ipfs::IpfsUrlLoader::BlocksComplete(std::string mime_type, if (mime_type.size()) { head->mime_type = mime_type; } - size_t byte_count = partial_block_.size(); + auto byte_count = static_cast(partial_block_.size()); +#if SPAN_ARG + auto* p = reinterpret_cast(partial_block_.data()); + pipe_prod_->WriteData({p, byte_count}, MOJO_BEGIN_WRITE_DATA_FLAG_ALL_OR_NONE, + byte_count); +#else pipe_prod_->WriteData(partial_block_.data(), &byte_count, MOJO_BEGIN_WRITE_DATA_FLAG_ALL_OR_NONE); +#endif head->content_length = byte_count; head->headers = net::HttpResponseHeaders::TryToCreate("access-control-allow-origin: *"); diff --git a/electron-spin/BUILD.gn b/electron-spin/BUILD.gn new file mode 100644 index 00000000..7d67e34a --- /dev/null +++ b/electron-spin/BUILD.gn @@ -0,0 +1,2 @@ +static_library("electron_hooks") { +} diff --git a/electron-spin/internally_handled_schemes.h b/electron-spin/internally_handled_schemes.h new file mode 100644 index 00000000..e69de29b diff --git a/library/src/ipfs_client/ctx/default_gateways.cc b/library/src/ipfs_client/ctx/default_gateways.cc index c1976f2c..3635ca6d 100644 --- a/library/src/ipfs_client/ctx/default_gateways.cc +++ b/library/src/ipfs_client/ctx/default_gateways.cc @@ -29,29 +29,29 @@ bool ctx::LoadGatewaysFromEnvironmentVariable(ipfs::ctx::GatewayConfig& cfg) { void ctx::LoadStaticGatewayList(ipfs::ctx::GatewayConfig& cfg) { auto static_list = { - std::pair{"http://127.0.0.1:8080/", 11'996}, - {"https://jcsl.hopto.org/", 304}, - {"https://ipfs.eth.aragon.network/", 279}, - {"https://gateway.ipfs.io/", 259}, - {"https://ipfs.io/", 247}, - {"https://cloudflare-ipfs.com/", 161}, - {"https://cf-ipfs.com/", 12}, - {"https://human.mypinata.cloud/", 8}, - {"https://delegated-ipfs.dev/", 7}, - {"https://ipfs.fleek.co/", 7}, - {"https://dweb.link/", 7}, - {"https://trustless-gateway.link/", 6}, - {"https://data.filstorage.io/", 6}, - {"https://hardbin.com/", 6}, - {"https://permaweb.eu.org/", 5}, - {"https://ipfs.joaoleitao.org/", 5}, - {"https://ipfs.runfission.com/", 5}, - {"https://ipfs.greyh.at/", 5}, - {"https://4everland.io/", 4}, - {"https://dag.w3s.link/", 4}, - {"https://gateway.pinata.cloud/", 3}, - {"https://w3s.link/", 3}, - {"https://nftstorage.link/", 2}}; + std::pair{"http://127.0.0.1:8080/", 11'997}, + {"https://jcsl.hopto.org/", 305}, + {"https://ipfs.eth.aragon.network/", 280}, + {"https://gateway.ipfs.io/", 260}, + {"https://ipfs.io/", 248}, + {"https://cloudflare-ipfs.com/", 162}, + {"https://cf-ipfs.com/", 13}, + {"https://human.mypinata.cloud/", 10}, + {"https://delegated-ipfs.dev/", 9}, + {"https://ipfs.fleek.co/", 8}, + {"https://dweb.link/", 8}, + {"https://trustless-gateway.link/", 7}, + {"https://data.filstorage.io/", 7}, + {"https://hardbin.com/", 7}, + {"https://permaweb.eu.org/", 6}, + {"https://ipfs.joaoleitao.org/", 6}, + {"https://ipfs.runfission.com/", 6}, + {"https://ipfs.greyh.at/", 6}, + {"https://4everland.io/", 5}, + {"https://dag.w3s.link/", 5}, + {"https://gateway.pinata.cloud/", 4}, + {"https://w3s.link/", 4}, + {"https://nftstorage.link/", 3}}; for (auto [gw, rt] : static_list) { cfg.AddGateway(gw, rt); } diff --git a/test_data/blocks/QmYH2SiYYDKvVTGjP6mx49G7zFw1N24nbwYAh6NGPiZCAr b/test_data/blocks/QmYH2SiYYDKvVTGjP6mx49G7zFw1N24nbwYAh6NGPiZCAr deleted file mode 100644 index 69d7a06e..00000000 --- a/test_data/blocks/QmYH2SiYYDKvVTGjP6mx49G7zFw1N24nbwYAh6NGPiZCAr +++ /dev/null @@ -1,2 +0,0 @@ - -Qx2 Qx3 Qx4 Qx5 Qx6 Qx7 Qx8 Qx9 Qy0 Qy1 Qy2 Qy3 Qy4 Qy5 Qy6 Qy7 Qy8 Qy9 Qz0 Qz1 Qz2 Qz3 Qz4 Qz5 Qz6 Qz7 Qz8 Qz9 Ra0 Ra1 Ra2 Ra3 Ra4 Ra5 Ra6 Ra7  \ No newline at end of file diff --git a/test_data/blocks/QmYHAgBQ27f2psK7jjUCj2m1SybaeFua5kkzC3t8VmxNfg b/test_data/blocks/QmYHAgBQ27f2psK7jjUCj2m1SybaeFua5kkzC3t8VmxNfg deleted file mode 100644 index 60a96a60..00000000 --- a/test_data/blocks/QmYHAgBQ27f2psK7jjUCj2m1SybaeFua5kkzC3t8VmxNfg +++ /dev/null @@ -1,2 +0,0 @@ - -Mt2 Mt3 Mt4 Mt5 Mt6 Mt7 Mt8 Mt9 Mu0 Mu1 Mu2 Mu3 Mu4 Mu5 Mu6 Mu7 Mu8 Mu9 Mv0 Mv1 Mv2 Mv3 Mv4 Mv5 Mv6 Mv7 Mv8 Mv9 Mw0 Mw1 Mw2 Mw3 Mw4 Mw5 Mw6 Mw7  \ No newline at end of file diff --git a/test_data/blocks/bafkreiclncvtqr763j6wyywb7pf65p5dl2vxgupnlz4pjxnn5jo7ms4acu b/test_data/blocks/bafkreiclncvtqr763j6wyywb7pf65p5dl2vxgupnlz4pjxnn5jo7ms4acu deleted file mode 100644 index 500c0709..00000000 --- a/test_data/blocks/bafkreiclncvtqr763j6wyywb7pf65p5dl2vxgupnlz4pjxnn5jo7ms4acu +++ /dev/null @@ -1 +0,0 @@ -X \ No newline at end of file