[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 <anujbh@google.com>
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 <justincohen@google.com>
    Commit-Queue: Anuj Kumar <anujbh@google.com>
    Reviewed-by: John Wu <jzw@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1616907}
This commit is contained in:
Kyle Hickinson
2026-05-22 16:57:42 -04:00
committed by Max Karolinskiy
parent 18c2b9591b
commit 453caf3ce6
3 changed files with 4 additions and 1 deletions
@@ -69,7 +69,6 @@
- (CWVPreferences*)preferences {
// This property is not nullable, so will crash anyways on the Swift side if
// accessed.
NOTREACHED();
return nil;
}
@@ -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>)profileBridge NS_SWIFT_NAME(init(profile:));
@property(nonatomic, readonly) CWVPreferences* preferences NS_UNAVAILABLE;
@end
NS_ASSUME_NONNULL_END
@@ -24,6 +24,7 @@
@implementation BraveWebViewConfiguration {
CWVAutofillDataManager* _autofillDataManager;
}
@dynamic preferences;
- (id<ProfileBridge>)profile {
auto* profile = ProfileIOS::FromBrowserState(self.browserState);