diff --git a/content/browser/digital_credentials/digital_identity_request_impl.cc b/content/browser/digital_credentials/digital_identity_request_impl.cc index 9ad1c7e772dc7..60e78b954d737 100644 --- a/content/browser/digital_credentials/digital_identity_request_impl.cc +++ b/content/browser/digital_credentials/digital_identity_request_impl.cc @@ -637,7 +637,15 @@ void DigitalIdentityRequestImpl::Abort() { } if (update_interstitial_on_abort_callback_) { + // Running the abort callback can synchronously close UI which (via + // activation observers) may destroy the hosting WebContents and therefore + // `this`. Guard with a WeakPtr and bail out if that happens. + base::WeakPtr weak_this = + weak_ptr_factory_.GetWeakPtr(); std::move(update_interstitial_on_abort_callback_).Run(); + if (!weak_this) { + return; + } } CompleteRequestWithStatus(