From 453caf3ce668fe2421ab497e20aaca5b760459e8 Mon Sep 17 00:00:00 2001 From: Kyle Hickinson Date: Fri, 15 May 2026 17:17:47 -0400 Subject: [PATCH] [cr149][iOS] Mark `CWVWebViewConfiguration.preferences` as unavailable Removes the `NOTREACHED` in `-[CWVWebViewConfiguration preferences]` that is hit in some new `CWVWebView` code, the `NOTREACHED` was originally to avoid developer error in accessing it from Swift, but we can instead just mark it as unavailable with `NS_UNAVAILABLE` to avoid that possibility instead and allow the Obj-C side to just coalesce on null. Chromium change: commit 29b0e7808c42609ad6a816161d65acc6d2b46841 Author: Anuj Kumar Date: Fri Apr 17 15:27:16 2026 -0700 [ios/web_view] Add triggerNonFatalCheck to CWVPreferences Adds a new non-persistent, in-memory property 'triggerNonFatalCheck' to CWVPreferences. When enabled, it triggers a non-fatal CHECK during CWVWebView initialization to facilitate integration testing of non-fatal checks by CWV clients. Note: All code added in this CL is temporary for release integration testing and will be reverted after testing in the stable channel concludes. The CHECK is implemented as: CHECK(false, base::NotFatalUntil::M235); with a distant launch milestone to ensure cleanup occurs before it becomes fatal. Bug: 503005516 Change-Id: Ifea699ed37f2760bcc80cc49a71968075c2ad148 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7751665 Reviewed-by: Justin Cohen Commit-Queue: Anuj Kumar Reviewed-by: John Wu Cr-Commit-Position: refs/heads/main@{#1616907} --- .../ios/web_view/internal/cwv_web_view_configuration.mm | 1 - ios/browser/api/web_view/brave_web_view_configuration.h | 3 +++ ios/browser/api/web_view/brave_web_view_configuration.mm | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/chromium_src/ios/web_view/internal/cwv_web_view_configuration.mm b/chromium_src/ios/web_view/internal/cwv_web_view_configuration.mm index 2e1e2a53030..f7d486a2c5b 100644 --- a/chromium_src/ios/web_view/internal/cwv_web_view_configuration.mm +++ b/chromium_src/ios/web_view/internal/cwv_web_view_configuration.mm @@ -69,7 +69,6 @@ - (CWVPreferences*)preferences { // This property is not nullable, so will crash anyways on the Swift side if // accessed. - NOTREACHED(); return nil; } diff --git a/ios/browser/api/web_view/brave_web_view_configuration.h b/ios/browser/api/web_view/brave_web_view_configuration.h index 5605f49cdd4..72c748d492c 100644 --- a/ios/browser/api/web_view/brave_web_view_configuration.h +++ b/ios/browser/api/web_view/brave_web_view_configuration.h @@ -11,6 +11,7 @@ #import "cwv_export.h" // NOLINT #import "cwv_web_view_configuration.h" // NOLINT +@class CWVPreferences; @class WKWebsiteDataStore; @protocol ProfileBridge; @@ -34,6 +35,8 @@ CWV_EXPORT + (BraveWebViewConfiguration*)configurationForProfile: (id)profileBridge NS_SWIFT_NAME(init(profile:)); +@property(nonatomic, readonly) CWVPreferences* preferences NS_UNAVAILABLE; + @end NS_ASSUME_NONNULL_END diff --git a/ios/browser/api/web_view/brave_web_view_configuration.mm b/ios/browser/api/web_view/brave_web_view_configuration.mm index 3d6d003956f..8aa6be1298c 100644 --- a/ios/browser/api/web_view/brave_web_view_configuration.mm +++ b/ios/browser/api/web_view/brave_web_view_configuration.mm @@ -24,6 +24,7 @@ @implementation BraveWebViewConfiguration { CWVAutofillDataManager* _autofillDataManager; } +@dynamic preferences; - (id)profile { auto* profile = ProfileIOS::FromBrowserState(self.browserState);