JDK-8087386 : [WebView] Pasteboard misbehaves in some scenarious
  • Type: Bug
  • Component: javafx
  • Sub-Component: web
  • Affected Version: 8u40,9
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2015-04-08
  • Updated: 2017-11-20
  • Resolved: 2017-11-20
Related Reports
Blocks :  
Relates :  
Relates :  
Description
The tree below shows some basic drag-n-drop and copy-n-paste scenarios and marks the result as OK or ERR (or both where the result should be corrected).

- The results were gathered on three platforms: WINDOWS, OSX and LINUX.
- The data types: PLAIN TEXT, HTML and IMAGE.
- For HTML an editable page was taken here: http://xing.github.io/wysihtml5

PLAIN TEXT
    WINDOWS
        DnD
            inside WebView
                OK
            from WebView to outside
                ERR: the drop is represented as an image
            to WebView from outside
                OK
        CnP
            inside WebView
                OK
            from WebView to outside
                OK
            to WebView from outside
                OK

    OSX
        DnD
            inside WebView
                OK
            from WebView to outside
                OK
            to WebView from outside
                OK
        CnP
            same as DnD

    LINUX
        DnD
            inside WebView
                OK
            from WebView to outside
                OK
            to WebView from outside
                OK
        CnP
            same as DnD

HTML
    WINDOWS
        DnD
            inside WebView
                OK
            from WebView to outside
                OK: the drop looks ok
                ERR: the drop is an image
            to WebView from outside
                OK
        CnP
            inside WebView
                OK
            from WebView to outside
                OK
            to WebView from outside
                OK

    OSX
        DnD
            inside WebView
                OK
            from WebView to outside
                OK: the drop is formatted properly
                ERR: links are surrounded with extra symbols
            to WebView from outside
                OK: the drop preserves the text data
                ERR: the drop is a plain text
        CnP
            same as DnD

    LINUX
        DnD
            inside WebView
                OK
            from WebView to outside
                ERR: the drop is of wrong encoding
            to WebView from outside
                OK: the drop preserves the text data
                ERR: the drop is a plain text
        CnP
            inside WebView
                OK
            from WebView to outside
                OK: the drop preserves the text data
                ERR: the drop is a plain text
            to WebView from outside
                ERR: the drop is a garbage plain text

IMAGE
    WINDOWS
        DnD
            from WebView to outside
                OK
        CnP
            from WebView to outside
                ERR: the drop is empty
     
    OSX
        DnD
            from WebView to outside
                ERR: IllegalArgumentException on drag start, no drop
        CnP
            from WebView to outside
                OK

    LINUX
        DnD
            from WebView to outside
                ERR: the drop is empty
        CnP
            from WebView to outside
                OK

Also, the testing was performed with the fix for RT-40330 applied. (Which doesn't degrade the behavior, but improves it in some cases).
Comments
Separate bugs have handled major scenarios(which were platform independent) listed in the bug description. These bugs have been linked in the related section. Encoding issue wont be fixed for reasons mentioned in above comment.
20-11-2017

About the Linux specific encoding issue, this is the analysis: 1]FX to other targets(FX writes html in UTF8) (a)FX to Gecko based targets(Firefox, Thunderbird) - Encoding problem in copied text as Firefox expects UTF16 (b)FX to other targets(Chrome,other webkit based targets, LibreOffice,Evolution) which expect UTF8 - Works fine 2]Other browsers to Firefox - Only chrome is working fine. Chrome writes to clipboard in UTF16. 3]Firefox to other targets including FX - Encoding problem 4]Other targets to FX(FX reads html in UTF8) (a) Webkit based targets(anything which writes UTF8 to clipboard) - Works fine. (b) Chrome is broken because it writes UTF16 with Byte Order Mark(BOM) prepended. (c) Firefox is broken. Even though it writes UTF16, there is no BOM prepended to the content. If we make FX to decode forcefully in UTF16(irrespective of BOM) it works fine. This issue has largely got to do with how applications agree on data sharing formats using clipboard. The problem subset is very small and majorly affects operability with Firefox (on Linux platform) only. Moreover, we cant fix one thing and ensure it wont break others.
20-11-2017

Targeted to 10 as an issue introduced in 8u or 9
31-08-2017

Targeted to 10 as an issue introduced in 8u or 9
17-02-2017

Approved by component triage team to defer
07-07-2016

The above exception in Mac will be fixed as part of JDK-8160597.
29-06-2016

OSX Image Drag and Drop Exception: Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Too small byte buffer size 0x0 [0] > 0 at com.sun.glass.ui.Pixels.<init>(Pixels.java:92) at com.sun.glass.ui.mac.MacPixels.<init>(MacPixels.java:53) at com.sun.glass.ui.mac.MacApplication.createPixels(MacApplication.java:223) at com.sun.glass.ui.Clipboard.getPixelsForRawImage(Clipboard.java:233) at com.sun.glass.ui.mac.MacSystemClipboard.popFromSystem(MacSystemClipboard.java:241) at com.sun.glass.ui.SystemClipboard.getData(SystemClipboard.java:76) at com.sun.glass.ui.ClipboardAssistance.getData(ClipboardAssistance.java:95) at com.sun.javafx.tk.quantum.QuantumClipboard.readImage(QuantumClipboard.java:367) at com.sun.javafx.tk.quantum.QuantumClipboard.getContent(QuantumClipboard.java:291) at javafx.scene.input.Clipboard.getContentImpl(Clipboard.java:283) at javafx.scene.input.Dragboard.getContentImpl(Dragboard.java:57) at javafx.scene.input.Clipboard.getContent(Clipboard.java:276) at javafx.scene.web.WebView.lambda$registerEventHandlers$6(WebView.java:1199) at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74) at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54) at javafx.event.Event.fireEvent(Event.java:198) at javafx.scene.Scene$DnDGesture.handleExitEnter(Scene.java:3321) at javafx.scene.Scene$DnDGesture.processTargetEnterOver(Scene.java:3209) at javafx.scene.Scene$DnDGesture.access$6300(Scene.java:3020) at javafx.scene.Scene$DropTargetListener.dragOver(Scene.java:2941) at com.sun.javafx.tk.quantum.GlassSceneDnDEventHandler.lambda$handleDragOver$3(GlassSceneDnDEventHandler.java:124) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.tk.quantum.GlassSceneDnDEventHandler.handleDragOver(GlassSceneDnDEventHandler.java:120)
24-06-2016

Tested for Mac,windows and linux. Below are the results: Mac Exception for drag and drop is pasted below the results; PLAIN TEXT WINDOWS DnD inside WebView OK from WebView to outside ERR: the drop is represented as an image to WebView from outside OK CnP inside WebView OK from WebView to outside OK to WebView from outside OK OSX DnD inside WebView OK from WebView to outside OK to WebView from outside OK CnP OK LINUX DnD inside WebView OK from WebView to outside OK to WebView from outside OK CnP same as DnD HTML WINDOWS DnD inside WebView OK from WebView to outside OK: the drop looks ok ERR: the drop is an image to WebView from outside OK CnP inside WebView OK from WebView to outside OK to WebView from outside OK OSX DnD inside WebView OK from WebView to outside OK to WebView from outside OK CnP OK LINUX DnD inside WebView OK from WebView to outside ERR: the drop is of wrong encoding to WebView from outside OK: the drop preserves the text data ERR: the drop is a plain text CnP inside WebView OK from WebView to outside OK: the drop preserves the text data ERR: the drop is a plain text to WebView from outside ERR: the drop is a garbage plain text IMAGE WINDOWS DnD from WebView to outside OK CnP from WebView to outside ERR: the drop is empty OSX DnD from WebView to outside ERR: IllegalArgumentException on drag start, no drop CnP from WebView to outside OK LINUX DnD from WebView to outside ERR: the drop is empty CnP from WebView to outside OK
24-06-2016

