Title: [134083] trunk/Source/WebCore
Revision
134083
Author
jer.no...@apple.com
Date
2012-11-09 10:16:07 -0800 (Fri, 09 Nov 2012)

Log Message

Plugin diagnostic logging should send plugin file basename instead of MIME type.
https://bugs.webkit.org/show_bug.cgi?id=101679

Reviewed by Eric Carlson.

Log the basename of the plugin file rather than the mime type so as to more
accurately log which plugin was used to handle the request.

* loader/SubframeLoader.cpp:
(WebCore::logPluginRequest): Log the plugin 'file' field, if present.
* plugins/PluginData.cpp:
(WebCore::PluginData::pluginInfoForMimeType): Factored out from pluginNameForMimeType.
(WebCore::PluginData::pluginNameForMimeType): Use pluginInfoForMimeType to retrieve name field.
(WebCore::PluginData::pluginFileForMimeType): Use pluginInfoForMimeType to retrieve file field.
* plugins/PluginData.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (134082 => 134083)


--- trunk/Source/WebCore/ChangeLog	2012-11-09 18:08:04 UTC (rev 134082)
+++ trunk/Source/WebCore/ChangeLog	2012-11-09 18:16:07 UTC (rev 134083)
@@ -1,3 +1,21 @@
+2012-11-09  Jer Noble  <jer.no...@apple.com>
+
+        Plugin diagnostic logging should send plugin file basename instead of MIME type.
+        https://bugs.webkit.org/show_bug.cgi?id=101679
+
+        Reviewed by Eric Carlson.
+
+        Log the basename of the plugin file rather than the mime type so as to more
+        accurately log which plugin was used to handle the request.
+
+        * loader/SubframeLoader.cpp:
+        (WebCore::logPluginRequest): Log the plugin 'file' field, if present.
+        * plugins/PluginData.cpp:
+        (WebCore::PluginData::pluginInfoForMimeType): Factored out from pluginNameForMimeType.
+        (WebCore::PluginData::pluginNameForMimeType): Use pluginInfoForMimeType to retrieve name field.
+        (WebCore::PluginData::pluginFileForMimeType): Use pluginInfoForMimeType to retrieve file field.
+        * plugins/PluginData.h:
+
 2012-11-09  Alexey Proskuryakov  <a...@apple.com>
 
         CookieJar uses Document class, which is a layering violation

Modified: trunk/Source/WebCore/loader/SubframeLoader.cpp (134082 => 134083)


--- trunk/Source/WebCore/loader/SubframeLoader.cpp	2012-11-09 18:08:04 UTC (rev 134082)
+++ trunk/Source/WebCore/loader/SubframeLoader.cpp	2012-11-09 18:16:07 UTC (rev 134083)
@@ -198,16 +198,19 @@
             return;
     }
 
+    String pluginFile = page->pluginData()->pluginFileForMimeType(newMIMEType);
+    String description = !pluginFile ? newMIMEType : pluginFile;
+
     ChromeClient* client = page->chrome()->client();
-    client->logDiagnosticMessage(success ? DiagnosticLoggingKeys::pluginLoadedKey() : DiagnosticLoggingKeys::pluginLoadingFailedKey(), newMIMEType, DiagnosticLoggingKeys::noopKey());
-    
+    client->logDiagnosticMessage(success ? DiagnosticLoggingKeys::pluginLoadedKey() : DiagnosticLoggingKeys::pluginLoadingFailedKey(), description, DiagnosticLoggingKeys::noopKey());
+
     if (!page->hasSeenAnyPlugin())
         client->logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsAtLeastOnePluginKey(), emptyString(), DiagnosticLoggingKeys::noopKey());
     
-    if (!page->hasSeenPlugin(newMIMEType))
-        client->logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsPluginKey(), newMIMEType, DiagnosticLoggingKeys::noopKey());
+    if (!page->hasSeenPlugin(description))
+        client->logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsPluginKey(), description, DiagnosticLoggingKeys::noopKey());
 
-    page->sawPlugin(newMIMEType);
+    page->sawPlugin(description);
 }
 
 bool SubframeLoader::requestObject(HTMLPlugInImageElement* ownerElement, const String& url, const AtomicString& frameName, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues)

Modified: trunk/Source/WebCore/plugins/PluginData.cpp (134082 => 134083)


--- trunk/Source/WebCore/plugins/PluginData.cpp	2012-11-09 18:08:04 UTC (rev 134082)
+++ trunk/Source/WebCore/plugins/PluginData.cpp	2012-11-09 18:16:07 UTC (rev 134083)
@@ -52,18 +52,32 @@
     return false;
 }
 
-String PluginData::pluginNameForMimeType(const String& mimeType) const
+const PluginInfo* PluginData::pluginInfoForMimeType(const String& mimeType) const
 {
     for (unsigned i = 0; i < m_mimes.size(); ++i) {
         const MimeClassInfo& info = m_mimes[i];
     
         if (info.type == mimeType)
-            return m_plugins[m_mimePluginIndices[i]].name;
+            return &m_plugins[m_mimePluginIndices[i]];
     }
 
+    return 0;
+}
+
+String PluginData::pluginNameForMimeType(const String& mimeType) const
+{
+    if (const PluginInfo* info = pluginInfoForMimeType(mimeType))
+        return info->name;
     return String();
 }
 
+String PluginData::pluginFileForMimeType(const String& mimeType) const
+{
+    if (const PluginInfo* info = pluginInfoForMimeType(mimeType))
+        return info->file;
+    return String();
+}
+
 #if USE(PLATFORM_STRATEGIES)
 void PluginData::refresh()
 {

Modified: trunk/Source/WebCore/plugins/PluginData.h (134082 => 134083)


--- trunk/Source/WebCore/plugins/PluginData.h	2012-11-09 18:08:04 UTC (rev 134082)
+++ trunk/Source/WebCore/plugins/PluginData.h	2012-11-09 18:16:07 UTC (rev 134083)
@@ -79,12 +79,14 @@
     
     bool supportsMimeType(const String& mimeType) const;
     String pluginNameForMimeType(const String& mimeType) const;
+    String pluginFileForMimeType(const String& mimeType) const;
 
     static void refresh();
 
 private:
     explicit PluginData(const Page*);
     void initPlugins(const Page*);
+    const PluginInfo* pluginInfoForMimeType(const String& mimeType) const;
 
     Vector<PluginInfo> m_plugins;
     Vector<MimeClassInfo> m_mimes;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to