Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening a downloaded file in the web browser and then restarting the app results in a blank screen and "Denying unprivileged request" console error #23461

Open
data-sync-user opened this issue Nov 28, 2024 · 0 comments

Comments

@data-sync-user
Copy link
Collaborator

Blank screen:

!Blank Screen.jpeg|width=393,height=852,alt="Blank Screen.jpeg"!

Steps to Reproduce:

  • You must use a ﹍real physical device﹍ (NOT a simulator… could only reproduce on my iPhone 15 running iOS 17.6.1)
  • Download a PDF in the browser
  • Navigate to the Downloads panel
  • Tap the PDF you just downloaded. This will open it in your current tab.
  • Quit and restart the app.

Expected Behaviour:

  • Either we can still preview the PDF file…
  • OR we should see the tab before we reviewed the PDF file

Actual Behaviour:

  • A blank screen.
  • The toolbar displays a file://... URL with the name of the PDF file.
  • Console error for developers: “Denying unprivileged request…”

Note: If you go Back with the toolbar button to the previous webpage, and then Forward again, the file displays correctly. However, switching tabs does not “fix” it, only this.


The blank screen is because we are hitting the following code block in BrowserViewController+WebViewDelegates.swift:

if InternalURL.isValid(url: url) {
            if navigationAction.navigationType != .backForward,
               navigationAction.isInternalUnprivileged,
               !url.isReaderModeURL {
                logger.log("Denying unprivileged request: \(navigationAction.request)",
                           level: .warning,
                           category: .webview)
                decisionHandler(.cancel)
                return
            }

            decisionHandler(.allow)
            return
        }

NOTE: This applies to all downloaded files with a MIME type in webViewViewableTypes:

private static let webViewViewableTypes: [String] = [
        MIMEType.Bitmap,
        MIMEType.GIF,
        MIMEType.JPEG,
        MIMEType.HTML,
        MIMEType.PDF,
        MIMEType.PlainText,
        MIMEType.PNG,
        MIMEType.WebP
]

Demo:

[^RPReplay_Final1732830612.MP4]

!File vs Blank Screen.PNG|width=1179,height=2556,alt="File vs Blank Screen.PNG"!

┆Issue is synchronized with this Jira Bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant