Integrated: 8160597: IllegalArgumentException when we initiate drag on Image

Jose Pereda jpereda at openjdk.java.net
Wed Nov 24 20:02:10 UTC 2021


On Mon, 15 Nov 2021 11:19:13 GMT, Jose Pereda <jpereda at openjdk.org> wrote:

> This PR fixes an exception that can happen when dragging an image from a WebView on macOS.
> 
> Dragging an image that is directly included like `<img src="some image"/>` works fine, without exception. However, there are (at least) two other cases when the IAE is thrown: 
> 
> - Dragging an image that is part of an hyperlink, like `<a href="some url"><img src="some image"/></a>`.
> - Dragging an image encoded as base64.
> 
> The IAE happens only on macOS, where a native image is created in `GlassPasteboard.m` from an URL, and in those two cases the generated image has 0x0 dimensions:
>  
> `<NSImage 0x... Size={0, 0} ...>`
> 
> which leads to `ByteArrayFromPixels` being called with a null byte array. 
> 
> The included test reproduces the case by directly pushing the `MacPasteboard` content (instead of adding a more complex test with a webView and a drag and drop gesture).

This pull request has now been integrated.

Changeset: 6e6c7119
Author:    Jose Pereda <jpereda at openjdk.org>
URL:       https://git.openjdk.java.net/jfx/commit/6e6c71190e5b9b07a323af0ab483dfc993302164
Stats:     157 lines in 5 files changed: 156 ins; 0 del; 1 mod

8160597: IllegalArgumentException when we initiate drag on Image

Reviewed-by: kcr

-------------

PR: https://git.openjdk.java.net/jfx/pull/668


More information about the openjfx-dev mailing list