Skip to content

[Edge] Add fallback when WebView2 runtime is not present #2000 #2065

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

Merged

Conversation

HeikoKlare
Copy link
Contributor

@HeikoKlare HeikoKlare commented Apr 25, 2025

When using WebView2 as browser engine in SWT without a WebView2 runtime being available on the system, browser initialization fails. In order to more gracefully handle the case that a system has no such runtime installed (like on some Windows 10 systems), this change introduces an automatic fallback to Internet Explorer in case no WebView2 runtime is found. In addition, once the first browser is instiantiated (either during application startup or when a view containing a browser is opened), it shows an error dialog informing about the missing runtime and the fallback to IE, and its point to the error log, to which an error is posted that also contains a link to FAQ. This makes it possible to easily copy the link, which is not possible from the message box (or maybe someone knows how to easily implement that).

Fixes #2000

Supercedes and thus closes #2038

This is supposed to raise an alternative for how to handle the situation that a WebView2 runtime is not present on the current system in addition to:

Screenshots

The dialog popping up:
image

The event log entry:
image

How to test

If you want to test the change, it's easiest to force Edge to throw the error as if it was thrown when the runtime is missing.
To this end, you can add the following to the Edge::create(Composite, int) method:

SWT.error(SWT.ERROR_NOT_IMPLEMENTED, null, "");

Copy link
Contributor

github-actions bot commented Apr 25, 2025

Test Results

   545 files  ±0     545 suites  ±0   38m 1s ⏱️ - 1m 52s
 4 377 tests ±0   4 359 ✅ ±0   18 💤 ±0  0 ❌ ±0 
16 647 runs  ±0  16 506 ✅ ±0  141 💤 ±0  0 ❌ ±0 

Results for commit f633d04. ± Comparison against base commit f498ca3.

♻️ This comment has been updated with latest results.

@GooogLeMorons
Copy link

i've picked a little this micro$oft stuff pile...

in win11 there is Edge and so called 'OnDemand' pre-installed 'Microsoft-Windows-InternetExplorer-Optional-Package' IE-Edge adapter('dism /online /get-packages /format:table').

