Commit ee72b70f authored by Rohit Rao's avatar Rohit Rao Committed by Commit Bot

[ios] Fixes an issue where BVC is overdismissed by a bug in WebKit.

The WKFileUploadPanel has a bug in iOS 11 and earlier which causes view
controllers to be overdismissed when the HTML file picker is
used. WebKit attempts to dismiss the file picker view controller, but
due to a bug inadvertently dismisses its presenting view controller
instead.

We previously attempted to work around this bug in
BrowserViewController, but now the file picker is presented on top of
BrowserContainerViewController instead. This CL copies the BVC fix into
BrowserContainerViewController as well.

BUG=852367

Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I61651810ae9e06caee27a4c441942e4c4d09c71c
Reviewed-on: https://chromium-review.googlesource.com/1174611Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582918}
parent ded1993e
...@@ -30,6 +30,27 @@ ...@@ -30,6 +30,27 @@
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
} }
- (void)dismissViewControllerAnimated:(BOOL)animated
completion:(void (^)())completion {
if (!self.presentedViewController) {
// TODO(crbug.com/801165): On iOS10, UIDocumentMenuViewController and
// WKFileUploadPanel somehow combine to call dismiss twice instead of once.
// The second call would dismiss the BrowserContainerViewController itself,
// so look for that case and return early.
//
// TODO(crbug.com/852367): A similar bug exists on all iOS versions with
// WKFileUploadPanel and UIDocumentPickerViewController. See also
// https://crbug.com/811671.
//
// Return early whenever this method is invoked but no VC appears to be
// presented. These cases will always end up dismissing the
// BrowserContainerViewController itself, which would put the app into an
// unresponsive state.
return;
}
[super dismissViewControllerAnimated:animated completion:completion];
}
#pragma mark - Public #pragma mark - Public
- (void)displayContentView:(UIView*)contentView { - (void)displayContentView:(UIView*)contentView {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment