changeset 9490:45efd3d83bf1 jdk-9+101

8146177: SVG "Copy Image to Clipboard" action causes JVM Crash in WebView Reviewed-by: kcr
author ghb
date Fri, 08 Jan 2016 08:11:51 -0800
parents 01c29b32f1c9
children 572a0599ee8c 9dbc60713b0f
files modules/web/src/main/native/Source/WebCore/platform/java/PasteboardJava.cpp
diffstat 1 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/modules/web/src/main/native/Source/WebCore/platform/java/PasteboardJava.cpp	Fri Jan 08 14:30:45 2016 +1300
+++ b/modules/web/src/main/native/Source/WebCore/platform/java/PasteboardJava.cpp	Fri Jan 08 08:11:51 2016 -0800
@@ -308,8 +308,26 @@
         }
     }
     if (m_copyPasteMode) {
-        Image* image = getCachedImage(node)->image();
-        jWriteImage(*image);
+        CachedImage* cachedImage = getCachedImage(node);
+        // CachedImage not exist
+        if (!cachedImage) {
+            return;
+        }
+
+        Image* image = cachedImage->image();
+        // Image data not exist
+        if (!image) {
+            return;
+        }
+
+        // SVGImage are not Bitmap backed, Let the receiving end decode the svg image
+        // based on url and its markup
+        if (image->isSVGImage()) {
+            jWriteURL(url.string(), createMarkup(node));
+        }
+        else {
+            jWriteImage(*image);
+        }
     }
 }