Skip to content

Conversation

@amartya4256
Copy link
Contributor

This PR adapts how KeyBindingDispatcher processed Key events in case of Browser. If the trigger of the event is a browser, it processes the command asynchronously to avoid any possible deadlocks.

Contributes to #3104

Problem Explained
KeyBindings are registered globally with the Display. Inside the browser when a key combination is pressed which might open up another browser and use it synchronously, the browser needs to wait for the callback to finish and since it is not possible in case of Edge browser, it goes in a deadlock.

To achieve this, we must process the commands asynchronously. However, we need to tell the browser if the event eats the key event (sets event.doit = false) as the key is handled by SWT and not the browser natively. Hence, we need to proactively check if a command for the key event is going to be executed. If yes, it eats the key otherwise the browser can execute native action on the key event.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 29, 2025

Test Results

 3 015 files  ±0   3 015 suites  ±0   2h 24m 57s ⏱️ + 18m 14s
 8 258 tests ±0   8 010 ✅ ±0  248 💤 ±0  0 ❌ ±0 
23 598 runs  ±0  22 807 ✅ ±0  791 💤 ±0  0 ❌ ±0 

Results for commit 0e6c654. ± Comparison against base commit 7445acd.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@HeikoKlare HeikoKlare left a comment

Choose a reason for hiding this comment

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

At a first glance, this looks like a reasonable workaround according to the proposal in #3104 (comment).

One concern regarding behavior is the clearance of the keyAssistDialog state. And note that a bunch of related tests is failing now.
My other current comments are rather regarding style.

@amartya4256 amartya4256 force-pushed the amartya4256/process_command_asyncly_for_browser branch 4 times, most recently from 28ef122 to 2172c4d Compare January 5, 2026 12:44
This commit adapts how KeyBindingDispatcher processed Key events in case
of Browser. If the trigger of the event is a browser, it processes the
command asynchronously to avoid any possible deadlocks.

Contributes to eclipse-platform#3104
@HeikoKlare HeikoKlare force-pushed the amartya4256/process_command_asyncly_for_browser branch from 2172c4d to 0e6c654 Compare January 5, 2026 13:46
Object obj = HandlerServiceImpl.lookUpHandler(context, command.getId());
if (obj != null) {
if (obj instanceof IHandler handler) {
commandHandled = command.isEnabled() && handler.isHandled();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the command.isEnabled() check added here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if the command is not enabled, the code simply registers an execption and proceeds. Later this leads to commandHandled being set to false. Note that this needed to decide if the current handler eats the key. If the eatKey is false then the next handler in the notifyListener handles this event. e.g. CTRL + A can have multiple handler and if the first handler is not enabled and the second one should perform the command. The first one should set the commandHandled to false and not eatKey so that it would be propagated to the second handler. Since we can check this proactively before handlerService#executeHandler, we leverage this to already check if it can execute. Similar check is also performed inside Command#execute.

Copy link
Contributor

Choose a reason for hiding this comment

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

Great, thank you for the detailed explanation!

Copy link
Contributor

@HeikoKlare HeikoKlare left a comment

Choose a reason for hiding this comment

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

The change now looks good to me. It also properly resolves the issue reported in #3104 for me.

@sratz can you please also have a look as you have been involved into the issue and made proposals for how to fit it as well?

@HeikoKlare HeikoKlare requested a review from sratz January 5, 2026 17:28
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.

Freeze on Edge instantiation via BrowserViewer

2 participants