FIX: Toggling a breakpoint by clicking on the linenumber in debugger not possible #1367
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a regression introduced through #1343.
With that pull request
getModifiers()
was switched togetModifiersEx()
. However these two methods are not as easily interchangeable (especially when using the mouse-release-event) as it might seem from the deprecation notice. In this particular case theMouseEvent
is checked onmouseRelease
. However when looking at the documentation ofgetModifiersEx()
(e.g. https://github.com/openjdk/jdk/blob/dfacda488bfbe2e11e8d607a6d08527710286982/src/java.desktop/share/classes/java/awt/event/InputEvent.java#L506C10-L506C10) it gets clear that at that stage, we cannot detect the button click with the help of the modifiers. I did some debugging and at the point of button releasegetModifiersEx()
just returns 0, meaning that no bit is set at all. A possible solution to this is to check which button triggered the release-event with the use ofgetButton()
like I did here. This behaviour was also discovered by someone on stackoverflow a while back: https://stackoverflow.com/questions/60518621/mouseevent-getmodifiersex-call-does-not-work-as-expected-or-as-documented.Note: The PR #1343 touched another spot where
getModifiers()
was replaced. Since I am fairly new to this project, I was not sure if the changed code is correct at this point either: https://github.com/mozilla/rhino/pull/1343/files#diff-5d4e8db22e19b87ef92bbee2473a342f75f2e166ff04d18e07cbc02e46c91514L2477. I only noticed that the enclosing method seemingly is never used, so I can't say where theMouseEvent
is coming from hence I am unable to tell if that code has to be changed as well.