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

8236912: NullPointerException when clicking in WebView with Button 4 or Button 5 #85

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -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",
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.