looks like the '-Dorg.eclipse.swt.browser.DefaultType=ie' eclipse.ini hat trick (#1912) utilizes 'SWT -> IE-Edge adapter -> m$ Edge' chain. in my case e.g. context help tooltips lose warning 'NOTE: The SWT Browser widget could not be created...' and become richer, Welcome screen at least shows built-in '404' html and 'Tip of the day' (in build I20250423-0800) become fully-functional.

without this magic eclipse.ini option - even if 'General / Web browser / Use external ... / Internet explorer' option is selected - seems Eclipse fully relies on 'SWT -> WebView2 -> m$ Edge' chain. for me (v. 4.35.0 on Win11) even if the chain is fully-functional and WebView2 is already provided by Edge, there is a need to overbloat os with m$ Evergreed WebView2 runtime and extremely annoying blocker forcing to get rid of WebView2 totally(#2061)

so, '-Dorg.eclipse.swt.browser.DefaultType=ie' + Microsoft-Windows-InternetExplorer-Optional-Package (probably available on Win11, or 'dism /add-package ...') + m$ Edge (seems available on most of Win11) could be a workaround.

The thing is there can be nether WebView2/Microsoft-Windows-InternetExplorer-Optional-Package, nor m$ Edge - at least on Win11 in EU, where m$ 'kindly allows' users to remove Edge(e.g. i got my config by uninstalling it and setting up Firefox instead).
i think the situation worths attention - what should Eclipse do in this case? at least it shouldn't crash and spawn 'unhandled exception' popups.

@HeikoKlare
Copy link
Contributor Author

I have to admit that I am not sure what concrete issue you are actually referring to. I have the impression that nothing stated really relates to Edge/WebView2 and making it default in Eclipse but relates to the overall concept of browser integration in Eclipse (see also my comment #2000 (comment)). With VM argument '-Dorg.eclipse.swt.browser.DefaultType=ie you switch back to the exact behavior you have for years in Eclipse on Windows. Nothing has changed with respect to that recently. If you don't want to have WebView2 installed in your system, you are free to use that option as long as it keeps working. If it's about changed behavior between WebView2 not being installed compared to IE not being available, please precisely point that out (as I asked for in #2000 (comment)). If you have concerns about how Eclipse integrates browsers in general, I propose to open a separate issue about that and discuss the requirements for a chance and the actual options there.

Regarding the handling of WebView2 runtime not being present, we have started to make concrete proposal (like this one) to discuss about. But currently I only see complains rather than (feedback on) actual proposals.

@akurtakov akurtakov force-pushed the issue-2000-alternative branch from 542d408 to c4902b0 Compare May 2, 2025 05:21
@GooogLeMorons
Copy link

I have to admit that I am not sure what concrete issue you are actually referring to. I have the impression that nothing stated really relates to Edge/WebView2 and making it default in Eclipse but relates to the overall concept of browser integration in Eclipse...

well, let's figure it out: SWT samples, Windows, no WebView2 runtime.

SWT Browser sample failure
(and even if SWT Browser sample expects WebView2 by default, SWT FAQ still refers to IE11 and states Edge support is limited)

there is SWT Browser widget which, sure, Eclipse relies and uses. looks like it is the root cause of these "missing Edge" failures.
in the general discussion was proposed, what exactly need to be discussed: an alternative to the SWT Browser widget, its default mode (ie|edge) in Eclipse on Windows, or something else wasn't explicitly specified?

flaws of WebView2 implementation, problems they cause and obvious way of avoiding them by avoiding WebView2 itself do not apply here - ok.

there is no room to discuss general Eclipse browser integration here - fine.

SWT Browser widget issues related to Edge/WebView2 integration have to be addressed in SWT repository - sure.

so what is all this talk about? - the problem exists, there is some patch on it and let it stay that way?

is it possible to propose something here without taking into account what exact features of WebView2 are used for which purposes and do we need all this to continue programming just as effectively and comfortably in Eclipse?
there is JEditorPane available in JDK, but it isn't clear if it's outdated HTML 3.2 fits the needs. there is JavaFX WebView, but it requires additional download. looks like it is impossible to resolve the issue without breaking the discussion frame was set.

Regarding the handling of WebView2 runtime not being present, we have started to make concrete proposal (like this one) to discuss about. But currently I only see complains rather than (feedback on) actual proposals.

yes, you may not like my tonality. so, firstly - in the vein of the announced general discussion - haven't you been kindly told before about observed degradation in the polite, friendly manner? and what is the result of that messages - the degradation isn't as rapid and comprehensive as it could be?
you can object "everything is done here on enthusiasm without any guarantees and obligations, so be grateful for what you have" - ​​in general you will be right saying this. and we will be grateful - be sure - from the bottom of our hearts and souls. just don't break what already works and don't impose features that create more headaches than benefits, please. well, really, who welcomes after update new series of nearly finger-sucked error popups and crumbles of functionality that worked fine before

and secondly. it seems no other input on the declared subject has been brought here yet. at all.)))
so, maybe, someone finally suggest something more interesting and in a more constructive way, seeing all this?

@merks
Copy link
Contributor

merks commented May 2, 2025

It would seem more productive to get edge/webview working. That is the way forward while ie is behind us. It an unfortunate thing that ie has been a horrible abomination for a very long time. No one wants to author html that renders correctly on ie and in a real browser. It really does seem best to move on from this. Sorry if that sounds harsh. There is just way too much to do and way too few people to do it.

@HeikoKlare
Copy link
Contributor Author

Here you can find the rather up-to-date FAQ to Edge/IE: https://github.com/eclipse-platform/eclipse.platform/blob/master/docs/FAQ/FAQ_How_do_I_use_Edge-IE_as_the_Browser's_underlying_renderer.md