The IAE mentioned is this: [java] Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Too small byte buffer size 0x0 [0] > 0 [java] at com.sun.glass.ui.Pixels.<init>(Pixels.java:91) [java] at com.sun.glass.ui.mac.MacPixels.<init>(MacPixels.java:53) [java] at com.sun.glass.ui.mac.MacApplication.createPixels(MacApplication.java:223) [java] at com.sun.glass.ui.Clipboard.getPixelsForRawImage(Clipboard.java:233) [java] at com.sun.glass.ui.mac.MacSystemClipboard.popFromSystem(MacSystemClipboard.java:241) [java] at com.sun.glass.ui.SystemClipboard.getData(SystemClipboard.java:76) [java] at com.sun.glass.ui.ClipboardAssistance.getData(ClipboardAssistance.java:95) [java] at com.sun.javafx.tk.quantum.QuantumClipboard.readImage(QuantumClipboard.java:369) [java] at com.sun.javafx.tk.quantum.QuantumClipboard.getContent(QuantumClipboard.java:291) [java] at javafx.scene.input.Clipboard.getContentImpl(Clipboard.java:258) [java] at javafx.scene.input.Dragboard.getContentImpl(Dragboard.java:59) [java] at javafx.scene.input.Clipboard.getContent(Clipboard.java:251) [java] at javafx.scene.web.WebView.lambda$registerEventHandlers$35(WebView.java:1170) [java] at javafx.scene.web.WebView$$Lambda$86/611056422.handle(Unknown Source) [java] at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86) [java] at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238) [java] at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) [java] at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59) [java] at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) [java] at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) [java] at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) [java] at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) [java] at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) [java] at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) [java] at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74) [java] at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54) [java] at javafx.event.Event.fireEvent(Event.java:198) [java] at javafx.scene.Scene$DnDGesture.handleExitEnter(Scene.java:3211) [java] at javafx.scene.Scene$DnDGesture.processTargetEnterOver(Scene.java:3099) [java] at javafx.scene.Scene$DnDGesture.access$6100(Scene.java:2910) [java] at javafx.scene.Scene$DropTargetListener.dragOver(Scene.java:2831) [java] at com.sun.javafx.tk.quantum.GlassSceneDnDEventHandler.lambda$handleDragOver$307(GlassSceneDnDEventHandler.java:95) [java] at com.sun.javafx.tk.quantum.GlassSceneDnDEventHandler$$Lambda$243/487526871.run(Unknown Source) [java] at java.security.AccessController.doPrivileged(Native Method) [java] at com.sun.javafx.tk.quantum.GlassSceneDnDEventHandler.handleDragOver(GlassSceneDnDEventHandler.java:93) [java] at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleDragOver$360(GlassViewEventHandler.java:686) [java] at com.sun.javafx.tk.quantum.GlassViewEventHandler$$Lambda$242/1131365350.get(Unknown Source) [java] at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:404) [java] at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleDragOver(GlassViewEventHandler.java:685) [java] at com.sun.glass.ui.View.handleDragOver(View.java:697) [java] at com.sun.glass.ui.View.notifyDragOver(View.java:1015) [java] at com.sun.glass.ui.mac.MacPasteboard._putItemsFromArray(Native Method) [java] at com.sun.glass.ui.mac.MacPasteboard.putItemsFromArray(MacPasteboard.java:143) [java] at com.sun.glass.ui.mac.MacPasteboard.putItems(MacPasteboard.java:165) [java] at com.sun.glass.ui.mac.MacSystemClipboard.pushToSystem(MacSystemClipboard.java:223) [java] at com.sun.glass.ui.SystemClipboard.flush(SystemClipboard.java:51) [java] at com.sun.glass.ui.ClipboardAssistance.flush(ClipboardAssistance.java:59) [java] at com.sun.javafx.tk.quantum.QuantumClipboard.flush(QuantumClipboard.java:274) [java] at com.sun.javafx.tk.quantum.QuantumToolkit.startDrag(QuantumToolkit.java:1226) [java] at javafx.scene.Scene$DnDGesture.dragDetectedProcessed(Scene.java:2954) [java] at javafx.scene.Scene$DnDGesture.process(Scene.java:3023) [java] at javafx.scene.Scene$DnDGesture.access$8200(Scene.java:2910) [java] at javafx.scene.Scene$MouseHandler.process(Scene.java:3774) [java] at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3486) [java] at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762) [java] at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2495) [java] at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:350) [java] at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:275) [java] at java.security.AccessController.doPrivileged(Native Method) [java] at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$350(GlassViewEventHandler.java:385) [java] at com.sun.javafx.tk.quantum.GlassViewEventHandler$$Lambda$187/49027241.get(Unknown Source) [java] at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:404) [java] at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:384) [java] at com.sun.glass.ui.View.handleMouseEvent(View.java:555) [java] at com.sun.glass.ui.View.notifyMouse(View.java:927)
08-04-2015