[iOS] Fix showing edit menu on long-press in location bar

The edit menu was being shown inside a DCHECK.
(I.e DCHECK([self methodWithSideEffects]). This meant that it was
stripped out in release builds, but not in debug, which is why this
didn't reproduce locally.

(cherry picked from commit eac89721742297a0c50418fa9276bd03f4230a97)

Bug: 1134647
Change-Id: Idbe1a48d0f9c82543cffcc3f79d05128e9589470
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2462266
Commit-Queue: Robbie Gibson <[email protected]>
Commit-Queue: Stepan Khapugin <[email protected]>
Auto-Submit: Robbie Gibson <[email protected]>
Reviewed-by: Stepan Khapugin <[email protected]>
Cr-Original-Commit-Position: refs/heads/master@{#815615}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2467999
Reviewed-by: Robbie Gibson <[email protected]>
Cr-Commit-Position: refs/branch-heads/4280@{#319}
Cr-Branched-From: ea420fb963f9658c9969b6513c56b8f47efa1a2a-refs/heads/master@{#812852}
diff --git a/ios/chrome/browser/ui/location_bar/location_bar_view_controller.mm b/ios/chrome/browser/ui/location_bar/location_bar_view_controller.mm
index f7cec02..7dbd3c4 100644
--- a/ios/chrome/browser/ui/location_bar/location_bar_view_controller.mm
+++ b/ios/chrome/browser/ui/location_bar/location_bar_view_controller.mm
@@ -596,7 +596,7 @@
         initWithTitle:l10n_util::GetNSString(IDS_IOS_SEARCH_COPIED_TEXT)
                action:@selector(searchCopiedText:)]);
 
-    DCHECK([self updateCachedClipboardStateWithCompletion:^() {
+    BOOL updateSuccessful = [self updateCachedClipboardStateWithCompletion:^() {
       if (@available(iOS 13, *)) {
         [menu showMenuFromView:self.view rect:self.locationBarSteadyView.frame];
       } else {
@@ -608,7 +608,8 @@
       // presented menu.
       UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification,
                                       menu);
-    }]);
+    }];
+    DCHECK(updateSuccessful);
   }
 }