yes, you may not like my tonality. so, firstly - in the vein of the announced general discussion - haven't you been kindly told before about observed degradation in the polite, friendly manner? and what is the result of that messages - the degradation isn't as rapid and comprehensive as it could be?
you can object "everything is done here on enthusiasm without any guarantees and obligations, so be grateful for what you have" - ​​in general you will be right saying this. and we will be grateful - be sure - from the bottom of our hearts and souls. just don't break what already works and don't impose features that create more headaches than benefits, please. well, really, who welcomes after update new series of nearly finger-sucked error popups and crumbles of functionality that worked fine before

Well, the tonality has been quite harsh from the beginning. Still, I tried to help by first understanding the actual problem (I have still not properly understood it as, like Ed said, there is no good reason for adopting anything related to IE anymore) and then by investing time to make proposals. And I have also explained multiple times that no one broke anything. You can simply restore the existing behavior via a system property which has also been explained in the news entry for the Eclipse release for the case that someone experiences issues with using WebView2 (https://eclipse.dev/eclipse/news/news.html?file=4.35/platform.html).
In addition, you may have heard of "software aging" (Parnas): Internet Explorer is basically out of support, does not cover many use cases even now and will not be usably at all in the not-so-far future. So in order to not completely break Eclipse on Windows in the near future, there is no way around moving to WebView2 (or something else), the question was just when to do it. We worked on preparing that step quite a while and we did the step exactly now as we were confident that the state is good enough and because there is a fallback for everyone facing problems. The low number of complains indicates that the chosen point in time may not have been too bad. And if you really don't want Eclipse to move forward and keep up to date, that's of course fine, as you can simply stick to any previous release.

and secondly. it seems no other input on the declared subject has been brought here yet. at all.)))
so, maybe, someone finally suggest something more interesting and in a more constructive way, seeing all this?

I really hope that someone shows up who really understands the issue, sees the necessary relevance in working on it, and comes with a good proposal to help you. But maybe it would help people if you first explained what you consider interesting and constructive, given that what was proposed so far does obviously not fall into that category for you. But given the amount of feedback received so far, it might be that the relevance of the reported issue is simply not high enough for anyone to take care at all. In any case, it seems like I am the wrong person to help here.

@HeikoKlare
Copy link
Contributor Author

I would still really like to make some improvements for those people who would be fine with just being informed about the neccessity to install WebView2 (and how to do it) in case it's missing in their system (which is part of the goal of this PR). So if someone wants give to give feedback on that, it would be highly appreciated.

@merks
Copy link
Contributor

merks commented May 5, 2025

Please, please do what you believe is best. You are empowered to make these decisions and there has been more than enough time for comments.

@HeikoKlare HeikoKlare force-pushed the issue-2000-alternative branch from c4902b0 to 99774ba Compare May 5, 2025 19:11
@HeikoKlare HeikoKlare marked this pull request as ready for review May 5, 2025 19:23
@HeikoKlare
Copy link
Contributor Author

Alright, I turned this into an actual proposal. I adapted the initial message according to the latest changes and added screenshots to show how it would look like in case WebView2 is not available and fallback to IE is used. We could think about making this popup configurable, but in my opinion someone who does not want to use and install WebView2 at all should use the system property to switch back to IE anyway.

@sratz what do you think about this proposal? I am completely open for any suggestions to better deal with the situation of WebView2 not being present.

@sratz
Copy link
Member

sratz commented May 7, 2025

Alright, I turned this into an actual proposal. I adapted the initial message according to the latest changes and added screenshots to show how it would look like in case WebView2 is not available and fallback to IE is used. We could think about making this popup configurable, but in my opinion someone who does not want to use and install WebView2 at all should use the system property to switch back to IE anyway.

@sratz what do you think about this proposal? I am completely open for any suggestions to better deal with the situation of WebView2 not being present.

