Skip to content
Permalink
Browse files

8236912: NullPointerException when clicking in WebView with Button 4 …

…or Button 5

Reviewed-by: ghb, kcr
  • Loading branch information
Robert Lichtenberger authored and kevinrushforth committed Jan 27, 2020
1 parent da99e24 commit aa6f3a4ea890d440e45cbd3f6d782e6e584802f8
@@ -994,12 +994,13 @@ private void processMouseEvent(MouseEvent ev) {
}

final Integer id = idMap.get(type);
if (id == null) {
final Integer button = idMap.get(ev.getButton());
if (id == null || button == null) {
// not supported by webkit
return;
}
WCMouseEvent mouseEvent =
new WCMouseEvent(id, idMap.get(ev.getButton()),
new WCMouseEvent(id, button,
ev.getClickCount(), (int) x, (int) y,
(int) screenX, (int) screenY,
System.currentTimeMillis(),
@@ -30,7 +30,9 @@
import java.io.File;
import java.util.concurrent.FutureTask;

import javafx.application.Platform;
import javafx.event.Event;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.web.WebEngineShim;
import javafx.scene.web.WebView;

@@ -54,6 +56,18 @@
checkZoom(view, ZOOM);
}

@Test public void testForwardMouseButton() {
WebView view = getView();
Event forward = new MouseEvent(MouseEvent.MOUSE_PRESSED, 0, 0, 0, 0, MouseButton.FORWARD, 1, false, false, false, false, false, false, false, false, true, true, false, true, null);
view.fireEvent(forward); // must not throw NullPointerException (JDK-8236912)
}

@Test public void testBackMouseButton() {
WebView view = getView();
Event back = new MouseEvent(MouseEvent.MOUSE_PRESSED, 0, 0, 0, 0, MouseButton.BACK, 1, false, false, false, false, false, false, false, true, false, true, false, true, null);
view.fireEvent(back); // must not throw NullPointerException (JDK-8236912)
}

void checkFontScale(WebView view, float scale) {
assertEquals("WebView.fontScale", scale, view.getFontScale(), DELTA);
assertEquals("WebPage.zoomFactor",

0 comments on commit aa6f3a4

Please sign in to comment.
You can’t perform that action at this time.