fix(patch-conflict): update protocol handler patch for relaxed assertion

Upstream relaxed the DCHECK(ph_registry) to handle tests using dummy profiles
that lack the required testing factory. Changed to early return with CHECK_IS_TEST().
Our patch already had an early return but updated comment context to match
upstream changes while preserving our behavior (removing CHECK_IS_TEST).

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7116098
This commit is contained in:
Samuel Attard
2025-11-21 12:18:15 -08:00
parent 33c04b7405
commit b03ceca18d

View File

@@ -10,20 +10,18 @@ handlers. A DCHECK causes Electron to crash until we provide our own
registry. This patch disables the check until we support this.
diff --git a/extensions/browser/api/protocol_handlers/protocol_handlers_manager.cc b/extensions/browser/api/protocol_handlers/protocol_handlers_manager.cc
index 902cf488c7d84923365c4197a70b06e61e3af038..dce80684853f89a68a2d21997102f48feb3df8f8 100644
index 7f26a1c3a63c8717705cbf6fe09ca3812450e15d..a0a483c7921553ce83be084f9a6dbd0c935c9fca 100644
--- a/extensions/browser/api/protocol_handlers/protocol_handlers_manager.cc
+++ b/extensions/browser/api/protocol_handlers/protocol_handlers_manager.cc
@@ -129,7 +129,12 @@ void ProtocolHandlersManager::ProtocolHandlersSanityCheck() {
@@ -138,9 +138,9 @@ void ProtocolHandlersManager::ProtocolHandlersSanityCheck() {
auto* ph_registry =
ExtensionsBrowserClient::Get()->GetProtocolHandlerRegistry(
browser_context_);
- DCHECK(ph_registry);
+
- // Can be null for tests using dummy profiles.
+ // TODO(samuelmaddock): Add support for extensions protocol handler. For now,
+ // let's ignore this.
+ if (!ph_registry)
+ return;
+
if (!ph_registry) {
- CHECK_IS_TEST();
return;
}
for (const auto& handler : ph_registry->GetExtensionProtocolHandlers()) {
DCHECK(handler.extension_id());
if (!enabled_ids.contains(*handler.extension_id())) {