Hmm, I am not sure about this implicit fallback. User's will click it away and then it feels like things are running fine, but with IE not being the default anymore I suppose things will then break later somewhere.

I'd prefer if this fallback was more of a deliberate choice.

I am wondering whether we could

  1. change the dialog to something like:

    WebView2 not available. Do you want to use the legacy IE engine instead?
    [Use IE] [More Information] [Cancel]
    

    With the More Information button opening the FAQ page.

  2. have a preference for this.
    This would allow things to be permanent and on the preference page we could also display a disclaimer.
    Not sure how to implement this, though, maybe using org.eclipse.swt.browser.BrowserInitializer in a fragment, which sets the system properties based on a preference.

@HeikoKlare HeikoKlare force-pushed the issue-2000-alternative branch from 99774ba to 9d7ef18 Compare May 7, 2025 13:18
@HeikoKlare
Copy link
Contributor Author

I like the idea of changing the dialog. I now did it like this:
image

Clicking on "information" opens the FAQ in an (external) browser. Clicking on "Use IE" makes IE the used default browser (existing browsers have to be reopened). @sratz wdyt?

have a preference for this.

I am not in favor of providing a preference for this, as it quite some additional effort for a use case that we do not want to support in the long run. If need be, you can just add an according property to the INI. But if we think such a preference is useful, we may also address that in a separate change.

@sratz
Copy link
Member

sratz commented May 8, 2025

I like the idea of changing the dialog. I now did it like this:
image

Clicking on "information" opens the FAQ in an (external) browser. Clicking on "Use IE" makes IE the used default browser (existing browsers have to be reopened). @sratz wdyt?

Looks good! I have asked our UX experts to take a look and here are some suggestions:

  • Add 'Edge' somewhere. Maybe add a first sentence of the dialog: The WebView2 (Microsoft Edge) runtime is not available.
  • Replace the 'Information' button with a hyperlink in the text. Buttons are typically used for actions inside the application, while a hyperlink makes it clear this opens an external (web) document. It also allows you to take a look a that information first, before making a decision.

Proposal:
image

have a preference for this.

I am not in favor of providing a preference for this, as it quite some additional effort for a use case that we do not want to support in the long run. If need be, you can just add an according property to the INI. But if we think such a preference is useful, we may also address that in a separate change.

Agreed.

@HeikoKlare
Copy link
Contributor Author

Thank you for all the proposals! Sounds great and I will gladly adapt it.

  • Replace the 'Information' button with a hyperlink in the text. Buttons are typically used for actions inside the application, while a hyperlink makes it clear this opens an external (web) document. It also allows you to take a look a that information first, before making a decision.

I fully agree. The problem is that I have currently no idea how to integrate a hyperlink into the message of a message box. That's why I used a button for it. Probably it's easier than I expect. Do you know how to do it?

@Phillipus
Copy link
Contributor

The problem is that I have currently no idea how to integrate a hyperlink into the message of a message box.

I don't think you can. A sub-class of MessageDialog adding the hyperlink to createCustomArea might do it.

@HeikoKlare
Copy link
Contributor Author

I don't think you can. A sub-class of MessageDialog adding the hyperlink to createCustomArea might do it.

