fix(patch-conflict): update protocol handler check for upstream null guard

Upstream changed from DCHECK(ph_registry) to a null check with CHECK_IS_TEST()
guard. Our patch removes the CHECK_IS_TEST() since Electron doesn't have a
protocol handler registry by default, so this is expected in normal operation,
not just tests.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7116098
This commit is contained in:
Samuel Attard
2025-11-21 03:56:22 -08:00
parent b86ad55f41
commit 543c6afcf0

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())) {