-
Bug
-
Resolution: Fixed
-
P3
-
8u25
-
Java-Plug-in 11.25.2.18
JRE-Version verwenden 1.8.0_25-b18 Java HotSpot(TM) Client VM
Steps to reproduce:
- Start a WebView in a JFXPanel inside a sandboxed Applet with sample text, e.g. "Drag me or <input value='ME -> here >< or anywhere'/>"
- Select some text inside or outside the text-field and drag it around inside the WebView
- This exception is logged:
java.lang.SecurityException: Unable to create temporary file
at java.io.File.createTempFile(Unknown Source)
at java.io.File.createTempFile(Unknown Source)
at com.sun.javafx.webkit.UIClientImpl.startDrag(Unknown Source)
at com.sun.webkit.WebPage.fwkStartDrag(Unknown Source)
at com.sun.webkit.WebPage.twkProcessMouseEvent(Native Method)
at com.sun.webkit.WebPage.dispatchMouseEvent(Unknown Source)
at javafx.scene.web.WebView.processMouseEvent(Unknown Source)
at javafx.scene.web.WebView.lambda$registerEventHandlers$32(Unknown Source)
at javafx.scene.web.WebView$$Lambda$95/18574629.handle(Unknown Source)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(Unknown Source)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
at javafx.event.Event.fireEvent(Unknown Source)
at javafx.scene.Scene$MouseHandler.process(Unknown Source)
at javafx.scene.Scene$MouseHandler.access$1500(Unknown Source)
at javafx.scene.Scene.impl_processMouseEvent(Unknown Source)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)
at com.sun.javafx.tk.quantum.EmbeddedScene.lambda$null$281(Unknown Source)
at com.sun.javafx.tk.quantum.EmbeddedScene$$Lambda$252/6940360.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.EmbeddedScene.lambda$mouseEvent$282(Unknown Source)
at com.sun.javafx.tk.quantum.EmbeddedScene$$Lambda$217/22994187.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$164(Unknown Source)
at com.sun.javafx.application.PlatformImpl$$Lambda$63/7427672.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(Unknown Source)
at com.sun.javafx.application.PlatformImpl$$Lambda$62/6421567.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$141(Unknown Source)
at com.sun.glass.ui.win.WinApplication$$Lambda$53/24944659.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
In addition:
If the following code is also included in the setup of the WebView the WebView UI becomes unresponsive to mouse-events after dragging once (paint & mouse-scroll events are still processed).
The following code also seems to have lost its effectiveness. If i remember correctly this code prevented dragging of text from inside the WebView all together in 8u20/7u67 (not 100% sure though, but that was the intention at least).
view.setOnDragDetected(new EventHandler<MouseEvent>() // disable dragging of selection from WebView
{
public void handle(MouseEvent event)
{
event.consume();
}
});
Complete example code: (run this in browser as sandboxed applet)
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.input.MouseEvent;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javax.swing.JPanel;
public class JavaFXTestDragTest extends Applet
{
private static final long serialVersionUID = -7110935176335971839L;
public JavaFXTestDragTest()
{
super();
addMouseWheelListener(new MouseWheelListener()
{
public void mouseWheelMoved(MouseWheelEvent e)
{
e.consume(); // prevent MouseWheel Events to bubble up to the web-page.
}
});
}
@Override
public void init()
{
setLayout(new BorderLayout());
final HTMLPanel htmlPanel = new HTMLPanel();
add(BorderLayout.CENTER, htmlPanel);
htmlPanel.setHTMLContent("Drag ME or <input value='ME -> here:>< or anywhere'/><br><br><br><br><br><br>top<br><br><br><br><br><br>middle<br><br><br><br><br>bottom");
}
private static class HTMLPanel extends JPanel
{
private static final long serialVersionUID = -6272445527425893706L;
private final JFXPanel jfxPanel = new JFXPanel();
private WebEngine engine;
private volatile boolean isInitialized;
public HTMLPanel()
{
super(new BorderLayout());
Platform.setImplicitExit(false);
}
private void initComponents()
{
if (!isInitialized)
{
this.isInitialized = true;
createScene();
this.add(jfxPanel, BorderLayout.CENTER);
}
}
private void createScene()
{
Platform.runLater(new Runnable()
{
public void run()
{
WebView view = new WebView();
engine = view.getEngine();
view.setOnDragDetected(new EventHandler<MouseEvent>() // disable dragging of selection from WebView
{
public void handle(MouseEvent event)
{
event.consume();
}
});
jfxPanel.setScene(new Scene(view));
}
});
}
public void setHTMLContent(final String htmlContent)
{
initComponents();
Platform.runLater(new Runnable()
{
public void run()
{
HTMLPanel.this.engine.loadContent(htmlContent);
}
});
}
}
}
- Start a WebView in a JFXPanel inside a sandboxed Applet with sample text, e.g. "Drag me or <input value='ME -> here >< or anywhere'/>"
- Select some text inside or outside the text-field and drag it around inside the WebView
- This exception is logged:
java.lang.SecurityException: Unable to create temporary file
at java.io.File.createTempFile(Unknown Source)
at java.io.File.createTempFile(Unknown Source)
at com.sun.javafx.webkit.UIClientImpl.startDrag(Unknown Source)
at com.sun.webkit.WebPage.fwkStartDrag(Unknown Source)
at com.sun.webkit.WebPage.twkProcessMouseEvent(Native Method)
at com.sun.webkit.WebPage.dispatchMouseEvent(Unknown Source)
at javafx.scene.web.WebView.processMouseEvent(Unknown Source)
at javafx.scene.web.WebView.lambda$registerEventHandlers$32(Unknown Source)
at javafx.scene.web.WebView$$Lambda$95/18574629.handle(Unknown Source)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(Unknown Source)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
at javafx.event.Event.fireEvent(Unknown Source)
at javafx.scene.Scene$MouseHandler.process(Unknown Source)
at javafx.scene.Scene$MouseHandler.access$1500(Unknown Source)
at javafx.scene.Scene.impl_processMouseEvent(Unknown Source)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)
at com.sun.javafx.tk.quantum.EmbeddedScene.lambda$null$281(Unknown Source)
at com.sun.javafx.tk.quantum.EmbeddedScene$$Lambda$252/6940360.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.EmbeddedScene.lambda$mouseEvent$282(Unknown Source)
at com.sun.javafx.tk.quantum.EmbeddedScene$$Lambda$217/22994187.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$164(Unknown Source)
at com.sun.javafx.application.PlatformImpl$$Lambda$63/7427672.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(Unknown Source)
at com.sun.javafx.application.PlatformImpl$$Lambda$62/6421567.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$141(Unknown Source)
at com.sun.glass.ui.win.WinApplication$$Lambda$53/24944659.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
In addition:
If the following code is also included in the setup of the WebView the WebView UI becomes unresponsive to mouse-events after dragging once (paint & mouse-scroll events are still processed).
The following code also seems to have lost its effectiveness. If i remember correctly this code prevented dragging of text from inside the WebView all together in 8u20/7u67 (not 100% sure though, but that was the intention at least).
view.setOnDragDetected(new EventHandler<MouseEvent>() // disable dragging of selection from WebView
{
public void handle(MouseEvent event)
{
event.consume();
}
});
Complete example code: (run this in browser as sandboxed applet)
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.input.MouseEvent;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javax.swing.JPanel;
public class JavaFXTestDragTest extends Applet
{
private static final long serialVersionUID = -7110935176335971839L;
public JavaFXTestDragTest()
{
super();
addMouseWheelListener(new MouseWheelListener()
{
public void mouseWheelMoved(MouseWheelEvent e)
{
e.consume(); // prevent MouseWheel Events to bubble up to the web-page.
}
});
}
@Override
public void init()
{
setLayout(new BorderLayout());
final HTMLPanel htmlPanel = new HTMLPanel();
add(BorderLayout.CENTER, htmlPanel);
htmlPanel.setHTMLContent("Drag ME or <input value='ME -> here:>< or anywhere'/><br><br><br><br><br><br>top<br><br><br><br><br><br>middle<br><br><br><br><br>bottom");
}
private static class HTMLPanel extends JPanel
{
private static final long serialVersionUID = -6272445527425893706L;
private final JFXPanel jfxPanel = new JFXPanel();
private WebEngine engine;
private volatile boolean isInitialized;
public HTMLPanel()
{
super(new BorderLayout());
Platform.setImplicitExit(false);
}
private void initComponents()
{
if (!isInitialized)
{
this.isInitialized = true;
createScene();
this.add(jfxPanel, BorderLayout.CENTER);
}
}
private void createScene()
{
Platform.runLater(new Runnable()
{
public void run()
{
WebView view = new WebView();
engine = view.getEngine();
view.setOnDragDetected(new EventHandler<MouseEvent>() // disable dragging of selection from WebView
{
public void handle(MouseEvent event)
{
event.consume();
}
});
jfxPanel.setScene(new Scene(view));
}
});
}
public void setHTMLContent(final String htmlContent)
{
initComponents();
Platform.runLater(new Runnable()
{
public void run()
{
HTMLPanel.this.engine.loadContent(htmlContent);
}
});
}
}
}