Thank you! That was also my understanding. Unfortunatly, MessageDialog is in JFace, so nothing we may use in SWT. So unless there is a different way, we would have to custom-implement such a dialog (like done for JFace's Dialog class).

@Phillipus
Copy link
Contributor

Phillipus commented May 8, 2025

Unfortunatly, MessageDialog is in JFace

Damn, so it is! Sorry about that. Perhaps, then, it gets too complicated and a button would suffice as in the original proposal?

@BeckerWdf
Copy link
Contributor

  • The WebView2 (Microsoft Edge) runtime is not available

Or maybe even the other way around: "Microsoft Edge (WebView2) is not available." Does the user need to know the technical name "WebView2"?

@merks
Copy link
Contributor

merks commented May 9, 2025

I agree. I think everyone on Windows will recognize the term Edge yet be completely clueless about the term WebView2.

@HeikoKlare HeikoKlare force-pushed the issue-2000-alternative branch from 9d7ef18 to 57f4170 Compare May 9, 2025 08:26
@HeikoKlare
Copy link
Contributor Author

Totally makes sense. This is how it looks with latest changes:
image

I fully agree that the button for showing information is bad, but as said I have no clue yet how to embed a hyperlink into the message without implementing a custom dialog. But maybe it's best to really custom-implement the dialog to have the hyperlink properly embedded.

Btw: if someone wants to test the proposal, I have added a short "How to test" to the original post, which describes how to make Edge fail in a comparable way as is the runtime was not available on your system.

Copy link
Member

@sratz sratz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, bummer! Haven't thought about MessagDialog with Hyperlink support being a JFace API.

Yeah, then let's go with the button. The completed = false; thing is a neat trick to keep it open when pressing the 'Information' button!

Just a minor spelling mistake remains, otherwise LGTM.

private static final DialogOption CANCEL_OPTION = new DialogOption(SWT.CANCEL, "Cancel");

private static final String DIALOG_TITLE = "Default browser engine not available";
private static final String DIALOG_MESSAGE = "The Microsoft Edge (WebView2) runtime not available. Do you want to use the legacy Internet Explorer engine (requires reopening browsers)?";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private static final String DIALOG_MESSAGE = "The Microsoft Edge (WebView2) runtime not available. Do you want to use the legacy Internet Explorer engine (requires reopening browsers)?";
private static final String DIALOG_MESSAGE = "The Microsoft Edge (WebView2) runtime is not available. Do you want to use the legacy Internet Explorer engine (requires reopening browsers)?";

Copy link
Contributor

@BeckerWdf BeckerWdf May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the one hand we say "runtime" and later we say "engine". Should we use the same term here? Or should we simply get rid of the terms and say:

Microsoft Edge (WebView2) is not available. Do you want to use the legacy Internet Explorer (requires reopening browsers)?

And what about getting rid of the "( )" stuff by saying:

Microsoft Edge (WebView2) is not available. Do you want to use the legacy Internet Explorer?
Note: It is necessary to reopen browsers for the change to take effect.

Or is this too long?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making an explicit note out of the "()" part is definitely better.

I have no strong opinion regarding usage of engine/runtime. I think it's more "precise" to refer to it as a runtime, but I think the "precision" is not relevant here and it's either to understand without. So now I adapted as follows:

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like how it looks now.

@HeikoKlare HeikoKlare force-pushed the issue-2000-alternative branch 2 times, most recently from 6e11dd5 to 0b1cb59 Compare May 9, 2025 12:43
…form#2000

When using WebView2 as browser engine in SWT without a WebView2 runtime
being available on the system, browser initialization fails. In order to
more gracefully handle the case that a system has no such runtime
installed (like on some Windows 10 systems), this change introduces an
automatic fallback option to Internet Explorer in case no WebView2
runtime is found. It shows a dialog informing about the missing runtime,
the option to fallback to IE and also allows to open further information
provided via the FAQ.

Fixes eclipse-platform#2000
@HeikoKlare HeikoKlare force-pushed the issue-2000-alternative branch from 0b1cb59 to f633d04 Compare May 12, 2025 15:59
@HeikoKlare
Copy link
Contributor Author

The latest responses sound as if everyone basically agrees with the proposed change. If there are no further objections, I would like to merge tomorrow for M3.

@HeikoKlare HeikoKlare merged commit 25ad773 into eclipse-platform:master May 13, 2025
17 checks passed
@HeikoKlare HeikoKlare deleted the issue-2000-alternative branch May 13, 2025 07:24
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

Successfully merging this pull request may close these issues.

[windows] WebView2 runtime not found
6 participants