RFR: 8160597: IllegalArgumentException when we initiate drag on Image [v2]

Jose Pereda jpereda at openjdk.java.net
Wed Nov 24 19:26:42 UTC 2021


> 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).

Jose Pereda has updated the pull request incrementally with one additional commit since the last revision:

  Address feedback

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

Changes:
  - all: https://git.openjdk.java.net/jfx/pull/668/files
  - new: https://git.openjdk.java.net/jfx/pull/668/files/19f513ef..170715e9

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jfx&pr=668&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jfx&pr=668&range=00-01

  Stats: 8 lines in 1 file changed: 2 ins; 0 del; 6 mod
  Patch: https://git.openjdk.java.net/jfx/pull/668.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/668/head:pull/668

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


More information about the openjfx-dev mailing list