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

[Problem/Bug]: Download is blocked when subscribed to DownloadStarting #4612

Open
gkerenyi opened this issue Jun 4, 2024 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@gkerenyi
Copy link

gkerenyi commented Jun 4, 2024

What happened?

Summary

If Smart Screen is disabled, and the user downloads a potentially harmful file (e.g. msixbundle), the displayed message depends on whether a handler is subscribed to the DownloadStarting WebView2 event:

  • "File was blocked" message is shown if the client app is subscribed to DownloadStarting.

    image

  • "Do you want to keep it?" question is shown if the client app is not subscribed to DownloadStarting.

    image

Impact on our application

In our application we have to disable Smart Screen and have to handle the DownloadStarting event. The "file was blocked" message displayed to our users is too strict and we would like to use the "Do you want to keep it?" question instead, because in that case the possible choices are more accessible to users.

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

125.0.2535.79

SDK Version

1.0.2535.41

Framework

WPF

Operating System

Windows 10, Windows 11

OS Version

No response

Repro steps

Sample repo
URL: https://github.com/gkerenyi/WebView2SamplesForDownloadTest.

It is a fork of https://github.com/MicrosoftEdge/WebView2Samples with the following changes:

  • MainWindow.InitializeWebView() is extended with this line to disable Smart Screen.
    WebViewSettings.IsReputationCheckingRequired = false;
  • MainWindow.InitializeWebView() is extended with this line to add a handler to the DownloadStarting event:
    webView.CoreWebView2.DownloadStarting += WebView_DownloadStarting;
  • The WebView_DownloadStarting handler method has an empty implementation.
  • For convenience, the default background image and default URL of new windows are removed.

Steps to reproduce
When subscribed to DownloadStarting

  1. Build the WebView2WpfBrowser solution from the repo
  2. Start the sample browser
  3. Visit https://gkerenyi.github.io/DownloadLinks
  4. It shows two links. One of them downloads an msixbundle file in the current window, the other one downloads the same file in a new window. Click both.
  5. ➡️ Result: "File was blocked" message is shown in both cases.
    image

When not subscribed to DownloadStarting

  1. Comment out the following line in MainWindow.InitializeWebView():
    webView.CoreWebView2.DownloadStarting += WebView_DownloadStarting;
  2. Rebuild the solution
  3. Start the sample browser
  4. Visit https://gkerenyi.github.io/DownloadLinks
  5. It shows two links. One of them downloads an msixbundle file in the current window, the other one downloads the same file in a new window. Click both.
  6. ➡️ Result: "Do you want to keep it?" message is shown.
    image

Expected
"Do you want to keep it?" message is shown in both cases.

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

Don't know

Last working version (if regression)

No response

@gkerenyi gkerenyi added the bug Something isn't working label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants