Title: [232551] trunk/Source/WebCore
Revision
232551
Author
[email protected]
Date
2018-06-06 11:24:38 -0700 (Wed, 06 Jun 2018)

Log Message

Use the default label for snapshotted plug-ins if no mime-type is available
https://bugs.webkit.org/show_bug.cgi?id=186348

Patch by Antoine Quint <[email protected]> on 2018-06-06
Reviewed by Jon Lee.

In case the mime-type is not available, use the default labels otherwise we'd crash trying to look up the empty string in the HashMap.

* html/HTMLPlugInImageElement.cpp:
(WebCore::titleText):
(WebCore::subtitleText):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (232550 => 232551)


--- trunk/Source/WebCore/ChangeLog	2018-06-06 18:20:31 UTC (rev 232550)
+++ trunk/Source/WebCore/ChangeLog	2018-06-06 18:24:38 UTC (rev 232551)
@@ -1,3 +1,16 @@
+2018-06-06  Antoine Quint  <[email protected]>
+
+        Use the default label for snapshotted plug-ins if no mime-type is available
+        https://bugs.webkit.org/show_bug.cgi?id=186348
+
+        Reviewed by Jon Lee.
+
+        In case the mime-type is not available, use the default labels otherwise we'd crash trying to look up the empty string in the HashMap.
+
+        * html/HTMLPlugInImageElement.cpp:
+        (WebCore::titleText):
+        (WebCore::subtitleText):
+
 2018-06-06  Timothy Hatcher  <[email protected]>
 
         Wrong NSVisualEffectMaterial used for exit full screen overlay in dark mode.

Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp (232550 => 232551)


--- trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2018-06-06 18:20:31 UTC (rev 232550)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2018-06-06 18:24:38 UTC (rev 232551)
@@ -72,6 +72,9 @@
 
 static const String titleText(Page& page, const String& mimeType)
 {
+    if (mimeType.isEmpty())
+        return snapshottedPlugInLabelTitle();
+
     // FIXME: It's not consistent to get a string from the page's chrome client, but then cache it globally.
     // If it's global, it should come from elsewhere. If it's per-page then it should be cached per page.
     static NeverDestroyed<HashMap<String, String>> mimeTypeToLabelTitleMap;
@@ -85,6 +88,9 @@
 
 static const String subtitleText(Page& page, const String& mimeType)
 {
+    if (mimeType.isEmpty())
+        return snapshottedPlugInLabelSubtitle();
+
     // FIXME: It's not consistent to get a string from the page's chrome client, but then cache it globally.
     // If it's global, it should come from elsewhere. If it's per-page then it should be cached per page.
     static NeverDestroyed<HashMap<String, String>> mimeTypeToLabelSubtitleMap;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to